本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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();
}
}