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 クラス


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

英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

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

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

   

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



ReadOnlyAttribute.IsReadOnly プロパティのページの著作権

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

©2026 GRAS Group, Inc.RSS