_MethodBase.IsSpecialNameとは? わかりやすく解説

MethodBase.IsSpecialName プロパティ

特別な名前のメソッドかどうかを示す値を取得します

名前空間: System.Reflection
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Dim instance As MethodBase
Dim value As Boolean

value = instance.IsSpecialName
public bool IsSpecialName { get;
 }
/** @property */
public final boolean get_IsSpecialName ()

プロパティ
このメソッド特別な名前が付けられている場合trueそれ以外場合false

解説解説
使用例使用例

IsSpecialName使用して内部メンバまたはプライベート メンバリストから抽出するコード例次に示します

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
            Return
        End If
        Dim mInfo As MethodInfo() = aType.GetMethods()
        myWriter.WriteLine("Methods")
        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
            myWriter.WriteLine("(none)")
        End If
    End Sub
End Class
using System;
using System.IO;
using System.Reflection;
using System.Text;

public class Sample
{
    protected bool ShowMethods;
    protected StreamWriter myWriter;
 
    private void DumpMethods(Type aType)
    {
        if (!ShowMethods)
            return;
        MethodInfo[] mInfo = aType.GetMethods();
        myWriter.WriteLine("Methods"); 
        bool found = false;            
        if (mInfo.Length != 0)
        {
            for (int i=0; i < mInfo.Length;
 i++)
            {
                // 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 == aType &&
 !mInfo[i].IsSpecialName)
                {        
                    found = true;
                    StringBuilder modifiers = new StringBuilder();
                    if (mInfo[i].IsStatic)   {modifiers.Append("static
 ");}     
                    if (mInfo[i].IsPublic)   {modifiers.Append("public
 ");}     
                    if (mInfo[i].IsFamily)   {modifiers.Append("protected
 ");}     
                    if (mInfo[i].IsAssembly) {modifiers.Append("internal
 ");}     
                    if (mInfo[i].IsPrivate)  {modifiers.Append("private
 ");}     
                    myWriter.WriteLine("{0} {1}", modifiers, mInfo[i]);
                }
            }                      
        }                    
        if (!found)
        {
            myWriter.WriteLine("(none)");
        }
    }
}
using namespace System;
using namespace System::IO;
using namespace System::Reflection;
using namespace System::Text;
public ref class Sample
{
protected:
   bool ShowMethods;
   StreamWriter^ myWriter;

private:
   void DumpMethods( Type^ aType )
   {
      if (  !ShowMethods )
            return;

      array<MethodInfo^>^mInfo = aType->GetMethods();
      myWriter->WriteLine( "Methods" );
      bool found = false;
      if ( mInfo->Length != 0 )
      {
         for ( int i = 0; i < mInfo->Length;
 i++ )
         {
            
            // 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 == aType &&
  !mInfo[ i ]->IsSpecialName )
            {
               found = true;
               StringBuilder^ modifiers = gcnew StringBuilder;
               if ( mInfo[ i ]->IsStatic )
               {
                  modifiers->Append( "static " );
               }
               if ( mInfo[ i ]->IsPublic )
               {
                  modifiers->Append( "public " );
               }
               if ( mInfo[ i ]->IsFamily )
               {
                  modifiers->Append( "protected "
 );
               }
               if ( mInfo[ i ]->IsAssembly )
               {
                  modifiers->Append( "internal " );
               }
               if ( mInfo[ i ]->IsPrivate )
               {
                  modifiers->Append( "private " );
               }
               myWriter->WriteLine( "{0} {1}", modifiers, mInfo[ i ]
 );
            }

         }
      }

      if (  !found )
      {
         myWriter->WriteLine( "(none)" );
      }
   }

};

import System.*;
import System.IO.*;
import System.Reflection.*;
import System.Text.*;

public class Sample
{
    protected boolean showMethods;
    protected StreamWriter myWriter;

    private void DumpMethods(Type aType)
    {
        if (!(showMethods)) {
            return ;
        }
        MethodInfo mInfo[] = aType.GetMethods();
        myWriter.WriteLine("Methods");
        boolean found = false;
        if ( mInfo.length != 0 ) {
            for(int i=0;i < mInfo.length;i++)
 {
                // 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].get_DeclaringType().Equals(aType)
 &&
                    !(mInfo[i].get_IsSpecialName()) ) {
                        found = true;
                        StringBuilder modifiers = new StringBuilder();
                        if ( mInfo[i].get_IsStatic() ) {
                            modifiers.Append("static ");
                        }
                        if ( mInfo[i].get_IsPublic() ) {
                            modifiers.Append("public ");
                        }
                        if ( mInfo[i].get_IsFamily() ) {
                            modifiers.Append("protected ");
                        }
                        if ( mInfo[i].get_IsAssembly()) {
                            modifiers.Append("internal ");
                        }
                        if ( mInfo[i].get_IsPrivate() ) {
                            modifiers.Append("private ");
                        }
                        myWriter.WriteLine("{0} {1}", 
                            modifiers, mInfo.get_Item(i));
                }
            } 
        }
        if (!(found) ) {
            myWriter.WriteLine("(none)");
        }
    } //DumpMethods
} //Sample
private function DumpMethods(aType : Type)
 : void 
 {
 if (!ShowMethods)
 return;
 var mInfo : MethodInfo[] = aType.GetMethods();
 myWriter.WriteLine("Methods"); 
 var found : boolean = false;            
 
   if (mInfo.Length != 0)
   {
    for ( var i:int =0;
 i < mInfo.Length; i++ )
    {
    // 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.Equals(aType) && !mInfo[i].IsSpecialName)
     {        
      found = true;
      var modifiers : StringBuilder = new StringBuilder();
      if (mInfo[i].IsStatic)   {modifiers.Append("static
 ");}     
      if (mInfo[i].IsPublic)   {modifiers.Append("public
 ");}     
      if (mInfo[i].IsFamily)   {modifiers.Append("protected
 ");}     
      if (mInfo[i].IsAssembly) {modifiers.Append("internal
 ");}     
      if (mInfo[i].IsPrivate)  {modifiers.Append("private
 ");}     
    myWriter.WriteLine("{0} {1}", [modifiers, mInfo[i]]);
      }
    }                      
  }                    
      if (!found)
      {
       myWriter.WriteLine("(none)");
      }
 }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

_MethodBase.IsSpecialName プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

COM オブジェクトに、IsSpecialName プロパティへのバージョン依存しないアクセス用意されています。

このプロパティは、CLS準拠していません。  

名前空間: System.Runtime.InteropServices
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Dim instance As _MethodBase
Dim value As Boolean

value = instance.IsSpecialName
bool IsSpecialName { get; }
property bool IsSpecialName {
    bool get ();
}
/** @property */
boolean get_IsSpecialName ()
function get IsSpecialName () : boolean

プロパティ
このメソッド特別な名前が付けられている場合trueそれ以外場合false

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
_MethodBase インターフェイス
_MethodBase メンバ
System.Runtime.InteropServices 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「_MethodBase.IsSpecialName」の関連用語

_MethodBase.IsSpecialNameのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



_MethodBase.IsSpecialNameのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS