mscorlib(4.0.0.0) API with additions
SoapAttributes.cs
2 using System.Reflection;
3 
5 {
7  public class SoapAttributes
8  {
9  private bool soapIgnore;
10 
11  private SoapTypeAttribute soapType;
12 
13  private SoapElementAttribute soapElement;
14 
15  private SoapAttributeAttribute soapAttribute;
16 
17  private SoapEnumAttribute soapEnum;
18 
19  private object soapDefaultValue;
20 
21  internal SoapAttributeFlags SoapFlags
22  {
23  get
24  {
25  SoapAttributeFlags soapAttributeFlags = (SoapAttributeFlags)0;
26  if (soapElement != null)
27  {
28  soapAttributeFlags |= SoapAttributeFlags.Element;
29  }
30  if (soapAttribute != null)
31  {
32  soapAttributeFlags |= SoapAttributeFlags.Attribute;
33  }
34  if (soapEnum != null)
35  {
36  soapAttributeFlags |= SoapAttributeFlags.Enum;
37  }
38  if (soapType != null)
39  {
40  soapAttributeFlags |= SoapAttributeFlags.Type;
41  }
42  return soapAttributeFlags;
43  }
44  }
45 
49  {
50  get
51  {
52  return soapType;
53  }
54  set
55  {
56  soapType = value;
57  }
58  }
59 
63  {
64  get
65  {
66  return soapEnum;
67  }
68  set
69  {
70  soapEnum = value;
71  }
72  }
73 
77  public bool SoapIgnore
78  {
79  get
80  {
81  return soapIgnore;
82  }
83  set
84  {
85  soapIgnore = value;
86  }
87  }
88 
92  {
93  get
94  {
95  return soapElement;
96  }
97  set
98  {
99  soapElement = value;
100  }
101  }
102 
106  {
107  get
108  {
109  return soapAttribute;
110  }
111  set
112  {
113  soapAttribute = value;
114  }
115  }
116 
119  public object SoapDefaultValue
120  {
121  get
122  {
123  return soapDefaultValue;
124  }
125  set
126  {
127  soapDefaultValue = value;
128  }
129  }
130 
132  public SoapAttributes()
133  {
134  }
135 
139  {
140  object[] customAttributes = provider.GetCustomAttributes(inherit: false);
141  for (int i = 0; i < customAttributes.Length; i++)
142  {
143  if (customAttributes[i] is SoapIgnoreAttribute || customAttributes[i] is ObsoleteAttribute)
144  {
145  soapIgnore = true;
146  break;
147  }
148  if (customAttributes[i] is SoapElementAttribute)
149  {
150  soapElement = (SoapElementAttribute)customAttributes[i];
151  }
152  else if (customAttributes[i] is SoapAttributeAttribute)
153  {
154  soapAttribute = (SoapAttributeAttribute)customAttributes[i];
155  }
156  else if (customAttributes[i] is SoapTypeAttribute)
157  {
158  soapType = (SoapTypeAttribute)customAttributes[i];
159  }
160  else if (customAttributes[i] is SoapEnumAttribute)
161  {
162  soapEnum = (SoapEnumAttribute)customAttributes[i];
163  }
164  else if (customAttributes[i] is DefaultValueAttribute)
165  {
166  soapDefaultValue = ((DefaultValueAttribute)customAttributes[i]).Value;
167  }
168  }
169  if (soapIgnore)
170  {
171  soapElement = null;
172  soapAttribute = null;
173  soapType = null;
174  soapEnum = null;
175  soapDefaultValue = null;
176  }
177  }
178  }
179 }
Specifies the default value for a property.
object [] GetCustomAttributes(Type attributeType, bool inherit)
Returns an array of custom attributes defined on this member, identified by type, or an empty array i...
Represents a collection of attribute objects that control how the T:System.Xml.Serialization....
Marks the program elements that are no longer in use. This class cannot be inherited.
Instructs the T:System.Xml.Serialization.XmlSerializer not to serialize the public field or public re...
Controls how the T:System.Xml.Serialization.XmlSerializer serializes an enumeration member.
Definition: __Canon.cs:3
SoapAttributes()
Initializes a new instance of the T:System.Xml.Serialization.SoapAttributes class.
bool SoapIgnore
Gets or sets a value that specifies whether the T:System.Xml.Serialization.XmlSerializer serializes a...
Specifies that the public member value be serialized by the T:System.Xml.Serialization....
SoapEnumAttribute SoapEnum
Gets or sets an object that specifies how the T:System.Xml.Serialization.XmlSerializer serializes a S...
object SoapDefaultValue
Gets or sets the default value of an XML element or attribute.
SoapElementAttribute SoapElement
Gets or sets a T:System.Xml.Serialization.SoapElementAttribute to override.
SoapAttributeAttribute SoapAttribute
Gets or sets the T:System.Xml.Serialization.SoapAttributeAttribute to override.
SoapAttributes(ICustomAttributeProvider provider)
Initializes a new instance of the T:System.Xml.Serialization.SoapAttributes class using the specified...
Specifies that the T:System.Xml.Serialization.XmlSerializer must serialize the class member as an enc...
Attribute()
Initializes a new instance of the T:System.Attribute class.
Definition: Attribute.cs:1016
Controls the schema generated by the T:System.Xml.Serialization.XmlSerializer when a class instance i...
SoapTypeAttribute SoapType
Gets or sets an object that instructs the T:System.Xml.Serialization.XmlSerializer how to serialize a...
Provides custom attributes for reflection objects that support them.