AssemblyFlagsAttribute.AssemblyFlags プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > AssemblyFlagsAttribute.AssemblyFlags プロパティの意味・解説 

AssemblyFlagsAttribute.AssemblyFlags プロパティ

この属性インスタンス作成されたときに指定された、AssemblyNameFlags フラグ組み合わせを表す整数値を取得します

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

Dim instance As AssemblyFlagsAttribute
Dim value As Integer

value = instance.AssemblyFlags
public int AssemblyFlags { get;
 }
public:
property int AssemblyFlags {
    int get ();
}
/** @property */
public int get_AssemblyFlags ()
public function get AssemblyFlags
 () : int

プロパティ
AssemblyNameFlags フラグビットごとの組み合わせを表す整数値。

解説解説

このプロパティは、下位互換性のために整数値を返します返された値は、使用する前に AssemblyNameFlags 型にキャストます。

使用例使用例

次のコード例は、アセンブリに AssemblyFlagsAttribute を適用する方法、およびフラグ実行時読み込む方法示してます。またこの例では、属性インスタンス作成しAssemblyFlags プロパティ使用してフラグ表示してます。動的アセンブリAssemblyFlagsAttribute適用する方法例については、AssemblyName.Flags プロパティ参照してください

Imports System
Imports System.Reflection

' Specify a combination of AssemblyNameFlags for this 
' assembly.
<Assembly:AssemblyFlagsAttribute( _
       AssemblyNameFlags.EnableJITcompileOptimizer _
    Or AssemblyNameFlags.Retargetable)>

Public Class Example
    Public Shared Sub Main()
        ' Get the currently executing assembly, which is this
        ' assembly.
        Dim thisAsm As Assembly
 = _
             Assembly.GetExecutingAssembly()

        ' Get the AssemblyName for the currently executing
        ' assembly.
        Dim thisAsmName As AssemblyName = thisAsm.GetName(False)

        ' Display the flags that were set for this assembly.
        ListFlags(thisAsmName.Flags)

        ' Create an instance of AssemblyFlagsAttribute with the
        ' same combination of flags that was specified for this
        ' assembly. Note that PublicKey is included automatically
        ' for the assembly, but not for this instance of
        ' AssemblyFlagsAttribute.
        Dim afa As New AssemblyFlagsAttribute(
 _
               AssemblyNameFlags.EnableJITcompileOptimizer _
            Or AssemblyNameFlags.Retargetable)

        ' Get the flags. The property returns an integer, so
        ' the return value must be cast to AssemblyNameFlags.
        Dim anf As AssemblyNameFlags = _
            CType(afa.AssemblyFlags, AssemblyNameFlags)

        ' Display the flags.
        Console.WriteLine()
        ListFlags(anf)
    End Sub

    Private Shared Sub ListFlags(ByVal
 anf As AssemblyNameFlags)

        If anf = AssemblyNameFlags.None Then
            Console.WriteLine("AssemblyNameFlags.None")
        Else
            If 0 <> (anf And AssemblyNameFlags.Retargetable)
 Then _
                Console.WriteLine("AssemblyNameFlags.Retargetable")
            If 0 <> (anf And AssemblyNameFlags.PublicKey)
 Then _
                Console.WriteLine("AssemblyNameFlags.PublicKey")
            If 0 <> (anf And AssemblyNameFlags.EnableJITcompileOptimizer)
 Then _
                Console.WriteLine("AssemblyNameFlags.EnableJITcompileOptimizer")
            If 0 <> (anf And AssemblyNameFlags.EnableJITcompileTracking)
 Then _
                Console.WriteLine("AssemblyNameFlags.EnableJITcompileTracking")
        End If

    End SUb
End Class

' This code example produces the following output:
'
'AssemblyNameFlags.Retargetable
'AssemblyNameFlags.PublicKey
'AssemblyNameFlags.EnableJITcompileOptimizer
'
'AssemblyNameFlags.Retargetable
'AssemblyNameFlags.EnableJITcompileOptimizer
using System;
using System.Reflection;

// Specify a combination of AssemblyNameFlags for this 
// assembly.
[assembly:AssemblyFlagsAttribute(
    AssemblyNameFlags.EnableJITcompileOptimizer |
    AssemblyNameFlags.Retargetable)]

public class Example
{
    public static void Main()
    {
        // Get the currently executing assembly, which is this
        // assembly.
        Assembly thisAsm = Assembly.GetExecutingAssembly();

        // Get the AssemblyName for the currently executing
        // assembly.
        AssemblyName thisAsmName = thisAsm.GetName(false);

        // Display the flags that were set for this assembly.
        ListFlags(thisAsmName.Flags);

        // Create an instance of AssemblyFlagsAttribute with the
        // same combination of flags that was specified for this
        // assembly. Note that PublicKey is included automatically
        // for the assembly, but not for this instance of
        // AssemblyFlagsAttribute.
        AssemblyFlagsAttribute afa = new AssemblyFlagsAttribute(
            AssemblyNameFlags.EnableJITcompileOptimizer |
            AssemblyNameFlags.Retargetable);

        // Get the flags. The property returns an integer, so
        // the return value must be cast to AssemblyNameFlags.
        AssemblyNameFlags anf = (AssemblyNameFlags) afa.AssemblyFlags;

        // Display the flags.
        Console.WriteLine();
        ListFlags(anf);
    }

