14
top 6 comments
sorted by: hot top new old
[-] e8d79@discuss.tchncs.de 6 points 1 week ago

Why not just post the article from the C# docs instead? The pvs blog seems to add little to no additional information.

[-] JakenVeina@midwest.social 5 points 1 week ago
  • Union types

I know this is something folks have been clamoring for for a long time. It looks to me, though, like you're still dealing with object casts, under the hood, so not sure how useful this will be.

  • Closed hierarchies

Neat. Niche, but neat. I could see myself using this.

  • Labeled break and continue

Boy, this one feels like it should have existed a decade ago. I will ABSOLUTELY be using this.

  • Extension indexers

I.E. we can now polyfill Range support. Cool.

  • Collection expression arguments

I am absolutely mindboggled by anyone who thinks this syntax is a good idea. Seriously, it's EXACTLY as verbose as the thing it's trying to replace. What problem does this solve?

  • Memory safety

Sounds neat, I guess. Doubt I'll ever use it.

[-] pipe01@programming.dev 3 points 1 week ago

Seriously, it's EXACTLY as verbose as the thing it's trying to replace. What problem does this solve?

How is it as verbose? It can replace multiple lines of Adds with a single bracketed expression

[-] JakenVeina@midwest.social 2 points 1 week ago

You mean like the "single bracketed expression" syntax we've had since... hell, I don't even know, C#4?

List<string> items =
[
    new(capacity: 10),
    "First",
    "Second",
    "Third"
];
var items = new List<string>(capacity: 10)
{
    "First",
    "Second",
    "Third"
};
[-] RaphaelSchmitz@feddit.org 3 points 1 week ago

I think it's las about verbosity and more about maintainability. I like to use collection expressions as direct arguments because they automatically get typed based on the parameter type. Something like

ProcessEmployees([ employee, manager ]);

Now if you adjust the parameter type from List<> to HashSet<> you don't need to change anything at the call site.

That was the situation before. With that new feature I can now configure the collection more where needed.

[-] Metju@lemmy.world 2 points 1 week ago

Dunno if struct unions made it, but if they did - there should be a way to avoid boxing with object.

If they didn't make it - yeah, the feature is fucking useless 😅

this post was submitted on 21 Oct 2026
14 points (100.0% liked)

.NET

1888 readers
1 users here now

Getting started

Useful resources

IDEs and code editors

Tools

Rules

Related communities

Wikipedia pages

founded 3 years ago
MODERATORS