title: CS0308 Marshal.SizeOf<> error, how do I fix that?
body: <p>I have error in this code:</p>
  
  <pre><code>            intPtr = Marshal.AllocHGlobal(Marshal.SizeOf&lt;Win32API.OBJECT_BASIC_INFORMATION&gt;(object_BASIC_INFORMATION));
              Win32API.NtQueryObject(zero, 0, intPtr, Marshal.SizeOf&lt;Win32API.OBJECT_BASIC_INFORMATION&gt;(object_BASIC_INFORMATION), ref num);
              object_BASIC_INFORMATION = (Win32API.OBJECT_BASIC_INFORMATION)Marshal.PtrToStructure(intPtr, object_BASIC_INFORMATION.GetType());
              Marshal.FreeHGlobal(intPtr);
              intPtr2 = Marshal.AllocHGlobal(object_BASIC_INFORMATION.TypeInformationLength);
              num = object_BASIC_INFORMATION.TypeInformationLength;
  </code></pre>
  
  <p>This line:</p>
  
  <pre><code>intPtr = Marshal.AllocHGlobal(Marshal.SizeOf&lt;Win32API.OBJECT_BASIC_INFORMATION&gt;(object_BASIC_INFORMATION));
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>OBJECT_BASIC_INFORMATION: </p>
  
  <pre><code>        public struct OBJECT_BASIC_INFORMATION
      {
          public int Attributes;
          public int GrantedAccess;
          public int HandleCount;
          public int PointerCount;
          public int PagedPoolUsage;
          public int NonPagedPoolUsage;
          public int Reserved1;
          public int Reserved2;
          public int Reserved3;
          public int NameInformationLength;
          public int TypeInformationLength;
          public int SecurityDescriptorLength;
          public System.Runtime.InteropServices.ComTypes.FILETIME CreateTime;
      }
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>CS0308  C# The non-generic method cannot be used with type arguments</p>
  </blockquote>