public string Source
{
get
{
/*
if ( Source == null ){
return string . Empty;
} else {
return Source;
}
*/
return Source ?? string.Empty;
}
set
{
/*
if ( Source == null ) {
Source = string . Empty;
} else {
if ( Source == value ) {
Source = Source;
} else {
Source = value;
}
}
*/
Source == value ? Source : value ?? string.Empty;
RaisePropertyChanged ( "Source" );
} …Run Code Online (Sandbox Code Playgroud) 可能重复:
什么是"??"运算符?
什么是"??" 运算符在表达式中执行?
public NameValueCollection Metadata
{
get { return metadata ?? (metadata = new NameValueCollection()); }
}
Run Code Online (Sandbox Code Playgroud)