Allow var in fixed statement #8950
Unanswered
sweemer
asked this question in
Language Ideas
Replies: 1 comment 4 replies
-
The language doesn't allow multiple choice of unsafe
{
fixed (byte* ptr = c) // error, ambiguous
{
}
}
public class Foo
{
}
public static class FooExtension1
{
public static ref byte GetPinnableReference(this Foo foo) => throw null;
}
public static class FooExtension2
{
public static ref int GetPinnableReference(this Foo foo) => throw null;
} This should be actionable. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently the pointer type used in a fixed statement must be explicitly declared, unlike normal variables, which may be declared using
var
.I believe that it would be less redundant, and more consistent with the rest of the language, if
var
were allowed in fixed statements as well, such that the following code would become legal:I haven’t found any discussions or proposals for this yet. Can it be considered?
Beta Was this translation helpful? Give feedback.
All reactions