FieldInfo.IsSpecialName Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets a value that indicates whether the field has a name that has special significance.
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System.Booleantrue if the field has the FieldAttributes.SpecialName attribute set; otherwise, false.
| Exception | Condition |
|---|---|
| MethodAccessException | This member is invoked late-bound through mechanisms such as Type.InvokeMember. |
The following example shows whether or not the fields in the class have the FieldAttributes.SpecialName attribute.
Note: |
|---|
To run this example, see Building examples that have static TextBlock controls for Windows Phone 8. |
using System; using System.Reflection; class Example { public static void Demo(System.Windows.Controls.TextBlock outputBlock) { Type myType = typeof(EventAttributes); outputBlock.Text = String.Format("Fields of {0}, flagging FieldAttributes.SpecialName:\n", myType.Name); foreach (FieldInfo fi in myType.GetFields()) { // Determine whether or not each field has a special name. if (fi.IsSpecialName) { outputBlock.Text += String.Format("{0} has the FieldAttributes.SpecialName attribute.\n", fi.Name); } else { outputBlock.Text += fi.Name + "\n"; } } } } /* This example produces output similar to the following: Fields of EventAttributes, flagging FieldAttributes.SpecialName: value__ has the FieldAttributes.SpecialName attribute. None SpecialName ReservedMask RTSpecialName */
Note: