Skip to content

Instantly share code, notes, and snippets.

@sclarson
Created May 2, 2012 21:37
Show Gist options
  • Save sclarson/2580699 to your computer and use it in GitHub Desktop.
Save sclarson/2580699 to your computer and use it in GitHub Desktop.
Url Serialization
[XmlIgnore]
public Uri Url { get; set; }
[XmlAttribute("uri")]
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public string UriString
{
get { return Url == null ? null : Url.ToString(); }
set { Url = value == null ? null : new Uri(value); }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment