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


C# PropertyDescriptor.GetType方法代码示例

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


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

示例1: SerializeProperty

		protected void SerializeProperty (IDesignerSerializationManager manager, CodeStatementCollection statements, 
						  object value, PropertyDescriptor propertyToSerialize)
		{
			if (propertyToSerialize == null)
				throw new ArgumentNullException ("propertyToSerialize");
			if (value == null)
				throw new ArgumentNullException ("value");
			if (statements == null)
				throw new ArgumentNullException ("statements");
			if (manager == null)
				throw new ArgumentNullException ("manager");

			MemberCodeDomSerializer serializer = manager.GetSerializer (propertyToSerialize.GetType (), 
										    typeof (MemberCodeDomSerializer)) as MemberCodeDomSerializer;
			if (serializer != null && serializer.ShouldSerialize (manager, value, propertyToSerialize))
				serializer.Serialize (manager, value, propertyToSerialize, statements);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:17,代码来源:CodeDomSerializerBase.cs

示例2: IsXLinqCollectionPropertyImpl

        static bool IsXLinqCollectionPropertyImpl(PropertyDescriptor pd)
        { 
            if (s_XElementElementsPropertyDescriptorType == null)
            { 
                // lazy load the types for the two offending PD's.  They're internal, so 
                // we get them indirectly.
                XElement xelement = new XElement("Dummy"); 
                PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties(xelement);
                s_XElementElementsPropertyDescriptorType = pdc["Elements"].GetType();
                s_XElementDescendantsPropertyDescriptorType = pdc["Descendants"].GetType();
            } 

            Type pdType = pd.GetType(); 
            return (pdType == s_XElementElementsPropertyDescriptorType) || 
                (pdType == s_XElementDescendantsPropertyDescriptorType);
        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:16,代码来源:AssemblyHelper.cs

示例3: IsDataSetCollectionPropertyImpl

        static bool IsDataSetCollectionPropertyImpl(PropertyDescriptor pd)
        {
            if (s_DataTablePropertyDescriptorType == null) 
            {
                // lazy load the types for the offending PD's.  They're internal, so 
                // we get them indirectly. 
                DataSet dataset = new DataSet();
                dataset.Locale = System.Globalization.CultureInfo.InvariantCulture; 

                DataTable table1 = new DataTable("Table1");
                table1.Locale = System.Globalization.CultureInfo.InvariantCulture;
                table1.Columns.Add("ID", typeof(int)); 
                dataset.Tables.Add(table1);
 
                DataTable table2 = new DataTable("Table2"); 
                table2.Locale = System.Globalization.CultureInfo.InvariantCulture;
                table2.Columns.Add("ID", typeof(int)); 
                dataset.Tables.Add(table2);

                dataset.Relations.Add(new DataRelation("IDRelation",
                                                    table1.Columns["ID"], 
                                                    table2.Columns["ID"]));
 
                System.Collections.IList list = ((IListSource)dataset).GetList(); 
                PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties(list[0]);
                s_DataTablePropertyDescriptorType = pdc["Table1"].GetType(); 

                pdc = ((ITypedList)table1.DefaultView).GetItemProperties(null);
                s_DataRelationPropertyDescriptorType = pdc["IDRelation"].GetType();
            } 

            Type pdType = pd.GetType(); 
            return (pdType == s_DataTablePropertyDescriptorType) || 
                (pdType == s_DataRelationPropertyDescriptorType);
        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:35,代码来源:AssemblyHelper.cs

示例4: SerializeProperty

 protected void SerializeProperty(IDesignerSerializationManager manager, CodeStatementCollection statements, object value, PropertyDescriptor propertyToSerialize)
 {
     if (manager == null)
     {
         throw new ArgumentNullException("manager");
     }
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     if (propertyToSerialize == null)
     {
         throw new ArgumentNullException("propertyToSerialize");
     }
     if (statements == null)
     {
         throw new ArgumentNullException("statements");
     }
     manager.Context.Push(statements);
     manager.Context.Push(propertyToSerialize);
     try
     {
         MemberCodeDomSerializer serializer = (MemberCodeDomSerializer) manager.GetSerializer(propertyToSerialize.GetType(), typeof(MemberCodeDomSerializer));
         if ((serializer != null) && serializer.ShouldSerialize(manager, value, propertyToSerialize))
         {
             serializer.Serialize(manager, value, propertyToSerialize, statements);
         }
     }
     finally
     {
         manager.Context.Pop();
         manager.Context.Pop();
     }
 }
开发者ID:Reegenerator,项目名称:Sample-CustomizeDatasetCS,代码行数:34,代码来源:CodeDomSerializerBase.cs


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