When I create a proxy to my service, some extra parameters are added as XmlIgnoreAttribute. For example:
Interface method contract declaration:
[OperationContract]
void AddToList(int integerToAdd);
Method implementation:
public void AddToList(int integerToAdd) {
intList.Add(integerToAdd);
}
Now, here is what this method actually looks like when I generate a proxy to my service dynamically:
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/IService1/AddToList", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void AddToList(int integerToAdd, [System.Xml.Serialization.XmlIgnoreAttribute()] bool integerToAddSpecified)
{
this.Invoke("AddToList", new object[] {integerToAdd, integerToAddSpecified});
}
If I have the ParameterInfo object for this parameter, how can I check that this parameter has been marked as XmlIgnoreAttribute?
If this is not a good way to check for these auto-generated parameters, then is there another (better) way to check for them?
Bonus: Will there ever be a case where non-boolean types are generated and marked as XmlIgnoreAttribute?
I assume you would use ParameterInfo.GetCustomAttributes() ?
(1) I’m not sure why you’re checking these parameters anything so not sure if it’s good/better. (2) Not sure about the second question. I assume this is from VS code gen (
svcutil?) Maybe some MSFT’s who’s designed this may know better.