Skip to content

Commit 687498d

Browse files
authored
Fix run-on heading (#45572)
1 parent c961d28 commit 687498d

File tree

1 file changed

+11
-27
lines changed

1 file changed

+11
-27
lines changed

docs/fundamentals/runtime-libraries/system-type-getproperty.md

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
---
22
title: System.Type.GetProperty methods
33
description: Learn about the System.Type.GetProperty methods.
4-
ms.date: 01/24/2024
4+
ms.date: 03/30/2025
55
---
66
# System.Type.GetProperty methods
77

88
[!INCLUDE [context](includes/context.md)]
99

10-
## <xref:System.Type.GetProperty(System.String)> method
11-
12-
The search for `name` is case-sensitive. The search includes public static and public instance properties.
10+
The following guidance applies to all overloads:
1311

14-
A property is considered public to reflection if it has at least one accessor that is public. Otherwise the property is considered private, and you must use <xref:System.Reflection.BindingFlags.NonPublic?displayProperty=nameWithType> &#124; <xref:System.Reflection.BindingFlags.Instance?displayProperty=nameWithType> &#124; <xref:System.Reflection.BindingFlags.Static?displayProperty=nameWithType> (in Visual Basic, combine the values using ` Or `) to get it.
12+
- A property is considered public to reflection if it has at least one accessor that is public. Otherwise the property is considered private, and you must use <xref:System.Reflection.BindingFlags.NonPublic?displayProperty=nameWithType> &#124; <xref:System.Reflection.BindingFlags.Instance?displayProperty=nameWithType> &#124; <xref:System.Reflection.BindingFlags.Static?displayProperty=nameWithType> (in Visual Basic, combine the values using ` Or `) to get it.
13+
- If the current <xref:System.Type> represents a constructed generic type, this method returns the <xref:System.Reflection.PropertyInfo> with the type parameters replaced by the appropriate type arguments.
14+
- If the current <xref:System.Type> represents a type parameter in the definition of a generic type or generic method, this method searches the properties of the class constraint.
1515

16-
If the current <xref:System.Type> represents a constructed generic type, this method returns the <xref:System.Reflection.PropertyInfo> with the type parameters replaced by the appropriate type arguments.
16+
## <xref:System.Type.GetProperty(System.String)> method
1717

18-
If the current <xref:System.Type> represents a type parameter in the definition of a generic type or generic method, this method searches the properties of the class constraint.
18+
The search for `name` is case-sensitive. The search includes public static and public instance properties.
1919

2020
Situations in which <xref:System.Reflection.AmbiguousMatchException> occurs include the following:
2121

@@ -24,8 +24,6 @@ Situations in which <xref:System.Reflection.AmbiguousMatchException> occurs incl
2424

2525
## <xref:System.Type.GetProperty(System.String,System.Reflection.BindingFlags)> method
2626

27-
A property is considered public to reflection if it has at least one accessor that is public. Otherwise the property is considered private, and you must use <xref:System.Reflection.BindingFlags.NonPublic?displayProperty=nameWithType> &#124; <xref:System.Reflection.BindingFlags.Instance?displayProperty=nameWithType> &#124; <xref:System.Reflection.BindingFlags.Static?displayProperty=nameWithType> (in Visual Basic, combine the values using ` Or `) to get it.
28-
2927
The following <xref:System.Reflection.BindingFlags> filter flags can be used to define which properties to include in the search:
3028

3129
- You must specify either `BindingFlags.Instance` or `BindingFlags.Static` in order to get a return.
@@ -38,20 +36,12 @@ The following <xref:System.Reflection.BindingFlags> modifier flags can be used t
3836
- `BindingFlags.IgnoreCase` to ignore the case of `name`.
3937
- `BindingFlags.DeclaredOnly` to search only the properties declared on the <xref:System.Type>, not properties that were simply inherited.
4038

41-
See <xref:System.Reflection.BindingFlags?displayProperty=nameWithType> for more information.
42-
43-
If the current <xref:System.Type> represents a constructed generic type, this method returns the <xref:System.Reflection.PropertyInfo> with the type parameters replaced by the appropriate type arguments.
44-
45-
If the current <xref:System.Type> represents a type parameter in the definition of a generic type or generic method, this method searches the properties of the class constraint.
46-
4739
Situations in which <xref:System.Reflection.AmbiguousMatchException> occurs include the following:
4840

4941
- A type contains two indexed properties that have the same name but different numbers of parameters. To resolve the ambiguity, use an overload of the <xref:System.Type.GetProperty%2A> method that specifies parameter types.
5042
- A derived type declares a property that hides an inherited property with the same name, using the `new` modifier (`Shadows` in Visual Basic). To resolve the ambiguity, include <xref:System.Reflection.BindingFlags.DeclaredOnly?displayProperty=nameWithType> to restrict the search to members that are not inherited.
5143

52-
## GetProperty(System.String,System.Reflection.BindingFlags,System.Reflection.Binder,System.Type,System.Type[],System.Reflection.ParameterModifier[])
53-
54-
A property is considered public to reflection if it has at least one accessor that is public. Otherwise the property is considered private, and you must use <xref:System.Reflection.BindingFlags.NonPublic?displayProperty=nameWithType> &#124; <xref:System.Reflection.BindingFlags.Instance?displayProperty=nameWithType> &#124; <xref:System.Reflection.BindingFlags.Static?displayProperty=nameWithType> (in Visual Basic, combine the values using ` Or `) to get it.
44+
## [GetProperty(System.String, System.Reflection.BindingFlags, System.Reflection.Binder, System.Type, System.Type[], System.Reflection.ParameterModifier[])](xref:System.Type.GetProperty(System.String,System.Reflection.BindingFlags,System.Reflection.Binder,System.Type,System.Type[],System.Reflection.ParameterModifier[])) method
5545

5646
Although the default binder does not process <xref:System.Reflection.ParameterModifier> (the `modifiers` parameter), you can use the abstract <xref:System.Reflection.Binder?displayProperty=nameWithType> class to write a custom binder that does process `modifiers`. `ParameterModifier` is only used when calling through COM interop, and only parameters that are passed by reference are handled.
5747

@@ -68,9 +58,9 @@ The following table shows what members of a base class are returned by the `Get`
6858

6959
Notes:
7060

71-
1. Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.
72-
2. For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.
73-
3. Custom attributes are not part of the common type system.
61+
- Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.
62+
- For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.
63+
- Custom attributes are not part of the common type system.
7464

7565
The following <xref:System.Reflection.BindingFlags> filter flags can be used to define which properties to include in the search:
7666

@@ -84,12 +74,6 @@ The following <xref:System.Reflection.BindingFlags> modifier flags can be used t
8474
- `BindingFlags.IgnoreCase` to ignore the case of `name`.
8575
- `BindingFlags.DeclaredOnly` to search only the properties declared on the <xref:System.Type>, not properties that were simply inherited.
8676

87-
See <xref:System.Reflection.BindingFlags?displayProperty=nameWithType> for more information.
88-
89-
If the current <xref:System.Type> represents a constructed generic type, this method returns the <xref:System.Reflection.PropertyInfo> with the type parameters replaced by the appropriate type arguments.
90-
91-
If the current <xref:System.Type> represents a type parameter in the definition of a generic type or generic method, this method searches the properties of the class constraint.
92-
9377
## Indexers and default properties
9478

9579
Visual Basic, C#, and C++ have simplified syntax for accessing indexed properties and allow one indexed property to be a default for its type. For example, if the variable `myList` refers to an <xref:System.Collections.ArrayList>, the syntax `myList[3]` (`myList(3)` in Visual Basic) retrieves the element with the index of 3. You can overload the property.

0 commit comments

Comments
 (0)