当前位置: 首页>>代码示例>>C#>>正文


C# ClassDataContract.GetNonAttributedTypeConstructor方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:XmlFormatReaderGenerator.cs

示例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);
                }
            }
开发者ID:dotnet,项目名称:corefx,代码行数:32,代码来源:JsonFormatReaderGenerator.cs

示例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);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:17,代码来源:XmlFormatReaderGenerator_static.cs


注:本文中的ClassDataContract.GetNonAttributedTypeConstructor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。