本文整理汇总了C#中TypeWrapper.IsSubTypeOf方法的典型用法代码示例。如果您正苦于以下问题:C# TypeWrapper.IsSubTypeOf方法的具体用法?C# TypeWrapper.IsSubTypeOf怎么用?C# TypeWrapper.IsSubTypeOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeWrapper
的用法示例。
在下文中一共展示了TypeWrapper.IsSubTypeOf方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsSafeForAutomagicSerialization
private static bool IsSafeForAutomagicSerialization(TypeWrapper wrapper)
{
if (wrapper.TypeAsBaseType.IsSerializable)
{
return false;
}
if (wrapper.IsSubTypeOf(iserializable))
{
return false;
}
if (wrapper.IsSubTypeOf(iobjectreference))
{
return false;
}
if (wrapper.GetMethodWrapper("GetObjectData", "(Lcli.System.Runtime.Serialization.SerializationInfo;Lcli.System.Runtime.Serialization.StreamingContext;)V", false) != null)
{
return false;
}
if (wrapper.GetMethodWrapper("<init>", "(Lcli.System.Runtime.Serialization.SerializationInfo;Lcli.System.Runtime.Serialization.StreamingContext;)V", false) != null)
{
return false;
}
return true;
}
示例2: IsPublicOrProtectedMemberAccessible
private bool IsPublicOrProtectedMemberAccessible(TypeWrapper caller, TypeWrapper instance)
{
if (IsPublic || (IsProtected && caller.IsSubTypeOf(DeclaringType) && (IsStatic || instance.IsSubTypeOf(caller))))
{
return DeclaringType.IsPublic || InPracticeInternalsVisibleTo(caller);
}
return false;
}
示例3: IsMapUnsafeException
internal bool IsMapUnsafeException(TypeWrapper tw)
{
if(mappedExceptions != null)
{
for(int i = 0; i < mappedExceptions.Length; i++)
{
if(mappedExceptions[i].IsSubTypeOf(tw) ||
(mappedExceptionsAllSubClasses[i] && tw.IsSubTypeOf(mappedExceptions[i])))
{
return true;
}
}
}
return false;
}
示例4: Link
internal override void Link(TypeWrapper thisType)
{
base.Link(thisType);
TypeWrapper wrapper = GetClassType();
if(wrapper != null && !wrapper.IsUnloadable)
{
method = wrapper.GetMethodWrapper(Name, Signature, !ReferenceEquals(Name, StringConstants.INIT));
if(method != null)
{
method.Link();
}
if(Name != StringConstants.INIT &&
(thisType.Modifiers & (Modifiers.Interface | Modifiers.Super)) == Modifiers.Super &&
thisType != wrapper && thisType.IsSubTypeOf(wrapper))
{
invokespecialMethod = thisType.BaseTypeWrapper.GetMethodWrapper(Name, Signature, true);
if(invokespecialMethod != null)
{
invokespecialMethod.Link();
}
}
}
}
示例5: AddAutomagicSerialization
internal static ConstructorInfo AddAutomagicSerialization(TypeWrapper wrapper)
{
ConstructorInfo serializationCtor = null;
if (wrapper.GetClassLoader().NoAutomagicSerialization)
{
// do nothing
}
else if ((wrapper.Modifiers & IKVM.Attributes.Modifiers.Enum) != 0)
{
MarkSerializable(wrapper);
}
else if (wrapper.IsSubTypeOf(serializable) && IsSafeForAutomagicSerialization(wrapper))
{
if (wrapper.IsSubTypeOf(externalizable))
{
MethodWrapper ctor = wrapper.GetMethodWrapper("<init>", "()V", false);
if (ctor != null && ctor.IsPublic)
{
MarkSerializable(wrapper);
ctor.Link();
serializationCtor = AddConstructor(wrapper.TypeAsBuilder, ctor, null, true);
if (!wrapper.BaseTypeWrapper.IsSubTypeOf(serializable))
{
AddGetObjectData(wrapper);
}
if (wrapper.BaseTypeWrapper.GetMethodWrapper("readResolve", "()Ljava.lang.Object;", true) != null)
{
RemoveReadResolve(wrapper);
}
}
}
else if (wrapper.BaseTypeWrapper.IsSubTypeOf(serializable))
{
ConstructorInfo baseCtor = wrapper.GetBaseSerializationConstructor();
if (baseCtor != null && (baseCtor.IsFamily || baseCtor.IsFamilyOrAssembly))
{
MarkSerializable(wrapper);
serializationCtor = AddConstructor(wrapper.TypeAsBuilder, null, baseCtor, false);
AddReadResolve(wrapper);
}
}
else
{
MethodWrapper baseCtor = wrapper.BaseTypeWrapper.GetMethodWrapper("<init>", "()V", false);
if (baseCtor != null && baseCtor.IsAccessibleFrom(wrapper.BaseTypeWrapper, wrapper, wrapper))
{
MarkSerializable(wrapper);
AddGetObjectData(wrapper);
#if STATIC_COMPILER
// because the base type can be a __WorkaroundBaseClass__, we may need to replace the constructor
baseCtor = ((AotTypeWrapper)wrapper).ReplaceMethodWrapper(baseCtor);
#endif
baseCtor.Link();
serializationCtor = AddConstructor(wrapper.TypeAsBuilder, baseCtor, null, true);
AddReadResolve(wrapper);
}
}
}
return serializationCtor;
}
示例6: AddReadResolve
private static void AddReadResolve(TypeWrapper wrapper)
{
MethodWrapper mw = wrapper.GetMethodWrapper("readResolve", "()Ljava.lang.Object;", false);
if (mw != null && !wrapper.IsSubTypeOf(iobjectreference))
{
TypeBuilder tb = wrapper.TypeAsBuilder;
tb.AddInterfaceImplementation(JVM.Import(typeof(IObjectReference)));
MethodBuilder getRealObject = tb.DefineMethod("IObjectReference.GetRealObject", MethodAttributes.Private | MethodAttributes.Virtual | MethodAttributes.NewSlot | MethodAttributes.Final,
Types.Object, new Type[] { JVM.Import(typeof(StreamingContext)) });
getRealObject.SetCustomAttribute(securityCriticalAttribute);
AttributeHelper.HideFromJava(getRealObject);
tb.DefineMethodOverride(getRealObject, JVM.Import(typeof(IObjectReference)).GetMethod("GetRealObject"));
CodeEmitter ilgen = CodeEmitter.Create(getRealObject);
mw.Link();
ilgen.Emit(OpCodes.Ldarg_0);
mw.EmitCall(ilgen);
ilgen.Emit(OpCodes.Ret);
}
}
示例7: IsAccessibleFrom
internal bool IsAccessibleFrom(TypeWrapper referencedType, TypeWrapper caller, TypeWrapper instance)
{
if(referencedType.IsAccessibleFrom(caller))
{
return (IsPublic ||
caller == DeclaringType ||
(IsProtected && caller.IsSubTypeOf(DeclaringType) && (IsStatic || instance.IsSubTypeOf(caller))) ||
(IsInternal && DeclaringType.InternalsVisibleTo(caller)) ||
(!IsPrivate && DeclaringType.IsPackageAccessibleFrom(caller)))
// The JVM supports accessing members that have non-public types in their signature from another package,
// but the CLI doesn't. It would be nice if we worked around that by emitting extra accessors, but for now
// we'll simply disallow such access across assemblies (unless the appropriate InternalsVisibleToAttribute exists).
&& ((flags & MemberFlags.NonPublicTypeInSignature) == 0 || InPracticeInternalsVisibleTo(caller));
}
return false;
}