static void Test6() { EInt16[] a = new EInt16[] { EInt16.A, EInt16.B, EInt16.C, EInt16.D }; EUInt16[] b = ((object)a) as EUInt16[]; EUInt16 i = b[0]; Console.WriteLine(i); }
public void writing_and_reading_enums_and_nullable_enums() { EByte? vNU8 = EByte.V1; ESByte? vNI8 = ESByte.V1; EInt16? vNI16 = EInt16.V1; EUInt16?vNU16 = EUInt16.V1; EInt32? vNI32 = EInt32.V1; EUInt32?vNUI32 = EUInt32.V1; EInt64? vNI64 = EInt64.V1; EUInt64?vNUI64 = EUInt64.V1; EByte vU8 = EByte.V1; ESByte vI8 = ESByte.V1; EInt16 vI16 = EInt16.V1; EUInt16 vU16 = EUInt16.V1; EInt32 vI32 = EInt32.V1; EUInt32 vUI32 = EUInt32.V1; EInt64 vI64 = EInt64.V1; EUInt64 vUI64 = EUInt64.V1; ReadWrite(w => { w.WriteNullableEnum(vNI32); w.WriteNullableEnum(vNU8); w.WriteNullableEnum(vNI8); w.WriteNullableEnum(vNI16); w.WriteNullableEnum(vNU16); w.WriteNullableEnum(vNUI32); w.WriteNullableEnum(vNI64); w.WriteNullableEnum(vNUI64); w.WriteEnum(vU8); w.WriteEnum(vI8); w.WriteEnum(vI16); w.WriteEnum(vU16); w.WriteEnum(vI32); w.WriteEnum(vUI32); w.WriteEnum(vI64); w.WriteEnum(vUI64); }, r => { r.ReadNullableEnum <EInt32>().Should().Be(vNI32); r.ReadNullableEnum <EByte>().Should().Be(vNU8); r.ReadNullableEnum <ESByte>().Should().Be(vNI8); r.ReadNullableEnum <EInt16>().Should().Be(vNI16); r.ReadNullableEnum <EUInt16>().Should().Be(vNU16); r.ReadNullableEnum <EUInt32>().Should().Be(vNUI32); r.ReadNullableEnum <EInt64>().Should().Be(vNI64); r.ReadNullableEnum <EUInt64>().Should().Be(vNUI64); r.ReadEnum <EByte>().Should().Be(vU8); r.ReadEnum <ESByte>().Should().Be(vI8); r.ReadEnum <EInt16>().Should().Be(vI16); r.ReadEnum <EUInt16>().Should().Be(vU16); r.ReadEnum <EInt32>().Should().Be(vI32); r.ReadEnum <EUInt32>().Should().Be(vUI32); r.ReadEnum <EInt64>().Should().Be(vI64); r.ReadEnum <EUInt64>().Should().Be(vUI64); }); }
static void FromEUInt16() { Console.WriteLine("--- FromEUInt16"); EUInt16[] a = new EUInt16[] { EUInt16.A, EUInt16.B, EUInt16.C, EUInt16.D }; TestCore(a); }
static T FromEUInt16(EUInt16 v) { Console.WriteLine(v); return(checked ((T)v)); }