本文整理汇总了C#中GCHandleType类的典型用法代码示例。如果您正苦于以下问题:C# GCHandleType类的具体用法?C# GCHandleType怎么用?C# GCHandleType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GCHandleType类属于命名空间,在下文中一共展示了GCHandleType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ScopedGCHandle
/// <summary>
/// 指定したオブジェクトに指定した型のハンドルを割り当てます
/// </summary>
/// <param name="value">GCの対象からはずすオブジェクト</param>
/// <param name="type">作成する System.Runtime.InteropServices.GCHandle の型を示す、System.Runtime.InteropServices.GCHandleType 値の 1 つ</param>
#else
/// <summary>
///
/// </summary>
/// <param name="value"></param>
/// <param name="type"></param>
#endif
public ScopedGCHandle(object value, GCHandleType type)
{
if (value != null)
{
this.Handle = GCHandle.Alloc(value, type);
}
}
开发者ID:sanglin307,项目名称:UnityOpenCV,代码行数:19,代码来源:ScopedGCHandle.cs
示例2: RhHandleAlloc
internal static IntPtr RhHandleAlloc(Object value, GCHandleType type)
{
IntPtr h = RhpHandleAlloc(value, type);
if (h == IntPtr.Zero)
throw new OutOfMemoryException();
return h;
}
开发者ID:krytarowski,项目名称:corert,代码行数:7,代码来源:RuntimeImports.cs
示例3: GCHandle
internal GCHandle(object value, GCHandleType type)
{
// MS does not crash/throw on (most) invalid GCHandleType values (except -1)
if ((type < GCHandleType.Weak) || (type > GCHandleType.Pinned))
type = GCHandleType.Normal;
handle = GetTargetHandle (value, 0, type);
}
开发者ID:Profit0004,项目名称:mono,代码行数:7,代码来源:GCHandle.cs
示例4: UnsafeGCHandle
// Allocate a handle storing the object and the type.
private UnsafeGCHandle(Object value, GCHandleType type)
{
Debug.Assert((uint)type <= (uint)GCHandleType.Normal, "unexpected handle type");
_handle = InternalCalls.RhpHandleAlloc(value, type);
if (_handle == IntPtr.Zero)
throw new OutOfMemoryException();
}
开发者ID:tijoytom,项目名称:corert,代码行数:9,代码来源:UnsafeGCHandle.cs
示例5: GCHandle
// Allocate a handle storing the object and the type.
internal GCHandle(Object value, GCHandleType type)
{
m_handle = InternalAlloc(value, type);
// Record if the handle is pinned.
if (type == GCHandleType.Pinned)
SetIsPinned();
}
开发者ID:ArildF,项目名称:masters,代码行数:9,代码来源:gchandle.cs
示例6: ScopedGCHandle
/// <summary>
/// 指定したオブジェクトに指定した型のハンドルを割り当てます
/// </summary>
/// <param name="value">GCの対象からはずすオブジェクト</param>
/// <param name="type">作成する System.Runtime.InteropServices.GCHandle の型を示す、System.Runtime.InteropServices.GCHandleType 値の 1 つ</param>
#else
/// <summary>
///
/// </summary>
/// <param name="value"></param>
/// <param name="type"></param>
#endif
public ScopedGCHandle(object value, GCHandleType type)
{
if (value != null)
{
handle = GCHandle.Alloc(value, type);
}
disposed = false;
}
开发者ID:neoxeo,项目名称:opencvsharp,代码行数:20,代码来源:ScopedGCHandle.cs
示例7: GCHandle
internal GCHandle(object value, GCHandleType type)
{
if (type > GCHandleType.Pinned)
{
throw new ArgumentOutOfRangeException("type", Environment.GetResourceString("ArgumentOutOfRange_Enum"));
}
this.m_handle = InternalAlloc(value, type);
if (type == GCHandleType.Pinned)
{
this.SetIsPinned();
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:GCHandle.cs
示例8: SafeGCHandle
/// <summary>
/// Initializes a new instance of the <see cref="SafeGCHandle"/> class referring to the target in the given way.
/// </summary>
/// <param name="target">The object to reference.</param>
/// <param name="type">The way to reference the object.</param>
public SafeGCHandle(object target, GCHandleType type)
: base(IntPtr.Zero, true)
{
RuntimeHelpers.PrepareConstrainedRegions();
try
{
// The StyleCop warning for this try block is incorrect; it is required to create a Constrained Execution Region
}
finally
{
this.SetHandle(GCHandle.ToIntPtr(GCHandle.Alloc(target, type)));
}
}
开发者ID:krikelin,项目名称:torshify-client,代码行数:18,代码来源:SafeGCHandle.cs
示例9: GCHandle
[System.Security.SecurityCritical] // auto-generated
internal GCHandle(Object value, GCHandleType type)
{
// Make sure the type parameter is within the valid range for the enum.
if ((uint)type > (uint)MaxHandleType)
throw new ArgumentOutOfRangeException("type", Environment.GetResourceString("ArgumentOutOfRange_Enum"));
Contract.EndContractBlock();
m_handle = InternalAlloc(value, type);
// Record if the handle is pinned.
if (type == GCHandleType.Pinned)
SetIsPinned();
}
开发者ID:uQr,项目名称:referencesource,代码行数:14,代码来源:gchandle.cs
示例10: GCHandle
// Allocate a handle storing the object and the type.
internal GCHandle(Object value, GCHandleType type)
{
// Make sure the type parameter is within the valid range for the enum.
if ((uint)type > (uint)MaxHandleType)
{
throw new ArgumentOutOfRangeException(); // "type", SR.ArgumentOutOfRange_Enum;
}
if (type == GCHandleType.Pinned)
GCHandleValidatePinnedObject(value);
_handle = RuntimeImports.RhHandleAlloc(value, type);
// Record if the handle is pinned.
if (type == GCHandleType.Pinned)
SetIsPinned();
}
开发者ID:mjp41,项目名称:corert,代码行数:18,代码来源:GCHandle.cs
示例11: RhHandleAlloc
public static IntPtr RhHandleAlloc(object value, GCHandleType type)
{
IntPtr h = InternalCalls.RhpHandleAlloc(value, type);
if (h == IntPtr.Zero)
{
// Throw the out of memory exception defined by the classlib, using the return address of this method
// to find the correct classlib.
ExceptionIDs exID = ExceptionIDs.OutOfMemory;
IntPtr returnAddr = BinderIntrinsics.GetReturnAddress();
Exception e = EH.GetClasslibException(exID, returnAddr);
throw e;
}
return h;
}
开发者ID:huamichaelchen,项目名称:corert,代码行数:18,代码来源:RuntimeExports.cs
示例12: Alloc
public static GCHandle Alloc (object value, GCHandleType type) {
throw new NotImplementedException();
}
开发者ID:GlennSandoval,项目名称:JSIL,代码行数:3,代码来源:Unsafe.cs
示例13: AutoFreeGCHandle
public AutoFreeGCHandle(object targetObject, GCHandleType type = GCHandleType.Pinned)
{
_handle = GCHandle.Alloc(targetObject, type);
}
开发者ID:higankanshi,项目名称:xZune.Bass,代码行数:4,代码来源:AutoFreeGCHandle.cs
示例14: GetGCHandle
internal IntPtr GetGCHandle(GCHandleType type)
{
return RuntimeTypeHandle.GetGCHandle(this.GetNativeHandle(), type);
}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:4,代码来源:RuntimeTypeHandle.cs
示例15: Alloc
[System.Security.SecurityCritical] // auto-generated_required
public static GCHandle Alloc(Object value, GCHandleType type)
{
return new GCHandle(value, type);
}
开发者ID:uQr,项目名称:referencesource,代码行数:5,代码来源:gchandle.cs
示例16: RhHandleAlloc
internal static extern IntPtr RhHandleAlloc(Object value, GCHandleType type);
开发者ID:TerabyteX,项目名称:corert,代码行数:1,代码来源:RuntimeImports.cs
示例17: Alloc
/// <include file='../../_Doc/mscorlib.xml' path='doc/members/member[@name="M:System.Runtime.InteropServices.GCHandle.Alloc(System.Object,System.Runtime.InteropServices.GCHandleType)"]/*' />
public static GCHandle Alloc(object value, GCHandleType type)
{
throw new PlatformNotSupportedException("PCL");
}
开发者ID:BeeINSIGHT,项目名称:shim,代码行数:5,代码来源:GCHandle.cs
示例18: Alloc
public static GCHandle Alloc(Object obj, GCHandleType type)
{
return new GCHandle(obj, type);
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:4,代码来源:GCHandle.cs
示例19: GetGCHandle
private extern static IntPtr GetGCHandle(RuntimeTypeHandle handle, GCHandleType type);
开发者ID:jashook,项目名称:coreclr,代码行数:1,代码来源:RuntimeHandles.cs
示例20: GetTargetHandle
private extern static int GetTargetHandle(object obj, int handle, GCHandleType type);
开发者ID:Profit0004,项目名称:mono,代码行数:1,代码来源:GCHandle.cs
注:本文中的GCHandleType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论