TypeDescriptor.GetProperties 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
구성 요소 또는 형식의 속성 컬렉션을 반환합니다.
오버로드
| Name | Description |
|---|---|
| GetProperties(Object) |
지정된 구성 요소에 대한 속성 컬렉션을 반환합니다. |
| GetProperties(Type) |
지정된 구성 요소 형식의 속성 컬렉션을 반환합니다. |
| GetProperties(Object, Attribute[]) |
지정된 특성 배열을 필터로 사용하여 지정된 구성 요소에 대한 속성 컬렉션을 반환합니다. |
| GetProperties(Object, Boolean) |
기본 형식 설명자를 사용하여 지정된 구성 요소에 대한 속성 컬렉션을 반환합니다. |
| GetProperties(Type, Attribute[]) |
지정된 특성 배열을 필터로 사용하여 지정된 구성 요소 형식의 속성 컬렉션을 반환합니다. |
| GetProperties(Object, Attribute[], Boolean) |
지정된 특성 배열을 필터로 사용하고 사용자 지정 형식 설명자를 사용하여 지정된 구성 요소에 대한 속성 컬렉션을 반환합니다. |
GetProperties(Object)
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
지정된 구성 요소에 대한 속성 컬렉션을 반환합니다.
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
매개 변수
- component
- Object
속성을 가져올 구성 요소입니다.
반품
지정된 구성 요소에 대한 속성이 있는 A PropertyDescriptorCollection 입니다.
- 특성
예외
component 는 크로스 프로세스 원격 개체입니다.
예제
다음 코드 예제에서는 컨트롤의 속성에 GetProperties 액세스 하는 메서드를 사용 하는 방법을 보여 줍니다. 이 코드 예제는 클래스에 제공된 더 큰 예제의 ComponentDesigner 일부입니다.
// 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
설명
구성 요소에 대한 속성은 구성 요소가 배치된 경우 사이트에서 속성을 추가하거나 제거할 수 있으므로 클래스의 속성과 다를 수 있습니다.
매개 변수가 componentnull있으면 빈 컬렉션이 반환됩니다.
반환된 컬렉션의 순서가 호출 간에 동일하지는 않으므로 항상 사용하기 전에 순서를 지정합니다.
추가 정보
- PropertyDescriptor
- PropertyDescriptorCollection
- GetProperties
- GetDefaultProperty
- CreateProperty
- GetAttributes
- GetEvents
적용 대상
GetProperties(Type)
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
지정된 구성 요소 형식의 속성 컬렉션을 반환합니다.
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
매개 변수
반품
지정된 유형의 구성 요소에 대한 속성이 있는 A PropertyDescriptorCollection 입니다.
- 특성
설명
개체의 인스턴스가 없는 경우에만 이 메서드 버전을 호출합니다.
매개 변수가 componentTypenull있으면 빈 컬렉션이 반환됩니다.
반환된 컬렉션의 순서가 호출 간에 동일하지는 않으므로 항상 사용하기 전에 순서를 지정합니다.
추가 정보
- PropertyDescriptor
- PropertyDescriptorCollection
- GetProperties
- GetDefaultProperty
- CreateProperty
- GetAttributes
- GetEvents
적용 대상
GetProperties(Object, Attribute[])
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
지정된 특성 배열을 필터로 사용하여 지정된 구성 요소에 대한 속성 컬렉션을 반환합니다.
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
매개 변수
- component
- Object
속성을 가져올 구성 요소입니다.
반품
PropertyDescriptorCollection 지정된 구성 요소의 지정된 특성과 일치하는 속성이 있는 A입니다.
- 특성
예외
component 는 크로스 프로세스 원격 개체입니다.
예제
다음 코드 예제에서는 메서드를 구현 하는 방법을 보여 줍니다 GetProperties . 이 코드 예제는 클래스에 제공된 더 큰 예제의 PropertyTab 일부입니다.
// 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);
설명
매개 변수가 component 있는 경우 component 사이트에서 속성을 추가하거나 제거할 수 있으므로 매개 변수의 속성은 클래스의 속성과 다를 수 있습니다.
attributes 매개 변수 배열은 배열을 필터링하는 데 사용됩니다. 필터링은 다음 규칙에 의해 정의됩니다.
속성에 동일한 클래스가 Attribute 없으면 반환된 배열에 속성이 포함되지 않습니다.
특성이 클래스의 Attribute 인스턴스인 경우 속성은 정확히 일치해야 합니다. 그렇지 않으면 반환된 배열에 포함되지 않습니다.
인스턴스가 Attribute 지정되고 기본 속성인 경우 속성에 인스턴스가 없더라도 반환된 배열에 Attribute 포함됩니다.
기본 특성이 있는 경우
attributes속성에 GetProperties 특성이 적용되지 않은 경우 메서드가 대/소문자를 일치합니다.
이 component경우 null 빈 컬렉션이 반환됩니다.
반환된 컬렉션의 순서가 호출 간에 동일하지는 않으므로 항상 사용하기 전에 순서를 지정합니다.
추가 정보
- PropertyDescriptor
- PropertyDescriptorCollection
- GetProperties
- GetDefaultProperty
- CreateProperty
- GetAttributes
- GetEvents
적용 대상
GetProperties(Object, Boolean)
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
기본 형식 설명자를 사용하여 지정된 구성 요소에 대한 속성 컬렉션을 반환합니다.
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
매개 변수
- component
- Object
속성을 가져올 구성 요소입니다.
- noCustomTypeDesc
- Boolean
true사용자 지정 형식 설명 정보를 고려하지 않는 경우 그렇지 않으면 . false
반품
지정된 구성 요소에 대한 속성이 있는 A PropertyDescriptorCollection 입니다.
- 특성
예외
component 는 크로스 프로세스 원격 개체입니다.
설명
매개 변수가 component 있는 경우 component 사이트에서 속성을 추가하거나 제거할 수 있으므로 매개 변수의 속성은 클래스의 속성과 다를 수 있습니다.
이 component경우 null 빈 컬렉션이 반환됩니다.
반환된 컬렉션의 순서가 호출 간에 동일하지는 않으므로 항상 사용하기 전에 순서를 지정합니다.
추가 정보
- PropertyDescriptor
- PropertyDescriptorCollection
- ICustomTypeDescriptor
- GetProperties
- GetDefaultProperty
- CreateProperty
- GetAttributes
- GetEvents
적용 대상
GetProperties(Type, Attribute[])
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
지정된 특성 배열을 필터로 사용하여 지정된 구성 요소 형식의 속성 컬렉션을 반환합니다.
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
매개 변수
반품
이 유형의 구성 요소에 대해 지정된 특성과 일치하는 속성이 있는 A PropertyDescriptorCollection 입니다.
- 특성
예제
다음 코드 예제에서는 메서드를 구현 하는 방법을 보여 줍니다 GetProperties . 이 코드 예제는 클래스에 제공된 더 큰 예제의 PropertyTab 일부입니다.
// 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);
설명
개체의 인스턴스가 없는 경우에만 이 메서드 버전을 호출합니다.
attributes 매개 변수 배열은 배열을 필터링하는 데 사용됩니다. 필터링은 다음 규칙에 의해 정의됩니다.
속성에 동일한 클래스가 Attribute 없으면 반환된 배열에 속성이 포함되지 않습니다.
특성이 클래스의 Attribute 인스턴스인 경우 속성은 정확히 일치해야 합니다. 그렇지 않으면 반환된 배열에 포함되지 않습니다.
인스턴스가 Attribute 지정되고 기본 속성인 경우 속성에 인스턴스가 없더라도 반환된 배열에 Attribute 포함됩니다.
기본 특성이 있는 경우
attributes속성에 GetProperties 특성이 적용되지 않은 경우 메서드가 대/소문자를 일치합니다.
매개 변수가 componentTypenull있으면 빈 컬렉션이 반환됩니다.
반환된 컬렉션의 순서가 호출 간에 동일하지는 않으므로 항상 사용하기 전에 순서를 지정합니다.
추가 정보
- PropertyDescriptor
- PropertyDescriptorCollection
- GetProperties
- GetDefaultProperty
- CreateProperty
- GetAttributes
- GetEvents
적용 대상
GetProperties(Object, Attribute[], Boolean)
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
- Source:
- TypeDescriptor.cs
지정된 특성 배열을 필터로 사용하고 사용자 지정 형식 설명자를 사용하여 지정된 구성 요소에 대한 속성 컬렉션을 반환합니다.
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
매개 변수
- component
- Object
속성을 가져올 구성 요소입니다.
- noCustomTypeDesc
- Boolean
true사용자 지정 형식 설명 정보를 고려하지 않는 경우 그렇지 않으면 . false
반품
PropertyDescriptorCollection 지정된 구성 요소의 지정된 특성과 일치하는 이벤트가 있는 A입니다.
- 특성
예외
component 는 크로스 프로세스 원격 개체입니다.
설명
사이트에 있는 경우 속성을 component 추가하거나 제거할 수 있으므로 클래스의 속성과 클래스의 속성이 component 다를 수 있습니다.
attributes 매개 변수 배열은 배열을 필터링하는 데 사용됩니다. 필터링은 다음 규칙에 의해 정의됩니다.
속성에 동일한 클래스가 Attribute 없으면 반환된 배열에 속성이 포함되지 않습니다.
특성이 클래스의 Attribute 인스턴스인 경우 속성은 정확히 일치해야 합니다. 그렇지 않으면 반환된 배열에 포함되지 않습니다.
인스턴스가 Attribute 지정되고 기본 속성인 경우 속성에 인스턴스가 없더라도 반환된 배열에 Attribute 포함됩니다.
기본 특성이 있는 경우
attributes속성에 GetProperties 특성이 적용되지 않은 경우 메서드가 대/소문자를 일치합니다.
매개 변수가 componentnull있으면 빈 컬렉션이 반환됩니다.
반환된 컬렉션의 순서가 호출 간에 동일하지는 않으므로 항상 사용하기 전에 순서를 지정합니다.
추가 정보
- PropertyDescriptor
- PropertyDescriptorCollection
- ICustomTypeDescriptor
- GetProperties
- GetDefaultProperty
- CreateProperty
- GetAttributes
- GetEvents