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

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

_PropertyInfo.Attributes プロパティ

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

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

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

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

Dim instance As _PropertyInfo
Dim value As PropertyAttributes

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

プロパティ
このプロパティ属性

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

PropertyInfo.Attributes プロパティ

このプロパティ属性取得します

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

Public MustOverride ReadOnly
 Property Attributes As PropertyAttributes
Dim instance As PropertyInfo
Dim value As PropertyAttributes

value = instance.Attributes
public abstract PropertyAttributes Attributes { get;
 }
public:
virtual property PropertyAttributes Attributes {
    PropertyAttributes get () abstract;
}
/** @property */
public abstract PropertyAttributes get_Attributes ()

プロパティ
このプロパティ属性

解説解説
使用例使用例

指定したプロパティ属性表示する例を次に示します

Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic

Public Class Myproperty
    Private myCaption As String
 = "Default caption"

    Public Property Caption() As
 String
        Get
            Return myCaption
        End Get
        Set(ByVal Value As
 String)
            If myCaption <> value Then
                myCaption = value
            End If
        End Set
    End Property
End Class 'Myproperty

Class Mypropertyinfo

    Public Shared Function
 Main() As Integer
        Console.WriteLine(ControlChars.CrLf & "Reflection.PropertyInfo")

        ' Define a property.
        Dim Myproperty As New
 Myproperty()
        Console.Write(ControlChars.CrLf & "Myproperty.Caption
 = " & _
           Myproperty.Caption)

        ' Get the type and PropertyInfo.
        Dim MyType As Type = Type.GetType("Myproperty")
        Dim Mypropertyinfo As PropertyInfo
 = MyType.GetProperty("Caption")

        ' Get and display the attributes property.
        Dim Myattributes As PropertyAttributes
 = Mypropertyinfo.Attributes

        Console.Write(ControlChars.CrLf & "PropertyAttributes
 - " & _
           Myattributes.ToString())

        Return 0
    End Function
End Class
using System;
using System.Reflection;
 
public class Myproperty
{
    private string caption = "Default
 caption";
    public string Caption
    {
        get{return caption;}
        set {if(caption!=value) {caption =
 value;}
        }
    }
}
  
class Mypropertyinfo
{
    public static int Main(string[]
 args)
    {
        Console.WriteLine("\nReflection.PropertyInfo");
  
        // Define a property.
        Myproperty Myproperty = new Myproperty();
        Console.Write("\nMyproperty.Caption = " + Myproperty.Caption);
  
        // Get the type and PropertyInfo.
        Type MyType = Type.GetType("Myproperty");
        PropertyInfo Mypropertyinfo = MyType.GetProperty("Caption");
  
        // Get and display the attributes property.
        PropertyAttributes Myattributes = Mypropertyinfo.Attributes;
      
        Console.Write("\nPropertyAttributes - " + Myattributes.ToString());
  
        return 0;
    }
}
using namespace System;
using namespace System::Reflection;
public ref class Myproperty
{
private:
   String^ caption;

public:
   Myproperty()
      : caption( "Default caption" )
   {}


   property String^ Caption 
   {
      String^ get()
      {
         return caption;
      }

      void set( String^ value )
      {
         if ( caption != value )
         {
            caption = value;
         }
      }

   }

};

int main()
{
   Console::WriteLine( "\nReflection.PropertyInfo" );
   
   // Define a property.
   Myproperty^ myproperty = gcnew Myproperty;
   Console::Write( "\nMyproperty->Caption = {0}", myproperty->Caption
 );
   
   // Get the type and PropertyInfo.
   Type^ MyType = Type::GetType( "Myproperty" );
   PropertyInfo^ Mypropertyinfo = MyType->GetProperty( "Caption" );
   
   // Get and display the attributes property.
   PropertyAttributes Myattributes = Mypropertyinfo->Attributes;
   Console::Write( "\nPropertyAttributes - {0}", Myattributes );
   return 0;
}

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

public class Myproperty
{
    private String caption = "Default caption";

    /** @property 
     */
    public String get_Caption()
    {
        return caption ;
    } //get_Caption

    /** @property 
     */
    public void set_Caption(String value)
    {
        if (caption != value) {
            caption = value;
        }
} //set_Caption
} //Myproperty

class Mypropertyinfo
{
    public static void main(String[]
 args)
    {
        Console.WriteLine("\nReflection.PropertyInfo");

        // Define a property.
        Myproperty myproperty =  new Myproperty();
        Console.Write(("\nMyproperty.Caption = " + myproperty.get_Caption()));

        // Get the type and PropertyInfo.
        Type myType = Type.GetType("Myproperty");
        PropertyInfo mypropertyinfo = myType.GetProperty("Caption");

        // Get and display the attributes property.
        PropertyAttributes myattributes = mypropertyinfo.get_Attributes();
        Console.Write(("\nPropertyAttributes - " + myattributes.ToString()));
    } //main
} //Mypropertyinfo
//Make a property, then display the PropertyInfo
import System;
import System.Reflection;

public class Myproperty
{
   private var caption : String = "Default
 caption";
   public function get Caption()
 : String {
       return caption;
   }
   public function set Caption(value:String)
 {
       if(caption!=value) caption = value;
   }
}
 
class Mypropertyinfo
{
   public static function
 Main() : void
   {
      Console.WriteLine("\nReflection.PropertyInfo");
 
      //Build a property
      var myproperty : Myproperty = new Myproperty();
      Console.Write("\nMyproperty.Caption = " + myproperty.Caption);
 
      //Get the type and PropertyInfo
      var MyType : Type = Type.GetType("Myproperty");
      var Mypropertyinfo : PropertyInfo = MyType.GetProperty("Caption");
 
      //Get and display the attributes property
      var Myattributes : PropertyAttributes = Mypropertyinfo.Attributes;
     
      Console.Write("\nPropertyAttributes - " + Myattributes.ToString());
 
   }
}
Mypropertyinfo.Main();
/*
Produces the following output

Reflection.PropertyInfo
Myproperty.Caption = Default caption
PropertyAttributes - None
*/
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2024 GRAS Group, Inc.RSS