TypeDescriptor.GetProperties Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Bir bileşen veya türdeki özellik koleksiyonunu döndürür.
Aşırı Yüklemeler
| Name | Description |
|---|---|
| GetProperties(Object) |
Belirtilen bileşen için özellik koleksiyonunu döndürür. |
| GetProperties(Type) |
Belirtilen bileşen türü için özellik koleksiyonunu döndürür. |
| GetProperties(Object, Attribute[]) |
Belirtilen öznitelik dizisini filtre olarak kullanarak belirtilen bir bileşen için özellik koleksiyonunu döndürür. |
| GetProperties(Object, Boolean) |
Varsayılan tür tanımlayıcısını kullanarak belirtilen bir bileşenin özellik koleksiyonunu döndürür. |
| GetProperties(Type, Attribute[]) |
Belirtilen öznitelik dizisini filtre olarak kullanarak belirtilen bileşen türü için özellik koleksiyonunu döndürür. |
| GetProperties(Object, Attribute[], Boolean) |
Belirtilen öznitelik dizisini filtre olarak ve özel tür tanımlayıcısı kullanarak belirtilen bir bileşen için özellik koleksiyonunu döndürür. |
GetProperties(Object)
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
Belirtilen bileşen için özellik koleksiyonunu döndürür.
public:
static System::ComponentModel::PropertyDescriptorCollection ^ GetProperties(System::Object ^ component);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered. The Type of component cannot be statically discovered.")]
public static System.ComponentModel.PropertyDescriptorCollection GetProperties(object component);
public static System.ComponentModel.PropertyDescriptorCollection GetProperties(object component);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered. The Type of component cannot be statically discovered.")>]
static member GetProperties : obj -> System.ComponentModel.PropertyDescriptorCollection
static member GetProperties : obj -> System.ComponentModel.PropertyDescriptorCollection
Public Shared Function GetProperties (component As Object) As PropertyDescriptorCollection
Parametreler
- component
- Object
Özelliklerini almak için bir bileşen.
Döndürülenler
Belirtilen bileşenin özelliklerine sahip A PropertyDescriptorCollection .
- Öznitelikler
Özel durumlar
component , işlemler arası uzak bir nesnedir.
Örnekler
Aşağıdaki kod örneği, bir denetimin GetProperties özelliklerine erişmek için yönteminin kullanımını gösterir. Bu kod örneği, sınıfı için ComponentDesigner sağlanan daha büyük bir örneğin parçasıdır.
// This is the shadowed property on the designer.
// This value will be serialized instead of the
// value of the control's property.
public Color BackColor
{
get => (Color)ShadowProperties[nameof(BackColor)];
set
{
if (changeService != null)
{
PropertyDescriptor backColorDesc =
TypeDescriptor.GetProperties(Control)["BackColor"];
changeService.OnComponentChanging(
Control,
backColorDesc);
ShadowProperties[nameof(BackColor)] = value;
changeService.OnComponentChanged(
Control,
backColorDesc,
null,
null);
}
}
}
' This is the shadowed property on the designer.
' This value will be serialized instead of the
' value of the control's property.
Public Property BackColor() As Color
Get
Return CType(ShadowProperties("BackColor"), Color)
End Get
Set(ByVal value As Color)
If (Me.changeService IsNot Nothing) Then
Dim backColorDesc As PropertyDescriptor = TypeDescriptor.GetProperties(Me.Control)("BackColor")
Me.changeService.OnComponentChanging(Me.Control, backColorDesc)
Me.ShadowProperties("BackColor") = value
Me.changeService.OnComponentChanged(Me.Control, backColorDesc, Nothing, Nothing)
End If
End Set
End Property
Açıklamalar
Bir bileşenin özellikleri, bir sınıfın özelliklerinden farklı olabilir, çünkü bileşen siteye eklendiğinde site özellikleri ekleyebilir veya kaldırabilir.
component parametresi ise nullboş bir koleksiyon döndürülür.
Döndürülen koleksiyonun sırasının çağrılar arasında aynı olması garanti edilmediğinden, kullanmadan önce her zaman sıralayın.
Ayrıca bkz.
- PropertyDescriptor
- PropertyDescriptorCollection
- GetProperties
- GetDefaultProperty
- CreateProperty
- GetAttributes
- GetEvents
Şunlara uygulanır
GetProperties(Type)
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
Belirtilen bileşen türü için özellik koleksiyonunu döndürür.
public:
static System::ComponentModel::PropertyDescriptorCollection ^ GetProperties(Type ^ componentType);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered.")]
public static System.ComponentModel.PropertyDescriptorCollection GetProperties(Type componentType);
public static System.ComponentModel.PropertyDescriptorCollection GetProperties(Type componentType);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered.")>]
static member GetProperties : Type -> System.ComponentModel.PropertyDescriptorCollection
static member GetProperties : Type -> System.ComponentModel.PropertyDescriptorCollection
Public Shared Function GetProperties (componentType As Type) As PropertyDescriptorCollection
Parametreler
Döndürülenler
PropertyDescriptorCollection Belirtilen bileşen türünün özelliklerine sahip A.
- Öznitelikler
Açıklamalar
Bu yöntemin bu sürümünü yalnızca nesnesinin bir örneğine sahip olmadığınızda çağırın.
componentType parametresi ise nullboş bir koleksiyon döndürülür.
Döndürülen koleksiyonun sırasının çağrılar arasında aynı olması garanti edilmediğinden, kullanmadan önce her zaman sıralayın.
Ayrıca bkz.
- PropertyDescriptor
- PropertyDescriptorCollection
- GetProperties
- GetDefaultProperty
- CreateProperty
- GetAttributes
- GetEvents
Şunlara uygulanır
GetProperties(Object, Attribute[])
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
Belirtilen öznitelik dizisini filtre olarak kullanarak belirtilen bir bileşen için özellik koleksiyonunu döndürür.
public:
static System::ComponentModel::PropertyDescriptorCollection ^ GetProperties(System::Object ^ component, cli::array <Attribute ^> ^ attributes);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered. The Type of component cannot be statically discovered. The public parameterless constructor or the 'Default' static field may be trimmed from the Attribute's Type.")]
public static System.ComponentModel.PropertyDescriptorCollection GetProperties(object component, Attribute[]? attributes);
public static System.ComponentModel.PropertyDescriptorCollection GetProperties(object component, Attribute[] attributes);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered. The Type of component cannot be statically discovered. The public parameterless constructor or the 'Default' static field may be trimmed from the Attribute's Type.")>]
static member GetProperties : obj * Attribute[] -> System.ComponentModel.PropertyDescriptorCollection
static member GetProperties : obj * Attribute[] -> System.ComponentModel.PropertyDescriptorCollection
Public Shared Function GetProperties (component As Object, attributes As Attribute()) As PropertyDescriptorCollection
Parametreler
- component
- Object
Özelliklerini almak için bir bileşen.
Döndürülenler
PropertyDescriptorCollection Belirtilen bileşen için belirtilen özniteliklerle eşleşen özelliklere sahip A.
- Öznitelikler
Özel durumlar
component , işlemler arası uzak bir nesnedir.
Örnekler
Aşağıdaki kod örneği, yönteminin nasıl uygulanduğunu GetProperties gösterir. Bu kod örneği, sınıfı için PropertyTab sağlanan daha büyük bir örneğin parçasıdır.
// Returns the properties of the specified component extended with
// a CategoryAttribute reflecting the name of the type of the property.
[ReflectionPermission(SecurityAction::Demand, Flags=ReflectionPermissionFlag::MemberAccess)]
virtual System::ComponentModel::PropertyDescriptorCollection^ GetProperties( Object^ component, array<System::Attribute^>^attributes ) override
{
PropertyDescriptorCollection^ props;
if ( attributes == nullptr )
props = TypeDescriptor::GetProperties( component );
else
props = TypeDescriptor::GetProperties( component, attributes );
array<PropertyDescriptor^>^propArray = gcnew array<PropertyDescriptor^>(props->Count);
for ( int i = 0; i < props->Count; i++ )
{
// Create a new PropertyDescriptor from the old one, with
// a CategoryAttribute matching the name of the type.
array<Attribute^>^temp0 = {gcnew CategoryAttribute( props[ i ]->PropertyType->Name )};
propArray[ i ] = TypeDescriptor::CreateProperty( props[ i ]->ComponentType, props[ i ], temp0 );
}
return gcnew PropertyDescriptorCollection( propArray );
}
virtual System::ComponentModel::PropertyDescriptorCollection^ GetProperties( Object^ component ) override
{
return this->GetProperties( component, nullptr );
}
// Returns the properties of the specified component extended with
// a CategoryAttribute reflecting the name of the type of the property.
public override PropertyDescriptorCollection GetProperties(object component, System.Attribute[] attributes)
{
PropertyDescriptorCollection props = attributes == null ? TypeDescriptor.GetProperties(component) : TypeDescriptor.GetProperties(component, attributes);
PropertyDescriptor[] propArray = new PropertyDescriptor[props.Count];
for (int i = 0; i < props.Count; i++)
{
// Create a new PropertyDescriptor from the old one, with
// a CategoryAttribute matching the name of the type.
propArray[i] = TypeDescriptor.CreateProperty(props[i].ComponentType, props[i], new CategoryAttribute(props[i].PropertyType.Name));
}
return new PropertyDescriptorCollection(propArray);
}
public override PropertyDescriptorCollection GetProperties(object component) => GetProperties(component, null);
Açıklamalar
parametrenin component özellikleri bir sınıfın özelliklerinden farklı olabilir, çünkü parametre sitelenmişse component site özellikleri ekleyebilir veya kaldırabilir.
attributes Parametre dizisi, diziyi filtrelemek için kullanılır. Filtreleme aşağıdaki kurallarla tanımlanır:
Bir özelliğin Attribute sınıfı aynı değilse, özellik döndürülen diziye dahil değildir.
özniteliği sınıfın Attribute bir örneğiyse, özelliğin tam eşleşmesi olması gerekir veya döndürülen diziye dahil değildir.
Bir Attribute örnek belirtilirse ve varsayılan özellikse, özelliğinde örneği olmasa bile döndürülen diziye Attribute eklenir.
Varsayılan bir özniteliği varsa
attributes, GetProperties özelliğin özniteliği uygulanmadığında yöntemi büyük/küçük harfle eşleşir.
ise componentnull, boş bir koleksiyon döndürülür.
Döndürülen koleksiyonun sırasının çağrılar arasında aynı olması garanti edilmediğinden, kullanmadan önce her zaman sıralayın.
Ayrıca bkz.
- PropertyDescriptor
- PropertyDescriptorCollection
- GetProperties
- GetDefaultProperty
- CreateProperty
- GetAttributes
- GetEvents
Şunlara uygulanır
GetProperties(Object, Boolean)
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
Varsayılan tür tanımlayıcısını kullanarak belirtilen bir bileşenin özellik koleksiyonunu döndürür.
public:
static System::ComponentModel::PropertyDescriptorCollection ^ GetProperties(System::Object ^ component, bool noCustomTypeDesc);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered. The Type of component cannot be statically discovered.")]
public static System.ComponentModel.PropertyDescriptorCollection GetProperties(object component, bool noCustomTypeDesc);
public static System.ComponentModel.PropertyDescriptorCollection GetProperties(object component, bool noCustomTypeDesc);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered. The Type of component cannot be statically discovered.")>]
static member GetProperties : obj * bool -> System.ComponentModel.PropertyDescriptorCollection
static member GetProperties : obj * bool -> System.ComponentModel.PropertyDescriptorCollection
Public Shared Function GetProperties (component As Object, noCustomTypeDesc As Boolean) As PropertyDescriptorCollection
Parametreler
- component
- Object
Özelliklerini almak için bir bileşen.
- noCustomTypeDesc
- Boolean
true özel tür açıklama bilgilerini dikkate almamak için; aksi takdirde , false.
Döndürülenler
PropertyDescriptorCollection Belirtilen bileşenin özelliklerine sahip A.
- Öznitelikler
Özel durumlar
component , işlemler arası uzak bir nesnedir.
Açıklamalar
parametrenin component özellikleri bir sınıfın özelliklerinden farklı olabilir, çünkü parametre sitelenmişse component site özellikleri ekleyebilir veya kaldırabilir.
ise componentnull, boş bir koleksiyon döndürülür.
Döndürülen koleksiyonun sırasının çağrılar arasında aynı olması garanti edilmediğinden, kullanmadan önce her zaman sıralayın.
Ayrıca bkz.
- PropertyDescriptor
- PropertyDescriptorCollection
- ICustomTypeDescriptor
- GetProperties
- GetDefaultProperty
- CreateProperty
- GetAttributes
- GetEvents
Şunlara uygulanır
GetProperties(Type, Attribute[])
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
Belirtilen öznitelik dizisini filtre olarak kullanarak belirtilen bileşen türü için özellik koleksiyonunu döndürür.
public:
static System::ComponentModel::PropertyDescriptorCollection ^ GetProperties(Type ^ componentType, cli::array <Attribute ^> ^ attributes);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered. The public parameterless constructor or the 'Default' static field may be trimmed from the Attribute's Type.")]
public static System.ComponentModel.PropertyDescriptorCollection GetProperties(Type componentType, Attribute[]? attributes);
public static System.ComponentModel.PropertyDescriptorCollection GetProperties(Type componentType, Attribute[] attributes);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered. The public parameterless constructor or the 'Default' static field may be trimmed from the Attribute's Type.")>]
static member GetProperties : Type * Attribute[] -> System.ComponentModel.PropertyDescriptorCollection
static member GetProperties : Type * Attribute[] -> System.ComponentModel.PropertyDescriptorCollection
Public Shared Function GetProperties (componentType As Type, attributes As Attribute()) As PropertyDescriptorCollection
Parametreler
Döndürülenler
Bu bileşen türü için belirtilen özniteliklerle eşleşen özelliklere sahip A PropertyDescriptorCollection .
- Öznitelikler
Örnekler
Aşağıdaki kod örneği, yönteminin nasıl uygulanduğunu GetProperties gösterir. Bu kod örneği, sınıfı için PropertyTab sağlanan daha büyük bir örneğin parçasıdır.
// Returns the properties of the specified component extended with
// a CategoryAttribute reflecting the name of the type of the property.
[ReflectionPermission(SecurityAction::Demand, Flags=ReflectionPermissionFlag::MemberAccess)]
virtual System::ComponentModel::PropertyDescriptorCollection^ GetProperties( Object^ component, array<System::Attribute^>^attributes ) override
{
PropertyDescriptorCollection^ props;
if ( attributes == nullptr )
props = TypeDescriptor::GetProperties( component );
else
props = TypeDescriptor::GetProperties( component, attributes );
array<PropertyDescriptor^>^propArray = gcnew array<PropertyDescriptor^>(props->Count);
for ( int i = 0; i < props->Count; i++ )
{
// Create a new PropertyDescriptor from the old one, with
// a CategoryAttribute matching the name of the type.
array<Attribute^>^temp0 = {gcnew CategoryAttribute( props[ i ]->PropertyType->Name )};
propArray[ i ] = TypeDescriptor::CreateProperty( props[ i ]->ComponentType, props[ i ], temp0 );
}
return gcnew PropertyDescriptorCollection( propArray );
}
virtual System::ComponentModel::PropertyDescriptorCollection^ GetProperties( Object^ component ) override
{
return this->GetProperties( component, nullptr );
}
// Returns the properties of the specified component extended with
// a CategoryAttribute reflecting the name of the type of the property.
public override PropertyDescriptorCollection GetProperties(object component, System.Attribute[] attributes)
{
PropertyDescriptorCollection props = attributes == null ? TypeDescriptor.GetProperties(component) : TypeDescriptor.GetProperties(component, attributes);
PropertyDescriptor[] propArray = new PropertyDescriptor[props.Count];
for (int i = 0; i < props.Count; i++)
{
// Create a new PropertyDescriptor from the old one, with
// a CategoryAttribute matching the name of the type.
propArray[i] = TypeDescriptor.CreateProperty(props[i].ComponentType, props[i], new CategoryAttribute(props[i].PropertyType.Name));
}
return new PropertyDescriptorCollection(propArray);
}
public override PropertyDescriptorCollection GetProperties(object component) => GetProperties(component, null);
Açıklamalar
Bu yöntemin bu sürümünü yalnızca nesnesinin bir örneğine sahip olmadığınızda çağırın.
attributes Parametre dizisi, diziyi filtrelemek için kullanılır. Filtreleme aşağıdaki kurallarla tanımlanır:
Bir özelliğin Attribute sınıfı aynı değilse, özellik döndürülen diziye dahil değildir.
özniteliği sınıfın Attribute bir örneğiyse, özelliğin tam eşleşmesi olması gerekir veya döndürülen diziye dahil değildir.
Bir Attribute örnek belirtilirse ve varsayılan özellikse, özelliğinde örneği olmasa bile döndürülen diziye Attribute eklenir.
Varsayılan bir özniteliği varsa
attributes, GetProperties özelliğin özniteliği uygulanmadığında yöntemi büyük/küçük harfle eşleşir.
componentType parametresi ise nullboş bir koleksiyon döndürülür.
Döndürülen koleksiyonun sırasının çağrılar arasında aynı olması garanti edilmediğinden, kullanmadan önce her zaman sıralayın.
Ayrıca bkz.
- PropertyDescriptor
- PropertyDescriptorCollection
- GetProperties
- GetDefaultProperty
- CreateProperty
- GetAttributes
- GetEvents
Şunlara uygulanır
GetProperties(Object, Attribute[], Boolean)
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
- Kaynak:
- TypeDescriptor.cs
Belirtilen öznitelik dizisini filtre olarak ve özel tür tanımlayıcısı kullanarak belirtilen bir bileşen için özellik koleksiyonunu döndürür.
public:
static System::ComponentModel::PropertyDescriptorCollection ^ GetProperties(System::Object ^ component, cli::array <Attribute ^> ^ attributes, bool noCustomTypeDesc);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered. The Type of component cannot be statically discovered. The public parameterless constructor or the 'Default' static field may be trimmed from the Attribute's Type.")]
public static System.ComponentModel.PropertyDescriptorCollection GetProperties(object component, Attribute[]? attributes, bool noCustomTypeDesc);
public static System.ComponentModel.PropertyDescriptorCollection GetProperties(object component, Attribute[] attributes, bool noCustomTypeDesc);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered. The Type of component cannot be statically discovered. The public parameterless constructor or the 'Default' static field may be trimmed from the Attribute's Type.")>]
static member GetProperties : obj * Attribute[] * bool -> System.ComponentModel.PropertyDescriptorCollection
static member GetProperties : obj * Attribute[] * bool -> System.ComponentModel.PropertyDescriptorCollection
Public Shared Function GetProperties (component As Object, attributes As Attribute(), noCustomTypeDesc As Boolean) As PropertyDescriptorCollection
Parametreler
- component
- Object
Özelliklerini almak için bir bileşen.
- noCustomTypeDesc
- Boolean
true özel tür açıklama bilgilerini dikkate almamak için; aksi takdirde , false.
Döndürülenler
PropertyDescriptorCollection Belirtilen bileşen için belirtilen özniteliklerle eşleşen olayları içeren A.
- Öznitelikler
Özel durumlar
component , işlemler arası uzak bir nesnedir.
Açıklamalar
sitenin özellikleri, sitenin siteye ekleyip kaldırabildiği için component , öğesinin özellikleri bir sınıfın component özelliklerinden farklı olabilir.
attributes Parametre dizisi, diziyi filtrelemek için kullanılır. Filtreleme aşağıdaki kurallarla tanımlanır:
Bir özelliğin Attribute sınıfı aynı değilse, özellik döndürülen diziye dahil değildir.
özniteliği sınıfın Attribute bir örneğiyse, özelliğin tam eşleşmesi olması gerekir veya döndürülen diziye dahil değildir.
Bir Attribute örnek belirtilirse ve varsayılan özellikse, özelliğinde örneği olmasa bile döndürülen diziye Attribute eklenir.
Varsayılan bir özniteliği varsa
attributes, GetProperties özelliğin özniteliği uygulanmadığında yöntemi büyük/küçük harfle eşleşir.
component parametresi ise nullboş bir koleksiyon döndürülür.
Döndürülen koleksiyonun sırasının çağrılar arasında aynı olması garanti edilmediğinden, kullanmadan önce her zaman sıralayın.
Ayrıca bkz.
- PropertyDescriptor
- PropertyDescriptorCollection
- ICustomTypeDescriptor
- GetProperties
- GetDefaultProperty
- CreateProperty
- GetAttributes
- GetEvents