protected override bool IsCOMObjectImpl() => typeImpl.IsCOMObject;
public override bool IsByRefLike => typeImpl.IsByRefLike;
public override bool IsConstructedGenericType => typeImpl.IsConstructedGenericType;
+
+ public override bool IsCollectible => typeImpl.IsCollectible;
+
public override Type GetElementType() => typeImpl.GetElementType();
protected override bool HasElementTypeImpl() => typeImpl.HasElementType;
public bool IsContextful => IsContextfulImpl();
protected virtual bool IsContextfulImpl() => false;
+ public virtual bool IsCollectible => true;
+
public virtual bool IsEnum => IsSubclassOf(typeof(Enum));
public bool IsMarshalByRef => IsMarshalByRefImpl();
protected virtual bool IsMarshalByRefImpl() => false;
IntPtr gcHandle = Interlocked.CompareExchange(ref m_cache, newgcHandle, IntPtr.Zero);
// Leak the handle if the type is collectible. It will be reclaimed when
// the type goes away.
- if (gcHandle != IntPtr.Zero && !IsCollectible())
+ if (gcHandle != IntPtr.Zero && !IsCollectible)
GCHandle.InternalFree(newgcHandle);
}
return new RuntimeTypeHandle(this);
}
- internal bool IsCollectible()
- {
- return RuntimeTypeHandle.IsCollectible(GetTypeHandleInternal());
- }
+ public sealed override bool IsCollectible => RuntimeTypeHandle.IsCollectible(GetTypeHandleInternal());
protected override TypeCode GetTypeCodeImpl()
{