BrowsableAttribute.Browsable プロパティ
名前空間: System.ComponentModel
アセンブリ: System (system.dll 内)
構文

MyProperty が参照できるかどうかを確認する例を次に示します。最初に、次の方法で MyProperty の属性を取得します。
次に、myAttribute を AttributeCollection 内の BrowsableAttribute の値に設定し、プロパティが参照できるかどうかを確認します。
' Gets the attributes for the property. Dim attributes As AttributeCollection = TypeDescriptor.GetProperties(Me)("MyProperty").Attributes ' Checks to see if the property is browsable. Dim myAttribute As BrowsableAttribute = CType(attributes(GetType(BrowsableAttribute)), BrowsableAttribute) If myAttribute.Browsable Then ' Insert code here. End If
// Gets the attributes for the property. AttributeCollection attributes = TypeDescriptor.GetProperties(this)["MyProperty"].Attributes; // Checks to see if the property is browsable. BrowsableAttribute myAttribute = (BrowsableAttribute)attributes[typeof(BrowsableAttribute)]; if(myAttribute.Browsable) { // Insert code here. }
// Gets the attributes for the property. AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; // Checks to see if the property is browsable. BrowsableAttribute^ myAttribute = dynamic_cast<BrowsableAttribute^>(attributes[ BrowsableAttribute::typeid ]); if ( myAttribute->Browsable ) { // Insert code here. }
// Gets the attributes for the property. AttributeCollection attributes = TypeDescriptor.GetProperties(this).get_Item("MyProperty"). get_Attributes(); // Checks to see if the property is browsable. BrowsableAttribute myAttribute = ((BrowsableAttribute)(attributes.get_Item( BrowsableAttribute.class.ToType()))); if (myAttribute.get_Browsable()) { // Insert code here. } } //Method
// Gets the attributes for the property. var attributes : AttributeCollection = TypeDescriptor.GetProperties(this)["MyProperty"].Attributes; // Checks to see if the property is browsable. var myAttribute : BrowsableAttribute = BrowsableAttribute(attributes[BrowsableAttribute]); if(myAttribute.Browsable) { Console.WriteLine("MyProperty is browsable."); }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- BrowsableAttribute.Browsable プロパティのページへのリンク