I am building a Universal class library from existing code, and I get some compiler warnings that I for the life of it cannot figure out what to do with.
I have code like this:
void SomeMethod(Object data)
{
  var size = Marshal.SizeOf(data);
  ...
}
The code builds, but in the Universal project (and, I guess, .NET 4.5.1 and higher projects) I get the following compiler warning:
warning CS0618: 'System.Runtime.InteropServices.Marshal.SizeOf(object)' is obsolete: 'SizeOf(Object) may be unavailable in future releases. Instead, use SizeOf<T>().
But how do I create a replacement for Marshal.SizeOf(Object) in the above case using the generic parameter-less method Marshal.SizeOf<T>()? Theoretically, I might not have any idea what type data is?
Is it because using Marshal.SizeOf(Object) is considered bad practice that it has been attributed Obsolete? And the take-home message should really be "refactor the code completely"?
 
    