We may wish to treat a collectible assembly or member info differently to a non-collectible. Most obviously, we might want to avoid caching a collectible type or method for a long time and preventing that possible collection. (Type has an IsCollectible method, but it is not exposed.)
Proposed API:
namespace System.Reflection
{
public abstract class Assembly
{
public virtual bool IsCollectible { get; }
}
public abstract class MemberInfo
{
public virtual bool IsCollectible { get; }
}
}
Note that collectibility of assemblies is not the only factor on collectibility of member infos. TypeBuilder is derived from Type and instances are always collectible.
TypeDelegator is itself collectible, but it should report on its delegatee.
Editted to include all of MemberInfo and also Assembly.
We may wish to treat a collectible assembly or member info differently to a non-collectible. Most obviously, we might want to avoid caching a collectible type or method for a long time and preventing that possible collection. (
Typehas anIsCollectiblemethod, but it is not exposed.)Proposed API:
Note that collectibility of assemblies is not the only factor on collectibility of member infos.
TypeBuilderis derived fromTypeand instances are always collectible.TypeDelegatoris itself collectible, but it should report on its delegatee.Editted to include all of
MemberInfoand alsoAssembly.