本文整理汇总了C#中TypeWrapper.GetBaseSerializationConstructor方法的典型用法代码示例。如果您正苦于以下问题:C# TypeWrapper.GetBaseSerializationConstructor方法的具体用法?C# TypeWrapper.GetBaseSerializationConstructor怎么用?C# TypeWrapper.GetBaseSerializationConstructor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeWrapper
的用法示例。
在下文中一共展示了TypeWrapper.GetBaseSerializationConstructor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}