Esempio n. 1
0
        public B()
        {
            string error = "";

            unsafe {
                if (typeof(S *).GetElementType() != typeof(A.B.S))
                {
                    error += " composed cast (pointer),";
                }

                if (sizeof(S) != sizeof(A.B.S))
                {
                    error += " sizeof,";
                }

                S *p1 = stackalloc S [1];

                if ((*p1).GetType() != typeof(A.B.S))
                    error += " local declaration, 'stackalloc' keyword,";

                fixed(S *p2 = &s)
                {
                    if ((*p2).GetType() != typeof(A.B.S))
                    {
                        error += " class declaration, 'fixed' statement,";
                    }
                }
            }

            if (error.Length != 0)
            {
                throw new Exception("The following couldn't resolve S as A+B+S:" + error);
            }
        }
Esempio n. 2
0
 unsafe static void Main()
 {
     using (S m = new S())
     {
         S *mm = &m;
     }
 }
Esempio n. 3
0
 static S *instance()
 {
     if (!_inst)
     {
         _inst = new S;
     }
     return(_inst);
 }
Esempio n. 4
0
    public void Test()
    {
        fixed(byte *bP = Data)
        {
            S *p = (S *)bP;

            p = (S *)(p->Data + p->nData);
        }
    }
Esempio n. 5
0
 // Straight forward constructor
 public unsafe V(S *sRef)
 {
     this.sRef = sRef;
 }
Esempio n. 6
0
 static unsafe S *Test(S *s)
 {
     s->N();
     return(s);
 }
Esempio n. 7
0
 // Straight forward constructor
 public unsafe V(S * sRef) {
     this.sRef = sRef;
 }