作者:VB.NET开发
项目:System.ComponentMode
' Gets the attributes for the property.
Dim attributes As AttributeCollection = _
TypeDescriptor.GetProperties(Me)("MyProperty").Attributes
' Checks to see if the value of the DesignerSerializationVisibilityAttribute
' is set to Content.
If attributes(GetType(DesignerSerializationVisibilityAttribute)).Equals( _
DesignerSerializationVisibilityAttribute.Content) Then
' Insert code here.
End If
' This is another way to see whether the property is marked as serializing content.
Dim myAttribute As DesignerSerializationVisibilityAttribute = _
CType(attributes(GetType(DesignerSerializationVisibilityAttribute)), _
DesignerSerializationVisibilityAttribute)
If myAttribute.Visibility = DesignerSerializationVisibility.Content Then
' Insert code here.
End If