My code includes two Classes, ImmMessage and Notify, I need to add an instance of ImmMessage to Notify as shown below. classes code was generated by xsd2code which defined In class Notify element "private System.Xml.XmlElement[] anyField" and it would not accept ImmMessage which is not of the same type, How do I resolve that conflict?
I
I am getting an error message, Please help
ImmMessage
I
Code:
mmMessage _ImmMessage = new ImmMessage();
Notify _Notify = new Notify();
.
.
.
_Notify.Any.Add(_ImmMessage);
I am getting an error message, Please help
Code:
The best overloaded method match for
'System.Collections.Generic.List<System.Xml.XmlElement>.Add(System.Xml.XmlElement)' has some invalid arguments
Code:
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="[URL unfurl="true"]http://nice.com/NICEPerform3/Integrations/V1/HTTP-XML")[/URL]]
[System.Xml.Serialization.XmlRootAttribute(Namespace="[URL unfurl="true"]http://nice.com/NICEPerform3/Integrations/V1/HTTP-XML",[/URL] IsNullable=false)]
public partial class Notify {
private System.Xml.XmlElement[] anyField;
/// <remarks/>
[System.Xml.Serialization.XmlAnyElementAttribute()]
public System.Xml.XmlElement[] Any {
get {
return this.anyField;
}
set {
this.anyField = value;
}
}
}
ImmMessage
Code:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.3082")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "[URL unfurl="true"]http://nice.com/NICEPerform3/Integrations/V1/IMM")[/URL]]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "[URL unfurl="true"]http://nice.com/NICEPerform3/Integrations/V1/IMM",[/URL] IsNullable = false)]
[System.Runtime.Serialization.DataContractAttribute(Name = "ImmMessage", Namespace = "[URL unfurl="true"]http://nice.com/NICEPerform3/Integrations/V1/IMM")[/URL]]
public partial class ImmMessage : EntityBase<ImmMessage>
{
private static System.Xml.Serialization.XmlSerializer serializer;
private static System.Xml.Serialization.XmlSerializer Serializer
{
get
{
if ((serializer == null))
{
serializer = new System.Xml.Serialization.XmlSerializer(typeof(ImmMessage));
}
return serializer;
}
}
[System.Xml.Serialization.XmlElementAttribute("agentStateMessage", typeof(AgentStatusMessage))]
[System.Xml.Serialization.XmlElementAttribute("callStateMessage", typeof(CallStateMessage))]
[System.Xml.Serialization.XmlElementAttribute("devicePresenceMessage", typeof(DevicePresenceMessage))]
[System.Runtime.Serialization.DataMemberAttribute()]
public object Item { get; set; }
}