Open4

C#のNull許容参照型のメタデータ

kenichiudakenichiuda

逆コンパイルした例

using System;
using System.Collections.Generic;

#nullable enable
class Program
{
    public string? s;
    public Dictionary<string, object?>? d;
    public int[] a;
    public object[]? b;
    public object?[]? c;
    public Object?[] e;
    public Object? M(String a, String? b, String[]? c){ return default;}
 }

#nullable disable
class C
{
    string s;
    string? s2;
}
[System.Runtime.CompilerServices.NullableContext(2)]
[System.Runtime.CompilerServices.Nullable(0)]
internal class Program
{
    public string s;

    [System.Runtime.CompilerServices.Nullable(new byte[] {
        2,
        1,
        2
    })]
    public Dictionary<string, object> d;

    [System.Runtime.CompilerServices.Nullable(1)]
    public int[] a;

    [System.Runtime.CompilerServices.Nullable(new byte[] {
        2,
        1
    })]
    public object[] b;

    public object[] c;

    [System.Runtime.CompilerServices.Nullable(new byte[] {
        1,
        2
    })]
    public object[] e;

    public object M([System.Runtime.CompilerServices.Nullable(1)] string a, string b, [System.Runtime.CompilerServices.Nullable(new byte[] {
        2,
        1
    })] string[] c)
    {
        return null;
    }
}
internal class C
{
    private string s;

    [System.Runtime.CompilerServices.Nullable(2)]
    private string s2;
}
kenichiudakenichiuda

NullableAttributeの引数の1とか2NullableFlowState Enum?
それともNullableAnnotation Enum?

-> NullableAnnotationが近い。

Annotated 2 The expression is annotated (does have a ?).
None 0 The expression has not been analyzed, or the syntax is not an expression (such as a statement).
NotAnnotated 1 The expression is not annotated (does not have a ?).