Deleted User 93w4ls0g
XML Serialization: How to serialize a property with a null value without xsi:nill attribute?
I have a property the following code:
[Serializable()]
public class MyClass
{
[XmlElement(ElementName = "MyProperty")]
public decimal? MyProperty
{
get;
set;
}
}
At the minute, when I serialize it I get:
<MyProperty xsi:nil="true" />
But I want to get this:
<MyProperty />
What is the best way of achieving this? I do not want to do any post-processing such as myXML.Replace("xsi:nil="true"", "")
5 replies
❔ Local Environment throwing exception when calling HttpClient.GetStringAsync
I am running the below code via Visual Studio Code, and a "The requested address is not valid in its context. (www.mypublicwebsite.com:443)" exception is thrown, an inner SocketException with error code 10049 is thrown too but I cannot figure out why it is called, I believe my local is setup to allow the program to connect to public internet sites.
using (var httpClient = new HttpClient()) {
await httpClient.GetStringAsync("https://www.mypublicwebsite.com");
}
15 replies