Cleanup '#if CORE' in Native.cs (#4404)
This commit is contained in:
parent
af24581ddd
commit
38c5bc70e0
|
@ -179,73 +179,6 @@ namespace System.Management.Automation.SecurityAccountsManager.Native
|
|||
#pragma warning restore 0649, 0169
|
||||
#endregion Structures
|
||||
|
||||
/// <summary>
|
||||
/// Wraps calls to Marshal functions that differ between .Net 4.5 and CoreCLR. .Net 4.5.1 types are not allowed for PowerShell.
|
||||
/// </summary>
|
||||
internal class ClrFacade
|
||||
{
|
||||
/// <summary>
|
||||
/// Private constructor to prevent auto-generation of a default constructor
|
||||
/// </summary>
|
||||
private ClrFacade()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Facade for Marshal.SizeOf
|
||||
/// </summary>
|
||||
internal static int SizeOf<T>()
|
||||
{
|
||||
#if CORECLR
|
||||
// Marshal.SizeOf(Type) is obsolete in CoreCLR
|
||||
return Marshal.SizeOf<T>();
|
||||
#else
|
||||
return Marshal.SizeOf(typeof(T));
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Facade for Marshal.DestroyStructure
|
||||
/// </summary>
|
||||
internal static void DestroyStructure<T>(IntPtr ptr)
|
||||
{
|
||||
#if CORECLR
|
||||
// Marshal.DestroyStructure(IntPtr, Type) is obsolete in CoreCLR
|
||||
Marshal.DestroyStructure<T>(ptr);
|
||||
#else
|
||||
Marshal.DestroyStructure(ptr, typeof(T));
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Facade for Marshal.PtrToStructure
|
||||
/// </summary>
|
||||
internal static T PtrToStructure<T>(IntPtr ptr)
|
||||
{
|
||||
#if CORECLR
|
||||
// Marshal.PtrToStructure(IntPtr, Type) is obsolete in CoreCLR
|
||||
return Marshal.PtrToStructure<T>(ptr);
|
||||
#else
|
||||
return (T)Marshal.PtrToStructure(ptr, typeof(T));
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps Marshal.StructureToPtr to hide differences between the CLRs.
|
||||
/// </summary>
|
||||
internal static void StructureToPtr<T>(
|
||||
T structure,
|
||||
IntPtr ptr,
|
||||
bool deleteOld)
|
||||
{
|
||||
#if CORECLR
|
||||
Marshal.StructureToPtr<T>( structure, ptr, deleteOld );
|
||||
#else
|
||||
Marshal.StructureToPtr(structure, ptr, deleteOld);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
internal static class Win32
|
||||
{
|
||||
#region Constants
|
||||
|
|
Loading…
Reference in a new issue