void Test <T>() { Func <T, bool> func = (arg => { MyGenericStruct <T>?v1 = null; return(v1?.ToString() == null); }); }
void Test <T>() { Enumerable.Repeat(typeof(T), 1).Where( i => { return(Enumerable.Empty <T>().FirstOrDefault(arg => { MyGenericStruct <T>?v1 = null; return v1?.ToString() == null; }) != null); }); }
public void GenericStruct() { var ofDouble = new MyGenericStruct <double>(100.4f, -3, 200.5f); var ofDouble2 = ZeroFormatterSerializer.Convert(ofDouble); ofDouble2.x.Is(100.4f); ofDouble2.y.Is(-3); ofDouble2.z.Is(200.5f); var ofString = new MyGenericStruct <string>("", int.MaxValue, "abc"); var ofString2 = ZeroFormatterSerializer.Convert(ofString); ofString2.x.Is(""); ofString2.y.Is(int.MaxValue); ofString2.z.Is("abc"); }
protected override void SerializeItem(NetworkWriter writer, MyGenericStruct <float> item) { writer.WriteSingle(item.genericpotato); }