Created
March 18, 2025 17:09
-
-
Save dontpaniclabsgists/f9d61ca23cdbb5347cf0f21a52b9e91c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Person | |
{ | |
[XmlElement(ElementName = "First")] | |
public string FirstName { get; set; } | |
[XmlElement(ElementName = "Last")] | |
public string LastName { get; set; } | |
public int Age { get; set; } | |
[XmlElement(IsNullable = true)] | |
public string Email { get; set; } | |
public PhoneNumber[] PhoneNumbers { get; set; } | |
public bool ShouldSerializeAge() | |
{ | |
// Only serialize Age if 18 or older | |
return Age >= 18; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment