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


C# IInformationObject.GetType方法代码示例

本文整理汇总了C#中IInformationObject.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IInformationObject.GetType方法的具体用法?C# IInformationObject.GetType怎么用?C# IInformationObject.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IInformationObject的用法示例。


在下文中一共展示了IInformationObject.GetType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SerializeInformationObjectToBuffer

 private static byte[] SerializeInformationObjectToBuffer(IInformationObject informationObject)
 {
     Type informationObjectType = informationObject.GetType();
     using (MemoryStream memoryStream = new MemoryStream())
     {
         byte[] dataContent = null;
         StorageSerializationType storageSerializationType = getStorageSerializationType(informationObjectType);
         if (storageSerializationType == StorageSerializationType.XML)
         {
             DataContractSerializer ser = new DataContractSerializer(informationObjectType);
             using (
                 XmlTextWriter writer = new XmlTextWriter(memoryStream, Encoding.UTF8)
                     {
                         Formatting = Formatting.Indented
                     })
             {
                 ser.WriteObject(writer, informationObject);
                 writer.Flush();
                 dataContent = memoryStream.ToArray();
             }
         }
         else if (storageSerializationType == StorageSerializationType.JSON)
         {
             DataContractJsonSerializer serializer = new DataContractJsonSerializer(informationObjectType);
             serializer.WriteObject(memoryStream, informationObject);
             dataContent = memoryStream.ToArray();
         } else if (storageSerializationType == StorageSerializationType.Binary)
         {
             BinaryFormatter binaryFormatter = new BinaryFormatter();
             binaryFormatter.Serialize(memoryStream, informationObject);
             dataContent = memoryStream.ToArray();
         } else // if (storageSerializationType == StorageSerializationType.Custom)
         {
             throw new NotSupportedException("Custom or unspecified formatting not supported");
         }
         return dataContent;
     }
 }
开发者ID:kallex,项目名称:Caloom,代码行数:38,代码来源:StorageSupport.cs

示例2: ArgumentNullException

 void IInformationObject.UpdateMasterValueTreeFromOtherInstance(IInformationObject sourceMaster)
 {
     if (sourceMaster == null)
                 throw new ArgumentNullException("sourceMaster");
             if (GetType() != sourceMaster.GetType())
                 throw new InvalidDataException("Type mismatch in UpdateMasterValueTree");
             IInformationObject iObject = this;
             if(iObject.IsIndependentMaster == false)
                 throw new InvalidDataException("UpdateMasterValueTree called on non-master type");
             if(ID != sourceMaster.ID)
                 throw new InvalidDataException("UpdateMasterValueTree is supported only on masters with same ID");
             CopyContentFrom((NetworkUsageCollection) sourceMaster);
 }
开发者ID:abstractiondev,项目名称:TheBallOnAzure,代码行数:13,代码来源:TheBallCore.designer.cs

示例3: GetDefaultStaticTemplateName

 public static string GetDefaultStaticTemplateName(IInformationObject informationObject)
 {
     string templateName = informationObject.GetType().FullName + "_DefaultView.phtml";
     return templateName;
 }
开发者ID:kallex,项目名称:Caloom,代码行数:5,代码来源:DefaultViewSupport.cs

示例4: GetDefaultStaticViewName

 public static string GetDefaultStaticViewName(IInformationObject informationObject)
 {
     string viewName = informationObject.GetType().FullName + "_" + informationObject.ID + "_DefaultView.phtml";
     return viewName;
 }
开发者ID:kallex,项目名称:Caloom,代码行数:5,代码来源:DefaultViewSupport.cs

示例5: GetDefaultDynamicRenderingViewURL

 private static string GetDefaultDynamicRenderingViewURL(IInformationObject informationObject)
 {
     string viewName = informationObject.GetType().FullName + "_DefaultView.phtml";
     string viewItemLocation = informationObject.RelativeLocation;
     string viewItemURL = RenderWebSupport.GetUrlFromRelativeLocation(viewItemLocation);
     return viewName + "?viewItem=" + HttpUtility.UrlEncode(viewItemURL);
 }
开发者ID:kallex,项目名称:Caloom,代码行数:7,代码来源:DefaultViewSupport.cs

示例6: SetReferenceSubscriptionToMaster

 public static void SetReferenceSubscriptionToMaster(IInformationObject containerObject, IInformationObject referenceInstance, IInformationObject masterInstance)
 {
     AddSubscriptionToObject(masterInstance.RelativeLocation, containerObject.RelativeLocation, SubscribeType_MasterToReferenceUpdate, targetTypeName:masterInstance.GetType().FullName,
         subscriberTypeName:containerObject.GetType().FullName);
 }
开发者ID:kallex,项目名称:Caloom,代码行数:5,代码来源:SubscribeSupport.cs

示例7: SetCollectionSubscriptionToMaster

 public static void SetCollectionSubscriptionToMaster(IInformationObject containerObject, string masterCollectionLocation, Type collectionType)
 {
     AddSubscriptionToObject(masterCollectionLocation, containerObject.RelativeLocation, SubscribeType_MasterCollectionToContainerUpdate, collectionType.FullName,
         containerObject.GetType().FullName);
 }
开发者ID:kallex,项目名称:Caloom,代码行数:5,代码来源:SubscribeSupport.cs

示例8: SemanticInformationItem

 public SemanticInformationItem(IInformationObject informationObject)
 {
     ItemFullType = informationObject.GetType().FullName;
     ItemValue = informationObject.RelativeLocation;
 }
开发者ID:kallex,项目名称:Caloom,代码行数:5,代码来源:SemanticInformationItem.cs

示例9: InitializeChainAndReturnPropertyOwningObject

 public static void InitializeChainAndReturnPropertyOwningObject(IInformationObject createdObject, string objectProp, out object actualContainingObject, out string fieldPropertyName)
 {
     actualContainingObject = null;
     fieldPropertyName = null;
     if (objectProp.Contains("___") == false)
         return;
     string[] objectChain = objectProp.Split(new[] { "___" }, StringSplitOptions.None);
     fieldPropertyName = objectChain[objectChain.Length - 1];
     Stack<string> objectChainStack = new Stack<string>(objectChain.Reverse().Skip(1));
     actualContainingObject = createdObject;
     while (objectChainStack.Count > 0)
     {
         Type currType = actualContainingObject.GetType();
         string currObjectProp = objectChainStack.Pop();
         PropertyInfo prop = currType.GetProperty(currObjectProp);
         if (prop == null)
             throw new InvalidDataException("Property not found by name: " + currObjectProp);
         var currPropValue = prop.GetValue(actualContainingObject, null);
         if (currPropValue == null)
         {
             var currPropType = prop.PropertyType;
             currPropValue = Activator.CreateInstance(currPropType);
             prop.SetValue(actualContainingObject, currPropValue, null);
         }
         actualContainingObject = currPropValue;
     }
 }
开发者ID:kallex,项目名称:Caloom,代码行数:27,代码来源:ModifyInformationSupport.cs


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