Tootfinder

Opt-in global Mastodon full text search. Join the index!

@khalidabuhakmeh@mastodon.social
2025-09-12 15:24:29

Using the `extension` keyword in #csharp 14 is kind of awkward. It would be nicer to be able to use it as a top-level declaration without the wrapping static class.
Before you say, "where would they exist in that case?”, each namespace would have a catch-all static class that would hold these extension methods if there is no wrapping class.

Use of C# 14 extension keyword
@Nathan@social.lostinok.com
2025-11-12 03:30:25

#csharp #dotnet
devblogs.microsoft.com/dotnet/

@khalidabuhakmeh@mastodon.social
2025-09-12 14:44:03

Be honest, who here remembers that #csharp introduced a file keyword? #dotnet

@khalidabuhakmeh@mastodon.social
2025-11-13 14:45:10

Prediction for #csharp 15 syntax: dot shorthand assignment. #dotnet

Fruit normal = Fruit.Apple;
// C# 15 maybe?
Fruit shorthand = .Banana;

public enum Fruit
{
    Apple,
    Banana
}
@khalidabuhakmeh@mastodon.social
2025-11-13 14:20:00

It's neat that #csharp 14 lets #dotnet developers override the operator. What use cases can you think of using this in?

Overriding the ++ (increment) operator in C# 14