IsExplicitlyDereferencedとは? わかりやすく解説

IsExplicitlyDereferenced クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

マネージ ポインタメソッド シグネチャ内のポインタ パラメータを表すことを示します。このクラス継承できません。

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

Public NotInheritable Class
 IsExplicitlyDereferenced
public static class IsExplicitlyDereferenced
public ref class IsExplicitlyDereferenced abstract
 sealed
public final class IsExplicitlyDereferenced
public final class IsExplicitlyDereferenced
解説解説

C++ では、マネージ ポインタマネージ参照ポインタとしてメタデータ出力されます。メタデータ内の 2 つの型区別するため、Microsoft C++ コンパイラはこの修飾子マネージ ポインタ適用します。修飾子マネージ参照型には出力されません。メタデータ スコープからメソッドインポートする場合コンパイラ正し呼び出し構文を知る必要がありますIsExplicitlyDereferenced クラスおよびそのパートナーである IsImplicitlyDereferenced クラスは、参照パラメータポインタ パラメータ明確に区別します。

既定動作適切でない場合コンパイラメタデータ内のカスタム修飾子出力して、Just-In-Time (JIT) コンパイラによる値の処理方法変更しますJIT コンパイラは、カスタム修飾子を見つけると、その修飾子指定に従って値を処理しますコンパイラは、メソッドパラメータ、および戻り値に対してカスタム修飾子適用します。JIT コンパイラは、オプション修飾子無視できますが、必須の修飾子については応答する必要があります

次のいずれか方法使用してカスタム修飾子メタデータ出力できます

使用例使用例

リフレクション使用してIsExplicitlyDereferenced オブジェクトアセンブリ出力する方法次の例に示します


#using <mscorlib.dll>

using namespace System;
using namespace System::Reflection;
using namespace System::Reflection::Emit;
using namespace System::Runtime::CompilerServices;
using namespace System::Threading;


ref class CodeEmitter
{
private:
    AssemblyBuilder^ asmBuilder;
    String^ asmName;
    ModuleBuilder^ modBuilder;


    void prepareAssembly(String^ name){
        
        // Check the input.
        if(!name){
        
            throw gcnew ArgumentNullException("AssemblyName");
        }

        asmName = name;

        // Create an AssemblyName object and set the name.
        AssemblyName^ asmName = gcnew AssemblyName();

        asmName->Name = name;

        // Use the AppDomain class to create an AssemblyBuilder instance.

        AppDomain^ currentDomain = Thread::GetDomain();

        asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave);

        // Create a dynamic module.
        modBuilder = asmBuilder->DefineDynamicModule(name);
    }


public:

    // Constructor.
    CodeEmitter(String ^ AssemblyName){

        prepareAssembly(AssemblyName);
    }

    // Create a new type.
    TypeBuilder^ CreateType(String^ name){
       
        // Check the input.
        if(!name){
        
            throw gcnew ArgumentNullException("AssemblyName");
        }

        return modBuilder->DefineType( name );
    }

    // Write the assembly.
    void WriteAssembly(MethodBuilder^ entryPoint){
    
        // Check the input.
        if(!entryPoint){
        
            throw gcnew ArgumentNullException("entryPoint");
        }

        asmBuilder->SetEntryPoint( entryPoint );
        asmBuilder->Save( asmName );
    }

};

void main()
{

    // Create a CodeEmitter to handle assembly creation.
    CodeEmitter ^ e = gcnew CodeEmitter("program.exe");

    // Create a new type.
    TypeBuilder^ mainClass = e->CreateType("MainClass");
    
    // Create a new method.
    MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod",
 MethodAttributes::Static);

    // Create an ILGenerator and emit IL for 
    // a simple "Hello World." program.
    ILGenerator^ ilGen = mBuilder->GetILGenerator();

    ilGen->Emit(OpCodes::Ldstr, "Hello World");

    array<Type^>^mType = {String::typeid};

    MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType
 );

    ilGen->EmitCall(OpCodes::Call, writeMI, nullptr );

    ilGen->Emit( OpCodes::Ret );

    /////////////////////////////////////////////////
    /////////////////////////////////////////////////
    // Apply a required custom modifier
    // to a field.
    /////////////////////////////////////////////////
    /////////////////////////////////////////////////

    array<Type^>^fType = {IsExplicitlyDereferenced::typeid};

    mainClass->DefineField("modifiedInteger", Type::GetType("System.IntPtr"),
 fType, nullptr, FieldAttributes::Private);

    // Create the type.
    mainClass->CreateType();

    // Write the assembly using a reference to 
    // the entry point.
    e->WriteAssembly(mBuilder);

    Console::WriteLine(L"Assembly created.");
}
継承階層継承階層
System.Object
  System.Runtime.CompilerServices.IsExplicitlyDereferenced
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
IsExplicitlyDereferenced メンバ
System.Runtime.CompilerServices 名前空間

IsExplicitlyDereferenced メソッド


IsExplicitlyDereferenced メンバ



このページでは「.NET Framework クラス ライブラリ リファレンス」からIsExplicitlyDereferencedを検索した結果を表示しています。
Weblioに収録されているすべての辞書からIsExplicitlyDereferencedを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からIsExplicitlyDereferenced を検索

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

辞書ショートカット

すべての辞書の索引

「IsExplicitlyDereferenced」の関連用語

IsExplicitlyDereferencedのお隣キーワード
検索ランキング

   

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



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

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

©2025 GRAS Group, Inc.RSS