This documentation is archived and is not being maintained.

MethodBase.IsSpecialName Property

Gets a value indicating whether this method has a special name.

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

Public ReadOnly Property IsSpecialName As Boolean
Dim instance As MethodBase 
Dim value As Boolean 

value = instance.IsSpecialName

Property Value

Type: System.Boolean
true if this method has a special name; otherwise, false.

The SpecialName bit is set to flag members that are treated in a special way by some compilers (such as property accessors and operator overloading methods).

This example shows a use of IsSpecialName to filter internal or private members out of a list.

Imports System
Imports System.IO
Imports System.Reflection
Imports System.Text
Public Class Sample
    Protected ShowMethods As Boolean 
    Protected myWriter As StreamWriter
    Private Sub DumpMethods(ByVal aType As Type)
        If Not ShowMethods Then 
        End If 
        Dim mInfo As MethodInfo() = aType.GetMethods()
        Dim found As Boolean = False 
        If mInfo.Length <> 0 Then 
            Dim i As Integer 
            For i = 0 To mInfo.Length - 1
                ' Only display methods declared in this type. Also  
                ' filter out any methods with special names, because these 
                ' cannot be generally called by the user. That is, their  
                ' functionality is usually exposed in other ways, for example, 
                ' property get/set methods are exposed as properties. 
                If mInfo(i).DeclaringType Is aType _
                   And Not mInfo(i).IsSpecialName Then
                    found = True 
                    Dim modifiers As New StringBuilder()
                    If mInfo(i).IsStatic Then
                        modifiers.Append("static ")
                    End If 
                    If mInfo(i).IsPublic Then
                        modifiers.Append("public ")
                    End If 
                    If mInfo(i).IsFamily Then
                        modifiers.Append("protected ")
                    End If 
                    If mInfo(i).IsAssembly Then
                        modifiers.Append("internal ")
                    End If 
                    If mInfo(i).IsPrivate Then
                        modifiers.Append("private ")
                    End If
                    myWriter.WriteLine("{0} {1}", modifiers, mInfo(i))
                End If 
            Next i
        End If 
        If Not found Then
        End If 
    End Sub 
End Class

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0

XNA Framework

Supported in: 3.0, 2.0, 1.0