Skip to content

@distantcam /AfterWeaving.cs
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
INPC Weaver example
public class SomeViewModel : INotifyPropertyChanged
{
private string <URL>k__BackingField;
public event PropertyChangedEventHandler PropertyChanged;
public string URL
{
[CompilerGenerated]
get
{
return this.<URL>k__BackingField;
}
[CompilerGenerated]
set
{
if (string.Equals(this.<URL>k__BackingField, value, StringComparison.Ordinal))
{
return;
}
this.<URL>k__BackingField = value;
this.OnPropertyChanged("HostName");
this.OnPropertyChanged("URL");
}
}
public string HostName
{
get
{
string result;
try
{
Uri typedURL = new Uri(this.URL);
result = typedURL.Host;
}
catch (UriFormatException)
{
result = "";
}
return result;
}
}
public virtual void OnPropertyChanged(string propertyName)
{
PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if (propertyChanged != null)
{
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
public class SomeViewModel : INotifyPropertyChanged
{
public string URL { get; set; }
public string HostName
{
get
{
try
{
var typedURL = new Uri(URL);
return typedURL.Host;
}
catch (UriFormatException)
{
return "";
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.