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

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

Type.Attributes プロパティ

Type関連付けられている属性取得します

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

Dim instance As Type
Dim value As TypeAttributes

value = instance.Attributes
public TypeAttributes Attributes { get; }
public:
virtual property TypeAttributes Attributes {
    TypeAttributes get () sealed;
}
/** @property */
public final TypeAttributes get_Attributes ()

プロパティ
Type属性セットを表す TypeAttributes オブジェクト。ただし、Typeジェネリック型パラメータを表す場合、値は未指定

解説解説

現在の Type構築ジェネリック型表している場合、このプロパティジェネリック型属性返します。たとえば、MyGenericClass<int> (Visual Basic の場合MyGenericClass(Of Integer)) に対して返される属性は、MyGenericClass<T> (Visual Basic の場合MyGenericClass(Of T)) の属性です。

現在の Typeジェネリック型パラメータ表している場合、つまり、IsGenericParameter プロパティtrue返す場合は、このプロパティによって返される TypeAttributes 値は未指定です。

使用例使用例

Type.Attributes プロパティ使用する例を次に示します

Imports System
Imports System.Reflection

Public Class Class1
    Protected t As Type
    Public Sub Method1()
        If t.Attributes And TypeAttributes.ClassSemanticsMask
 = TypeAttributes.Interface Then
            Console.WriteLine("t is an interface.")
        End If
        If t.Attributes And TypeAttributes.Public
 <> 0 Then
            Console.WriteLine("t is public.")
        End If
    End Sub 'Method1
End Class 'Class1
using System;
using System.Reflection;

public class Class1 
{
    protected Type t;
    public void Method1() 
    {
        if ((t.Attributes & TypeAttributes.ClassSemanticsMask)
 == TypeAttributes.Interface)
            Console.WriteLine ("t is an interface.");
        if ((t.Attributes & TypeAttributes.Public) != 0)
            Console.WriteLine ("t is public.");
    }
}
#using <System.DLL>

using namespace System;
using namespace System::Reflection;
ref class Sample
{
private:
   void Method( Type^ t )
   {
      if ( (t->Attributes & TypeAttributes::ClassSemanticsMask)
 == TypeAttributes::Interface )
            Console::WriteLine(  "t is an interface." );

      if ( (t->Attributes & TypeAttributes::Public) !=
 (TypeAttributes)0 )
            Console::WriteLine(  "t is public." );
   }

};

import System.*;
import System.Reflection.*;

public class Class1
{
    protected Type t;    
    public void Method1()
    {
        if ((t.get_Attributes() & TypeAttributes.ClassSemanticsMask)
            == TypeAttributes.Interface  ) {
                Console.WriteLine("t is an interface.");
        }
        if (((int)(t.get_Attributes() &
 TypeAttributes.Public)) != 0  ) {
            Console.WriteLine("t is public.");
        }
    } //Method1
} //Class1
if ((t.Attributes & TypeAttributes.ClassSemanticsMask) ==
 TypeAttributes.Interface)
    Console.WriteLine ("t is an Interface");
if ((t.Attributes & TypeAttributes.Public) != 0)
    Console.WriteLine ("t is public");
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Type クラス
Type メンバ
System 名前空間
GetAttributeFlagsImpl
TypeAttributes

_Type.Attributes プロパティ

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

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

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

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

Dim instance As _Type
Dim value As TypeAttributes

value = instance.Attributes
TypeAttributes Attributes { get; }
property TypeAttributes Attributes {
    TypeAttributes get ();
}
/** @property */
TypeAttributes get_Attributes ()
function get Attributes () : TypeAttributes

プロパティ
Type属性セットを表す TypeAttributes オブジェクト。ただし、Typeジェネリック型パラメータを表す場合、値は未指定

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「Type.Attributes プロパティ」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS