(ded4a3e0a) v0.9.0.7
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace MonoGame.Utilities
|
||||
{
|
||||
internal static partial class ReflectionHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Generics handler for Marshal.SizeOf
|
||||
/// </summary>
|
||||
internal static class SizeOf<T>
|
||||
{
|
||||
static int _sizeOf;
|
||||
|
||||
static SizeOf()
|
||||
{
|
||||
_sizeOf = Marshal.SizeOf<T>();
|
||||
}
|
||||
|
||||
static public int Get()
|
||||
{
|
||||
return _sizeOf;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fallback handler for Marshal.SizeOf(type)
|
||||
/// </summary>
|
||||
internal static int ManagedSizeOf(Type type)
|
||||
{
|
||||
return Marshal.SizeOf(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user