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"", "")
2 Replies
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
Deleted User 93w4ls0g
Yep this one Preferably I want to keep the property when it is null instead of omitting it
Want results from more Discord servers?
Add your server
More Posts
UserControl issue - UC2 doesn't appear after closing UC1Hello, I started learning about almost a week ago and the past day or two this problem has been buggCompile for i mac osHow do i compile my avalonia app for mac os. the docs are really confusing for me to understand. I aIm trying to open another program but my code isn't workingI made a login system. If login info is correct another program will open if its not it will tell wrCorrect environments handling (appSettings.json)We are using azure DevOps and I wondered what's the best way to handle environments. Option 1: keep Can someone explain how I use MQTTnet and how MQTT in general works?MQTTnet: https://github.com/dotnet/MQTTnet Help would be really appreciated, thank you :)Can't call C++ function in Unity through mono_add_internal_call, with a MissingMethodExceptionthis is my question detail on stackoverflow: https://stackoverflow.com/questions/77478866/how-to-useIssues deserializing data using System.Text.Json when object fields are not known at runtime.I have a bit of an interesting problem deserializing from an external API using System.Text.Json. OnCan someone explain to me how this works``` public bool EliminarClienteXML(BE_Cliente cliente) { acceso = new DatosXML()Can't delete image cuz my own program is using it??You may know this exception error: can't delete the file because another process is using it, can an✅ Converting Time???```cs internal string CheckTimeFormat(string input, string message) { string format = @"hh\:mm\: