Skip to content

Commit 96095c8

Browse files
authored
Merge pull request #4439 from MSDN-WhiteKnight/patch-1
Update FieldInfo docs to new language versions
2 parents 803e3e5 + 0a6774e commit 96095c8

File tree

3 files changed

+10
-15
lines changed
  • samples/snippets
    • csharp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CS
    • visualbasic/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/VB
  • xml/System.Reflection

3 files changed

+10
-15
lines changed

samples/snippets/csharp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CS/source.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public class Example
88
internal int f_internal;
99
protected int f_protected;
1010
protected internal int f_protected_public;
11+
private protected int f_private_protected;
1112

1213
public static void Main()
1314
{
@@ -39,5 +40,6 @@ f_public True False False False False
3940
f_internal False True False False False
4041
f_protected False False True False False
4142
f_protected_public False False False True False
43+
f_private_protected False False False False True
4244
*/
4345
// </Snippet1>

samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/VB/source.vb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Public class Example
77
Friend f_Friend As Integer
88
Protected f_Protected As Integer
99
Protected Friend f_Protected_Friend As Integer
10+
Private Protected f_Private_Protected() As Integer
1011

1112
Public Shared Sub Main()
1213

@@ -39,5 +40,6 @@ End Class
3940
'f_Friend False True False False False
4041
'f_Protected False False True False False
4142
'f_Protected_Friend False False False True False
43+
'f_Private_Protected False False False False True
4244
' </Snippet1>
4345

xml/System.Reflection/FieldInfo.xml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -984,11 +984,8 @@
984984
985985
986986
## Examples
987-
The following code example defines fields with varying levels of visibility, and displays the values of their <xref:System.Reflection.FieldInfo.IsAssembly%2A>, <xref:System.Reflection.FieldInfo.IsFamily%2A>, <xref:System.Reflection.FieldInfo.IsFamilyOrAssembly%2A>, and <xref:System.Reflection.FieldInfo.IsFamilyAndAssembly%2A> properties.
988-
989-
> [!NOTE]
990-
> The Visual Basic and C# languages cannot define fields with <xref:System.Reflection.FieldAttributes.FamANDAssem?displayProperty=nameWithType> visibility; that access level appears only in the C++ example.
991-
987+
The following code example defines fields with varying levels of visibility, and displays the values of their <xref:System.Reflection.FieldInfo.IsAssembly%2A>, <xref:System.Reflection.FieldInfo.IsFamily%2A>, <xref:System.Reflection.FieldInfo.IsFamilyOrAssembly%2A>, and <xref:System.Reflection.FieldInfo.IsFamilyAndAssembly%2A> properties.
988+
992989
[!code-cpp[Classic FieldInfo.IsAssembly Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CPP/source.cpp#1)]
993990
[!code-csharp[Classic FieldInfo.IsAssembly Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CS/source.cs#1)]
994991
[!code-vb[Classic FieldInfo.IsAssembly Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/VB/source.vb#1)]
@@ -1055,9 +1052,7 @@
10551052
## Examples
10561053
The following code example defines fields with varying levels of visibility, and displays the values of their <xref:System.Reflection.FieldInfo.IsAssembly%2A>, <xref:System.Reflection.FieldInfo.IsFamily%2A>, <xref:System.Reflection.FieldInfo.IsFamilyOrAssembly%2A>, and <xref:System.Reflection.FieldInfo.IsFamilyAndAssembly%2A> properties.
10571054
1058-
> [!NOTE]
1059-
> The Visual Basic and C# languages cannot define fields with <xref:System.Reflection.FieldAttributes.FamANDAssem?displayProperty=nameWithType> visibility; that access level appears only in the C++ example.
1060-
1055+
10611056
[!code-cpp[Classic FieldInfo.IsAssembly Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CPP/source.cpp#1)]
10621057
[!code-csharp[Classic FieldInfo.IsAssembly Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CS/source.cs#1)]
10631058
[!code-vb[Classic FieldInfo.IsAssembly Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/VB/source.vb#1)]
@@ -1120,16 +1115,14 @@
11201115
## Remarks
11211116
If a field has <xref:System.Reflection.FieldAttributes.FamANDAssem> level visibility, it can be called from any member in a derived class that is also in the same assembly, but not from any other type.
11221117
1123-
The visibility of a field is exactly described by <xref:System.Reflection.FieldAttributes.FamANDAssem?displayProperty=nameWithType> if the visibility modifier is `protected private` in C++. Fields with this visibility cannot be defined in Visual Basic or C#.
1118+
The visibility of a field is exactly described by <xref:System.Reflection.FieldAttributes.FamANDAssem?displayProperty=nameWithType> if the visibility modifier is `private protected` in C#, `Private Protected` in Visual Basic, or `protected private` in C++.
11241119
11251120
11261121
11271122
## Examples
11281123
The following code example defines fields with varying levels of visibility, and displays the values of their <xref:System.Reflection.FieldInfo.IsAssembly%2A>, <xref:System.Reflection.FieldInfo.IsFamily%2A>, <xref:System.Reflection.FieldInfo.IsFamilyOrAssembly%2A>, and <xref:System.Reflection.FieldInfo.IsFamilyAndAssembly%2A> properties.
11291124
1130-
> [!NOTE]
1131-
> The Visual Basic and C# languages cannot define fields with <xref:System.Reflection.FieldAttributes.FamANDAssem?displayProperty=nameWithType> visibility; that access level appears only in the C++ example.
1132-
1125+
11331126
[!code-cpp[Classic FieldInfo.IsAssembly Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CPP/source.cpp#1)]
11341127
[!code-csharp[Classic FieldInfo.IsAssembly Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CS/source.cs#1)]
11351128
[!code-vb[Classic FieldInfo.IsAssembly Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/VB/source.vb#1)]
@@ -1200,9 +1193,7 @@
12001193
## Examples
12011194
The following code example defines fields with varying levels of visibility, and displays the values of their <xref:System.Reflection.FieldInfo.IsAssembly%2A>, <xref:System.Reflection.FieldInfo.IsFamily%2A>, <xref:System.Reflection.FieldInfo.IsFamilyOrAssembly%2A>, and <xref:System.Reflection.FieldInfo.IsFamilyAndAssembly%2A> properties.
12021195
1203-
> [!NOTE]
1204-
> The Visual Basic and C# languages cannot define fields with <xref:System.Reflection.FieldAttributes.FamANDAssem?displayProperty=nameWithType> visibility; that access level appears only in the C++ example.
1205-
1196+
12061197
[!code-cpp[Classic FieldInfo.IsAssembly Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CPP/source.cpp#1)]
12071198
[!code-csharp[Classic FieldInfo.IsAssembly Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CS/source.cs#1)]
12081199
[!code-vb[Classic FieldInfo.IsAssembly Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/VB/source.vb#1)]

0 commit comments

Comments
 (0)