Exemplo n.º 1
0
 public override bool Equals(object obj)
 {
     if (obj is StringAndStuff)
     {
         StringAndStuff s        = (StringAndStuff)obj;
         bool           nullStr  = str == null;
         bool           snullStr = s.str == null;
         return(s.x == x && s.y == y && (nullStr ? (snullStr) : (str.Equals(s.str))));
     }
     return(false);
 }
Exemplo n.º 2
0
        public static void TestDeserializeInteropString()
        {
            {
                StringAndStuff s = new StringAndStuff(123, "omg wtf lol bbq", 123.456f);
                StructInfo <StringAndStuff> .size.ShouldBe(sizeof(int) + StructInfo <InteropString32> .size + sizeof(float));

                s.x   = 123;
                s.y   = 123.456f;
                s.str = "omg wtf lol bbq";
                byte[] bytes = Unsafe.ToBytes(s);

                Unsafe.FromBytes <StringAndStuff>(bytes).ShouldEqual(new StringAndStuff(123, "omg wtf lol bbq", 123.456f));
            }
        }