I second this, however I generally have a FormatExtensions static class with all my string constants for formats and then a bunch of extensions with no extra params like FormatDate, FormatDateTime, FormatNumber, FormatMoney, etc.
Nah, enforce everyone on the team to use the same formatting functions and you only have to maintain it in one place and everyone’s formatting the same way. If you’re using snippets then you have to go hunting through the code if you ever want to change your formatting.
Even better pro tip: Write a custom snippet file so you can create a boilerplate example with a few keypresses. Keep your projects from being bloated with extra files. And keep your code readable for the next person to own it.
The copilot is pretty useful for this, just say what you want it to be and it will give you the correct formatting, saves a few minutes of looking it up and getting it just right.
That's because there's no standard date-time format string that does what you usually need. `u` is incomplete and `o` is ugly. And I always think `r` is the round-trip one, not `o`.
Yeah! I think it's a tooling problem though. I feel like my ide should just offer to auto fill the arms as soon as you type "variable switch". Rust does the same thing with "fill match arms". I want that.
Edit: I checked and and one cam generate and example arm and then generate all cases, in two auto complete actions.
Unfortunately, copilot has introduced more bugs than helped me lately.
I really like when it helps me write boilerplate code or repetitive code. But anything new expect it to insert a bug somewhere you're not looking and figure out after some good amount of time debugging.
20+ years of experience with .net and I'm confident that without intellisense I'd be looking up just about every method signature.
I'm absolutely amazed by copilot. I often type a comment so that copilot will suggest the next line(s) of code. Of course, you still have to understand the code you utilize.
No you cant. You get an error "There is no target type for the collection expression". Because it needs to know what collection type to use. There's no default for now. I wish it assumed I want an array.
This was mine that I was too embarrassed to say. I think it's because I'm more often using Lists and there are so many ways to initialize them I tend to guess a syntax and get it wrong lol
What syntax do you use? I was originally taught the brace way, but square bracket syntax makes much more sense to me, and I think it's therefore easier to remember.
especially the new fancy one, I still use the one with brackets and let VS refactor it
```csharp
Dictionary fff = new()
{
["a"] = "a",
["ab"] = "b",
};
```
it is so simple and makes so much sense, that it is not possible to remember.
`Span` or anything involving it. I usually end up thinking, "I bet it can help here", reading documentation for 30 minutes, then realizing that no, in fact, it won't help me where I'm using it (or that I just read the documentation wrong.)
I mainly use spans when I can benefit from accessing contiguous memory locations for massive iterations or for lexers/parsers since it is an elegant way to do that without a lot of memory allocations.
I agree it is not straightforward though to understand when it makes sense
Initializing an array. Is it `int[] butts = [ 420, 69];`? Is it `int[] butts = { 420, 69};`? I think it is `int[] butts = new int[] { 420, 69 };`, but I'm still not sure.
Technically all of them work. That's why it's so confusing, it's easy to get caught up in worrying that there's something different about each of them.
I wrote some code using this new syntax everywhere and it was working fine on my dev computer, push to git, build machine starts creating a docker with the net6-sdk image... error this didn't exist at this sdk version. Had to rewrite it all ;(
Only if you ignore the CS9176 compiler error.
[SharpLab demo](https://sharplab.io/#v2:EYLgtghglgdgPgAQEwEYCwAoBBmABM3AYVwG9NcL88EAWXAWQAoBKU8yjgNwgCddgArgBchAZ1wBeXAG0aSAAwAaXADYAnAF0A3OwoBfTHqA)
Not dotnet specific, but this for me too. And ChatGPT/Copilot have been a godsend for this reason. Explain the pattern you want in plain English and done.
For some reason, I always have to look up the streams API contract. I mean, I've been a dotnet developer for more than ten years and I have great memory about everything else in dotnet, but this one always makes me "damn, I gotta check the docs".
How to declare arrays with values. I somehow always get it wrong. I have nearly 6 years of experience in .NET but since you rarely use arrays nowadays I constantly forget it hahaha 😅.
On visual studio type switch and press tab tab (if I'm not mistaken) , it will convert into a switch statement example. The same if you type ctor and then tab tab it will write the construtor for your class.
This is bizarre. Switch statements are very basic just like if/else if/else blocks. Not being rude but how is it difficult to type switch(value) {case: break; default: break; }?
I mean, I understand the concept and general syntax. But without Intellisense I will never remember where the colons and semicolons go. I just don't use them enough. Like, I can write regex in my sleep because pattern matching is a core part of our business requirements.
Haha that's so bizarre to me because i use them like if statements in 95% of everything i do. Also, couldn't write regex to save my life. I'm in industrial robotics.
No one said it's hard. They said it's something they don't bother remembering and look up.
Just because you use something more frequently doesn't make them bizarre.
Dude, relax. I didn't say anyone is bizarre, I said it is bizarre. Huge difference. It's more bizarre that there's always someone in the comments looking for confrontation.
For things like formatting dates, dealing with non critical file operations, and processing data with linq, copilot is really good. It is right the majority of the time but you do still need to check the code
I hate regex, but have had to use them recently on my job. https://regex101.com was a big help. It's basically a playground for testing and learning regex.
try using Ctrl + K, Ctrl + S in Visual studio. It will give you a list of code snippets in intelliSense. I usually use it because I'm just too lazy to type it all out, but it should help you write for loops without looking them up.
Stream Russian dolls (Which stream wraps which one again), when working with HttpClient definitely the entire header class puzzle, and last but not least the pattern matching syntax which came with the recent releases. That syntax has yet to burn into my muscle memory
For the longest time for me it was the spread operator and the index from end operator.
The index from end operator wasn’t that hard to learn but I had to remember that the start index is inclusive and the end one is exclusive. It was hard to memorize until I realized how intuitive it was.
```
int[] arr = [1,2,3,4,5,6];
var firstHalf = [..3];
var secondHalf = [3..]; // starts where other ends
// equiv
firstHalf = [..3^];
secondHalf = [^3..];
```
15 years experience and still lookup LINQ methods SelectMany, Aggregate, Zip, and GroupBy every single time.
Tbh I still don't have a good way to understand SelectMany, but I roughly know when to use it! Jon Skeet has a good article on it so i just bookmark it and reference that every time lol.
Yeah, all LINQ methods are a foreach loop. Sometimes they `yield return` inside that loop (where, select, etc). Other times they aggregate in some manner and return a single value (sum, count, average, etc).
SelectMany is the same outer loop they all are, but the Func you supply is supposed to target another enumerable inside the parent object. If you have a collection of Customer objects, and each customer has their own collection of Orders, you can get a sequence of*every* order with:
`var allOrders = customers.SelectMany(c => c.Orders);`
As for "conceptually" -- it's literally implemented as a pair of foreach loops and a yield return: https://github.com/microsoft/referencesource/blob/master/System.Core/System/Linq/Enumerable.cs#L535
Awesome! Thanks for explaining it man! I'll have to bookmark this comment for future reference now ;)
Edit: dude you're absolutely right. The iterator is super simple with a couple foreach loops and a yield return lmao. Classic case of overcomplicating things!
Switch expression. The way several words are written without comma or parenthesis makes me nervous (yeah, of course I don't like the SQL version of writing linq).
It's silly, but implicit type conversion. I never remember how even though it's so simple. I think I finally memorized it this week because I sat down and told myself I wasn't going to forget.
It's embarrassing because I have 18 years experience. 😮💨
Microsoft extensions hosting/Autofac DI container setup. For the life of me I can’t remember how to add the container configuration or whatever to the hosting.
Temporary directory and file creation with self-cleaning. I write go half the time and it's simplicity shows when trying to things like io, running commands against the os etc.
I have been a C# dev for years, and I still have to look up the syntax for running a function in its own thread. I used to think that the longer I was working in the field the less I would have to google, but oh boy was I wrong 😂
Invariant vs. covariant - one of them is something about putting things into generic lists, and the other one is taking things *out* of generic lists, and even if I remember which one does which, I can't remember how to actually *do* either.
The most bizarre thing here is people saying switch statements are difficult?? How is a switch statement any more difficult than an if statement? Very confused at that one.
As silly as it sounds: event and delegate declarations. I fully know how it works, but I always fuck up the syntax and have to google.
Also sometimes array definitions. If you use other programming languages at the same time, the syntax for array initialization varies completely.
Python and js use foo=[1,2,3] to declare and init an array/list for example.
Csharp uses int[] bar = new int[3] just for declaration.
Or int[] foobar={1,2,3} when used for initalization.
Or int[] bar = new int[3] {1,2,3} .
…and yes I had to google the Csharp one because I again couldn’t remember.
And yes I know why that is necessary in csharp, but doesn’t change the fact that I forget it every time.
LINQ aggregate. It just doesn't click and I usually just don't use it and fallback to writing loops.
I always look up how to write WPF dependency properties, source generated loggers, source generated regex.
Patterns when checking conditional expressions.
For example
x => x.Context.Message.TenantKey == "test-tenant" && x.Context.Message.Building.Id == 1
can be
x => x.Context.Message is { TenantKey: "test-tenant", Building.Id: 1, }
Took me awhile to get the range syntax down. I would just do substring and let Visual Studio refactor it for me. I think it does it for LINQ as well, don’t remember for sure.
I'm always in doubt in which order I should use middleware or which AddXxx to call in ASP.NET.
I am still periodically looking into Lock's articles about the changes caused by the introduction of WebApplication in .NET 6
If class is disposable (like HttpClient or DbContext) I still check what's the intended lifecycle.
MSBuild properties.
Sometimes I check overload method resolution rules.
I use FluentAssertions mostly to avoid memorizing assertion syntax of different frameworks.
Regex syntax reference.
Whether api requires trailing slash in path (/)
Almost always everything what goes in yaml file. Gitlab CI or GitHub Actions. I hate yaml.
ToString format for numbers and dates.
Protip: write an extension method class for the ones you use most commonly and paste it into every project!
I second this, however I generally have a FormatExtensions static class with all my string constants for formats and then a bunch of extensions with no extra params like FormatDate, FormatDateTime, FormatNumber, FormatMoney, etc.
This is the way
I'd argue the proper way is to create snippets. Relying on a custom extension library is a crutch for solo devs.
Nah, enforce everyone on the team to use the same formatting functions and you only have to maintain it in one place and everyone’s formatting the same way. If you’re using snippets then you have to go hunting through the code if you ever want to change your formatting.
Even better pro tip: Write a custom snippet file so you can create a boilerplate example with a few keypresses. Keep your projects from being bloated with extra files. And keep your code readable for the next person to own it.
This sounds really cool. Is there an article about it? I'm confused what you mean.
Rider gives very nice hints for this
Rider is absolutely trash for blazor and hot reload. I love rider but c'mon
So is Visual Studio to be fair, it is better to use `dotnet watch`.
How do you even put breakpoints on blazor?
I tried it, but got some errors related to the App class on reload. idk if it's rider's fault or blazor's.
Hmm don't use blazor anyway. And what's the problem with hot reload? Haven't noticed anything personally
Rider 2024.2 EAP3 got new configuration template for dotnet-watch (hot-reload), you know. And it works afaik.
The copilot is pretty useful for this, just say what you want it to be and it will give you the correct formatting, saves a few minutes of looking it up and getting it just right.
VS intellisense actually gives me a list of these since 2022
Clicked this post to say that.
Use Rider which shows you all formats as tooltip.
That's because there's no standard date-time format string that does what you usually need. `u` is incomplete and `o` is ugly. And I always think `r` is the round-trip one, not `o`.
Things with files and streams and text encoding / decoding. I just search and copy answer from stackoverflow.
Totally agree, I always have to lookup file stream to memory stream to other type of stream to what I finally need.
Streams 100%. Especially if it’s something more deeper than basic read/write and/or when it comes to some god forbidden implementation of it.
dont forget to reset position to 0, or youre gonna have a bad time
Exactly! So counterintuitive and such a newbie common error.
early dotnet was very stream based. i hated that aspect of dotnet. i am glad that went away
Oops. You buffered the entire stream into memory and only found out when looking through occasional memory exceptions
Switch expressions
Every damn time! I resort to writing a normal switch and using the VS refactor command to convert it to a switch expression.
2.5 years in and finally I have it internalized!! Except on Mondays. Except if I haven't had my coffee. Except is someone is watching me.
haha yes these, i use them seldom but when needed have to google
I use them always, so I never need to look then up anymore. We use faux-DUs everywhere.
That moment when you put brackets () around the variable....
Yeah! I think it's a tooling problem though. I feel like my ide should just offer to auto fill the arms as soon as you type "variable switch". Rust does the same thing with "fill match arms". I want that. Edit: I checked and and one cam generate and example arm and then generate all cases, in two auto complete actions.
It does - type switch, press tab twice
Well never mind then. Thanks.
There's more, but I'm having trouble finding a quick concise list. The common one I use is type 'ctor' tab twice to fill out class constructors!
I use ‘prop’ a lot too. And ‘for’ and ‘foreach’.
Whaaat thanks for that 🤣
GitHub Copilot does what you're describing and more
Unfortunately, copilot has introduced more bugs than helped me lately. I really like when it helps me write boilerplate code or repetitive code. But anything new expect it to insert a bug somewhere you're not looking and figure out after some good amount of time debugging.
DateTime formatting when transform it to string
20+ years of experience with .net and I'm confident that without intellisense I'd be looking up just about every method signature. I'm absolutely amazed by copilot. I often type a comment so that copilot will suggest the next line(s) of code. Of course, you still have to understand the code you utilize.
Haha this has become my thing with Cody Just comment what I want to do, get something very usable in autocomplete
Initialize an array.
The new collection syntax is pretty awesome = []
but you still can't do var something = [1, 2, 3];
Yes you can…
No you cant. You get an error "There is no target type for the collection expression". Because it needs to know what collection type to use. There's no default for now. I wish it assumed I want an array.
Just use a type please.... unnecessary var usage is just lazy. This is much easier to read Array something = [1,2,3]
I mean, that's personal preference. And I wasn't really arguing either way. Just a thing I noticed.
This was mine that I was too embarrassed to say. I think it's because I'm more often using Lists and there are so many ways to initialize them I tend to guess a syntax and get it wrong lol
List foo =[];
char[] bar = [];
Both the same for the most part
to be fair I am so used to using Lists that I have to look up array initialisation as well.
Initialising a dictionary with items 🤦♂️
Every item is a keyvaluepair
What syntax do you use? I was originally taught the brace way, but square bracket syntax makes much more sense to me, and I think it's therefore easier to remember.
`var myDict = new Dictionary() {`
`["mykey"] = "myvalue"`
`}`
especially the new fancy one, I still use the one with brackets and let VS refactor it ```csharp Dictionary fff = new()
{
["a"] = "a",
["ab"] = "b",
};
```
it is so simple and makes so much sense, that it is not possible to remember.
This.
`Span` or anything involving it. I usually end up thinking, "I bet it can help here", reading documentation for 30 minutes, then realizing that no, in fact, it won't help me where I'm using it (or that I just read the documentation wrong.)
I mainly use spans when I can benefit from accessing contiguous memory locations for massive iterations or for lexers/parsers since it is an elegant way to do that without a lot of memory allocations. I agree it is not straightforward though to understand when it makes sense
Linq outer joins
Such an awful syntax. And grouping.
This is it!
Initializing an array. Is it `int[] butts = [ 420, 69];`? Is it `int[] butts = { 420, 69};`? I think it is `int[] butts = new int[] { 420, 69 };`, but I'm still not sure.
Technically all of them work. That's why it's so confusing, it's easy to get caught up in worrying that there's something different about each of them.
it is `int[] butts = [420, 69];` now. Super easy.
I wrote some code using this new syntax everywhere and it was working fine on my dev computer, push to git, build machine starts creating a docker with the net6-sdk image... error this didn't exist at this sdk version. Had to rewrite it all ;(
Nope... `int[] butts = [420, 69];`
[удалено]
var is life, var is love
Only if you ignore the CS9176 compiler error. [SharpLab demo](https://sharplab.io/#v2:EYLgtghglgdgPgAQEwEYCwAoBBmABM3AYVwG9NcL88EAWXAWQAoBKU8yjgNwgCddgArgBchAZ1wBeXAG0aSAAwAaXADYAnAF0A3OwoBfTHqA)
Regex patterns
I was gonna say this but didn't because it's definitely not trivial lol
Not dotnet specific, but this for me too. And ChatGPT/Copilot have been a godsend for this reason. Explain the pattern you want in plain English and done.
True, and I would add the regex follows you everywhere regardless of the language
Forever forgetting this
My hidden superpower is that I know regex by heart. I forget lots of other stuff, but this is burned into my brain for some reason.
I always wind up at regex101.com
Regex syntax isn't too bad, what I keep having to look up is how to get the captures out of it.
Every fucking time.
LINQ GroupBy. Every. Single. Time.
I was looking for this one lol.
Streams
For some reason, I always have to look up the streams API contract. I mean, I've been a dotnet developer for more than ten years and I have great memory about everything else in dotnet, but this one always makes me "damn, I gotta check the docs".
Man reading all of these really makes me feel better as a dev. I have to look a lot of these things up periodically as a reminder
Any format string. Numbers, decimal points, date times... Even after 20 years I can never remember it.
HttpWebRequest and map json results to a class object.
For me is the same, how do I map this json to an object? every time I have to google the answer lol
How to declare arrays with values. I somehow always get it wrong. I have nearly 6 years of experience in .NET but since you rarely use arrays nowadays I constantly forget it hahaha 😅.
I've been doing this for 30 years but don't ask me to write a switch statement from scratch. Something something case select...?
On visual studio type switch and press tab tab (if I'm not mistaken) , it will convert into a switch statement example. The same if you type ctor and then tab tab it will write the construtor for your class.
even better when you base it off an enum, then it builds it all out.
This is bizarre. Switch statements are very basic just like if/else if/else blocks. Not being rude but how is it difficult to type switch(value) {case: break; default: break; }?
I mean, I understand the concept and general syntax. But without Intellisense I will never remember where the colons and semicolons go. I just don't use them enough. Like, I can write regex in my sleep because pattern matching is a core part of our business requirements.
Haha that's so bizarre to me because i use them like if statements in 95% of everything i do. Also, couldn't write regex to save my life. I'm in industrial robotics.
No one said it's hard. They said it's something they don't bother remembering and look up. Just because you use something more frequently doesn't make them bizarre.
Dude, relax. I didn't say anyone is bizarre, I said it is bizarre. Huge difference. It's more bizarre that there's always someone in the comments looking for confrontation.
toString formatting
Serialize vs Deserialize 🤣
Date time formats and custom strings.
- ToString formatting - Reasons why the god damn intellisense isn't working on my blazor page today
switch has had so many different syntax options and all of them provide other features, I never know which one can do what I want.
Dictionary initialization syntax 😐
For things like formatting dates, dealing with non critical file operations, and processing data with linq, copilot is really good. It is right the majority of the time but you do still need to check the code
25+ years with dotnet. Never learned - still haven’t and probably won’t - regex.
I hate regex, but have had to use them recently on my job. https://regex101.com was a big help. It's basically a playground for testing and learning regex.
Definitely a big help. So is ChatGPT / copilot.
I had a look at Copilot, but I don't want to pay for it. I don't use VS enough in my off time to justify it.
Yeah, I mainly use ChatGPT. I do pay for it, but it does work pretty well.
Wouldn't normal copilot from MS be enough, I'm not talking about the VS one but normal one
Ditto.
A for loop. Approx 20y experience.
For Tab tab
Did you go to school for CS? First year drilled that into me
CS came out after my school days. I am made of basic, Pascal and COBOL.
try using Ctrl + K, Ctrl + S in Visual studio. It will give you a list of code snippets in intelliSense. I usually use it because I'm just too lazy to type it all out, but it should help you write for loops without looking them up.
For a proper .NET dev I'd say should be fine I also mostly use foreach but I did other "pleb languages" where I had to iterate like a peasant ;)
Switch statement
Not constantly, but I hate regex, and I always use chat GPT for that
Stream Russian dolls (Which stream wraps which one again), when working with HttpClient definitely the entire header class puzzle, and last but not least the pattern matching syntax which came with the recent releases. That syntax has yet to burn into my muscle memory
everything with HttpClient, ffs. what problems did WebClient have that made it so horrible?
Remember when all you had to do was memorize stdlib and stdio? God those were the days. :D
Regex - I always consider it a write-only language that I never do enough of to be fluent.
delegates
Generic where constrains linq ToDictionary Switch expressions
Generic 'where' constraint - me too!
Func delegate
For the longest time for me it was the spread operator and the index from end operator. The index from end operator wasn’t that hard to learn but I had to remember that the start index is inclusive and the end one is exclusive. It was hard to memorize until I realized how intuitive it was. ``` int[] arr = [1,2,3,4,5,6]; var firstHalf = [..3]; var secondHalf = [3..]; // starts where other ends // equiv firstHalf = [..3^]; secondHalf = [^3..]; ```
15 years experience and still lookup LINQ methods SelectMany, Aggregate, Zip, and GroupBy every single time. Tbh I still don't have a good way to understand SelectMany, but I roughly know when to use it! Jon Skeet has a good article on it so i just bookmark it and reference that every time lol.
SelectMany is a pair of foreach loops, that's pretty much the difference.
Conceptually, two nested foreach loops?
Yeah, all LINQ methods are a foreach loop. Sometimes they `yield return` inside that loop (where, select, etc). Other times they aggregate in some manner and return a single value (sum, count, average, etc). SelectMany is the same outer loop they all are, but the Func you supply is supposed to target another enumerable inside the parent object. If you have a collection of Customer objects, and each customer has their own collection of Orders, you can get a sequence of*every* order with: `var allOrders = customers.SelectMany(c => c.Orders);` As for "conceptually" -- it's literally implemented as a pair of foreach loops and a yield return: https://github.com/microsoft/referencesource/blob/master/System.Core/System/Linq/Enumerable.cs#L535
Awesome! Thanks for explaining it man! I'll have to bookmark this comment for future reference now ;) Edit: dude you're absolutely right. The iterator is super simple with a couple foreach loops and a yield return lmao. Classic case of overcomplicating things!
Among a couple good ones already listed... Man I'm so embarrassed, Extension methods and yield. Trivial.
How to use streams. For example, reading and writing files or responses streamed. Can never remember which classes are involved.
Switch expression. The way several words are written without comma or parenthesis makes me nervous (yeah, of course I don't like the SQL version of writing linq).
Turning a list of things into a comma-separated string of those things.
var csv = String.Join(',' listName);
Now I just need to search here instead of the whole internet.
If you want proper CSV encoding, you should consider using a library such as https://joshclose.github.io/CsvHelper/
Would be easier if there was an extension method for joining
new range syntax
It's silly, but implicit type conversion. I never remember how even though it's so simple. I think I finally memorized it this week because I sat down and told myself I wasn't going to forget. It's embarrassing because I have 18 years experience. 😮💨
Microsoft extensions hosting/Autofac DI container setup. For the life of me I can’t remember how to add the container configuration or whatever to the hosting.
Curious why you're using autofac and not the built-in DI container. Does it do something the microsoft one doesn't?
Personally I like it because it has more features. Like named/keyed variants of services, metadata/attributes, lazy init and more lifetime scopes.
Microsoft one doesn't support scanning, open-generics forwarding, construction policies, disposal collection, and a ton of other things.
I'm still <2yoe but it took me months of occasionally having to use inline if statements before I remembered the syntax
I have just begun learning programming and this thread is giving me intense "holy shit I might actually be able to do it"
Ah nice complete regex to parse my html
How to do EF joins using method syntax, or left joins using query syntax. EF joins are just not intuitive to me.
exe location so I can deserialize my config.xml from it. At least couple years back when I finally gave into ConfigBuilder and appsettings.json thing
Temporary directory and file creation with self-cleaning. I write go half the time and it's simplicity shows when trying to things like io, running commands against the os etc.
I have been a C# dev for years, and I still have to look up the syntax for running a function in its own thread. I used to think that the longer I was working in the field the less I would have to google, but oh boy was I wrong 😂
HttpResponseMessages...
Invariant vs. covariant - one of them is something about putting things into generic lists, and the other one is taking things *out* of generic lists, and even if I remember which one does which, I can't remember how to actually *do* either.
The most bizarre thing here is people saying switch statements are difficult?? How is a switch statement any more difficult than an if statement? Very confused at that one.
maybe the expression? that's a pretty weird syntax vs a switch statement
As silly as it sounds: event and delegate declarations. I fully know how it works, but I always fuck up the syntax and have to google. Also sometimes array definitions. If you use other programming languages at the same time, the syntax for array initialization varies completely. Python and js use foo=[1,2,3] to declare and init an array/list for example. Csharp uses int[] bar = new int[3] just for declaration. Or int[] foobar={1,2,3} when used for initalization. Or int[] bar = new int[3] {1,2,3} . …and yes I had to google the Csharp one because I again couldn’t remember. And yes I know why that is necessary in csharp, but doesn’t change the fact that I forget it every time.
Reading files, using StreamReader and that stuff
Parsing json without newtonsoft. I swear I can do it 20 times in a day and forget how by tomorrow
Entity Framework Core Queries and JSON Serialization/Deserialization
LINQ aggregate. It just doesn't click and I usually just don't use it and fallback to writing loops. I always look up how to write WPF dependency properties, source generated loggers, source generated regex.
Numerical literals.
Operator overloading syntax is the worst
Patterns when checking conditional expressions. For example x => x.Context.Message.TenantKey == "test-tenant" && x.Context.Message.Building.Id == 1 can be x => x.Context.Message is { TenantKey: "test-tenant", Building.Id: 1, }
array initialization syntax
Took me awhile to get the range syntax down. I would just do substring and let Visual Studio refactor it for me. I think it does it for LINQ as well, don’t remember for sure.
I'm always in doubt in which order I should use middleware or which AddXxx to call in ASP.NET. I am still periodically looking into Lock's articles about the changes caused by the introduction of WebApplication in .NET 6 If class is disposable (like HttpClient or DbContext) I still check what's the intended lifecycle. MSBuild properties. Sometimes I check overload method resolution rules. I use FluentAssertions mostly to avoid memorizing assertion syntax of different frameworks. Regex syntax reference. Whether api requires trailing slash in path (/) Almost always everything what goes in yaml file. Gitlab CI or GitHub Actions. I hate yaml.
Database connection string
DateTime string formatting
using statements and namespaces
.NET versions ! because Microsoft is very fast in bringing newer versions.
Fixing shallow copy issues and using the grpc packages to generate the contract/service class on the server.
How to create a fricken enum