コード例 #1
0
    static void TestConstrainedMethodCallsOnEnum()
    {
        // Enum.GetHashCode optimization requires special treatment
        // in native signature encoding
        MyEnum e = MyEnum.Apple;

        e.GetHashCode();
    }
コード例 #2
0
ファイル: EnumHolder.cs プロジェクト: kbilsted/AutoHasher
 public override int ExpectedFromCodegen()
 {
     unchecked
     {
         var hashCode = 0;
         hashCode = (hashCode * 397) ^ Enum1.GetHashCode();
         hashCode = (hashCode * 397) ^ Enum2.GetHashCode();
         return(hashCode);
     }
 }
コード例 #3
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = Enum.GetHashCode();
         result = (result * 397) ^ (Class != null ? Class.GetHashCode() : 0);
         result = (result * 397) ^ Integer32;
         result = (result * 397) ^ (String != null ? String.GetHashCode() : 0);
         return(result);
     }
 }
コード例 #4
0
    static void TestConstrainedMethodCalls()
    {
        using (MyStruct s = new MyStruct())
        {
            ((Object)s).ToString();
        }

        // Enum.GetHashCode optimization requires special treatment
        // in native signature encoding
        MyEnum e = MyEnum.Apple;

        e.GetHashCode();
    }