Replies: 3 comments 6 replies
-
I prefer |
Beta Was this translation helpful? Give feedback.
-
Glad to see that Single/Two phase inference got some discussion time again. To me it's the biggest pain point when dealing with extensions/generics. |
Beta Was this translation helpful? Give feedback.
-
Will there be support for using System.Runtime.CompilerServices;
var item = new C();
Console.WriteLine(item.GetSecretOld()); // prints "boo"
Console.WriteLine(item.GetSecretNew()); // blows up at build time
static class PublicClassExtensions
{
extension(C item)
{
// error CS0106: The modifier 'extern' is not valid for this item
// error CS0501: 'PublicClassExtensions.extension(C).GetSecretNew()' must declare a body because it is not marked abstract, extern, or partial
[UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_secret")]
public extern ref string GetSecretNew();
}
[UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_secret")]
public static extern ref string GetSecretOld(this C item);
}
class C
{
private string _secret = "boo";
} Initially I was looking to ask if properties would support the unsafe accessor, but it looks like even the one-to-one translation currently doesn't. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
https://github.com/dotnet/csharplang/blob/main/meetings/2025/LDM-2025-05-05.md
Agenda
Feel free to read the date in either MM/DD/YYY or DD/MM/YYYY format, whichever suits your preferences.
Beta Was this translation helpful? Give feedback.
All reactions