本文整理汇总了C#中ClassDataContract.GetNonAttributedTypeConstructor方法的典型用法代码示例。如果您正苦于以下问题:C# ClassDataContract.GetNonAttributedTypeConstructor方法的具体用法?C# ClassDataContract.GetNonAttributedTypeConstructor怎么用?C# ClassDataContract.GetNonAttributedTypeConstructor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClassDataContract
的用法示例。
在下文中一共展示了ClassDataContract.GetNonAttributedTypeConstructor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateObject
private void CreateObject(ClassDataContract classContract)
{
Type typeOfValueType = this.objectType = classContract.UnderlyingType;
if (typeOfValueType.IsValueType && !classContract.IsNonAttributedType)
{
typeOfValueType = Globals.TypeOfValueType;
}
this.objectLocal = this.ilg.DeclareLocal(typeOfValueType, "objectDeserialized");
if (classContract.UnderlyingType == Globals.TypeOfDBNull)
{
this.ilg.LoadMember(Globals.TypeOfDBNull.GetField("Value"));
this.ilg.Stloc(this.objectLocal);
}
else if (classContract.IsNonAttributedType)
{
if (typeOfValueType.IsValueType)
{
this.ilg.Ldloca(this.objectLocal);
this.ilg.InitObj(typeOfValueType);
}
else
{
this.ilg.New(classContract.GetNonAttributedTypeConstructor());
this.ilg.Stloc(this.objectLocal);
}
}
else
{
this.ilg.Call(null, XmlFormatGeneratorStatics.GetUninitializedObjectMethod, DataContract.GetIdForInitialization(classContract));
this.ilg.ConvertValue(Globals.TypeOfObject, typeOfValueType);
this.ilg.Stloc(this.objectLocal);
}
}
示例2: CreateObject
private void CreateObject(ClassDataContract classContract)
{
_objectType = classContract.UnderlyingType;
Type type = classContract.ObjectType;
_objectLocal = _ilg.DeclareLocal(type, "objectDeserialized");
if (classContract.UnderlyingType == Globals.TypeOfDBNull)
{
_ilg.LoadMember(Globals.TypeOfDBNull.GetField("Value"));
_ilg.Stloc(_objectLocal);
}
else if (classContract.IsNonAttributedType)
{
if (type.GetTypeInfo().IsValueType)
{
_ilg.Ldloca(_objectLocal);
_ilg.InitObj(type);
}
else
{
_ilg.New(classContract.GetNonAttributedTypeConstructor());
_ilg.Stloc(_objectLocal);
}
}
else
{
_ilg.Call(null, JsonFormatGeneratorStatics.GetUninitializedObjectMethod, classContract.TypeForInitialization);
_ilg.ConvertValue(Globals.TypeOfObject, type);
_ilg.Stloc(_objectLocal);
}
}
示例3: CreateObject
void CreateObject (ClassDataContract classContract)
{
Type type = objectType = classContract.UnderlyingType;
if (type.IsValueType && !classContract.IsNonAttributedType)
type = Globals.TypeOfValueType;
if (classContract.UnderlyingType == Globals.TypeOfDBNull)
objectLocal = DBNull.Value;
else if (classContract.IsNonAttributedType) {
if (type.IsValueType)
objectLocal = FormatterServices.GetUninitializedObject (type);
else
objectLocal = classContract.GetNonAttributedTypeConstructor ().Invoke (new object [0]);
}
else
objectLocal = CodeInterpreter.ConvertValue (XmlFormatReaderGenerator.UnsafeGetUninitializedObject (DataContract.GetIdForInitialization (classContract)), Globals.TypeOfObject, type);
}