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

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

ReadOnlyAttribute.IsReadOnly プロパティ

この属性関連付けられているプロパティ読み取り専用かどうかを示す値を取得します

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

Dim instance As ReadOnlyAttribute
Dim value As Boolean

value = instance.IsReadOnly
public bool IsReadOnly { get;
 }
public:
property bool IsReadOnly {
    bool get ();
}
/** @property */
public boolean get_IsReadOnly ()

プロパティ
この属性関連付けられているプロパティ読み取り専用場合trueプロパティ読み書き可能場合false

使用例使用例

MyProperty読み取り専用かどうか確認するコード例次に示します最初に、次を実行することによって、MyProperty属性取得します

次にmyAttribute を AttributeCollection にある ReadOnlyAttribute の値に設定しプロパティ読み取り専用かどうか確認します

' Gets the attributes for the property.
Dim attributes As AttributeCollection = _
   TypeDescriptor.GetProperties(Me)("MyProperty").Attributes
       
' Checks to see whether the property is read-only.
Dim myAttribute As ReadOnlyAttribute = _
   CType(attributes(GetType(ReadOnlyAttribute)), ReadOnlyAttribute)
   
If myAttribute.IsReadOnly Then
    ' Insert code here.
End If

// Gets the attributes for the property.
AttributeCollection attributes = 
   TypeDescriptor.GetProperties(this)["MyProperty"].Attributes;

// Checks to see whether the property is read-only.
ReadOnlyAttribute myAttribute = 
   (ReadOnlyAttribute)attributes[typeof(ReadOnlyAttribute)];

if(myAttribute.IsReadOnly) {
   // Insert code here.
}

// Gets the attributes for the property.
AttributeCollection^ attributes = TypeDescriptor::GetProperties( this
 )[ "MyProperty" ]->Attributes;

// Checks to see whether the property is read-only.
ReadOnlyAttribute^ myAttribute = dynamic_cast<ReadOnlyAttribute^>(attributes[
 ReadOnlyAttribute::typeid ]);
if ( myAttribute->IsReadOnly )
{
   // Insert code here.
}
// Gets the attributes for the property.
AttributeCollection attributes = TypeDescriptor.GetProperties(this).
    get_Item("MyProperty").get_Attributes();

// Checks to see whether the property is read-only.
ReadOnlyAttribute myAttribute = ((ReadOnlyAttribute)
    (attributes.get_Item(ReadOnlyAttribute.class.ToType())));

if (myAttribute.get_IsReadOnly()) {
    // Insert code here.
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ReadOnlyAttribute クラス
ReadOnlyAttribute メンバ
System.ComponentModel 名前空間
ReadOnlyAttribute クラス
Attribute
PropertyDescriptor クラス
AttributeCollection クラス
PropertyDescriptorCollection クラス



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「ReadOnlyAttribute.IsReadOnly プロパティ」の関連用語

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

   

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



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

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

©2026 GRAS Group, Inc.RSS