    private static void
 ListFlags(AssemblyNameFlags anf)
    {
        if (anf == AssemblyNameFlags.None)
        {
            Console.WriteLine("AssemblyNameFlags.None");
        }
        else
        {
            if (0!=(anf & AssemblyNameFlags.Retargetable))
 
                Console.WriteLine("AssemblyNameFlags.Retargetable");
            if (0!=(anf & AssemblyNameFlags.PublicKey)) 
                Console.WriteLine("AssemblyNameFlags.PublicKey");
            if (0!=(anf & AssemblyNameFlags.EnableJITcompileOptimizer))
 
                Console.WriteLine("AssemblyNameFlags.EnableJITcompileOptimizer");
            if (0!=(anf & AssemblyNameFlags.EnableJITcompileTracking))
 
                Console.WriteLine("AssemblyNameFlags.EnableJITcompileTracking");
        }
    }
}

/* This code example produces the following output:

AssemblyNameFlags.Retargetable
AssemblyNameFlags.PublicKey
AssemblyNameFlags.EnableJITcompileOptimizer

AssemblyNameFlags.Retargetable
AssemblyNameFlags.EnableJITcompileOptimizer
*/
using namespace System;
using namespace System::Reflection;

// Specify a combination of AssemblyNameFlags for this
// assembly.
[assembly:AssemblyFlagsAttribute(
     AssemblyNameFlags::EnableJITcompileOptimizer
   | AssemblyNameFlags::Retargetable)];

public ref class Example
{
public:
   static void Main()
   {
      // Get the currently executing assembly, which is this
      // assembly.
      Assembly^ thisAsm = Assembly::GetExecutingAssembly();
      
      // Get the AssemblyName for the currently executing
      // assembly.
      AssemblyName^ thisAsmName = thisAsm->GetName( false );
      
      // Display the flags that were set for this assembly.
      ListFlags( thisAsmName->Flags );
      
      // Create an instance of AssemblyFlagsAttribute with the
      // same combination of flags that was specified for this
      // assembly. Note that PublicKey is included automatically
      // for the assembly, but not for this instance of
      // AssemblyFlagsAttribute.
      AssemblyFlagsAttribute^ afa = gcnew AssemblyFlagsAttribute( 
         static_cast<AssemblyNameFlags> (AssemblyNameFlags::EnableJITcompileOptimizer
                                       | AssemblyNameFlags::Retargetable) );
      
      // Get the flags. The property returns an integer, so
      // the return value must be cast to AssemblyNameFlags.
      AssemblyNameFlags anf = static_cast<AssemblyNameFlags>(afa->AssemblyFlags);
      
      // Display the flags.
      Console::WriteLine();
      ListFlags( anf );
   }

private:
   static void ListFlags( AssemblyNameFlags
 anf )
   {
      if ( anf == AssemblyNameFlags::None )
      {
         Console::WriteLine( L"AssemblyNameFlags.None" );
      }
      else
      {
         if ( 0 != static_cast<Int32>(anf & AssemblyNameFlags::Retargetable)
 )
                  Console::WriteLine( L"AssemblyNameFlags.Retargetable"
 );
         if ( 0 != static_cast<Int32>(anf & AssemblyNameFlags::PublicKey)
 )
                  Console::WriteLine( L"AssemblyNameFlags.PublicKey" );
         if ( 0 != static_cast<Int32>(anf & AssemblyNameFlags::EnableJITcompileOptimizer)
 )
                  Console::WriteLine( L"AssemblyNameFlags.EnableJITcompileOptimizer"
 );
         if ( 0 != static_cast<Int32>(anf & AssemblyNameFlags::EnableJITcompileTracking)
 )
                  Console::WriteLine( L"AssemblyNameFlags.EnableJITcompileTracking"
 );
      }
   }

};

int main()
{
   Example::Main();
}

/* This code example produces the following output:

AssemblyNameFlags.Retargetable
AssemblyNameFlags.PublicKey
AssemblyNameFlags.EnableJITcompileOptimizer

AssemblyNameFlags.Retargetable
AssemblyNameFlags.EnableJITcompileOptimizer
*/
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
AssemblyFlagsAttribute クラス
AssemblyFlagsAttribute メンバ
System.Reflection 名前空間
AssemblyNameFlags


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

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

辞書ショートカット

すべての辞書の索引

「AssemblyFlagsAttribute.AssemblyFlags プロパティ」の関連用語

AssemblyFlagsAttribute.AssemblyFlags プロパティのお隣キーワード
検索ランキング

   

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



AssemblyFlagsAttribute.AssemblyFlags プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS