只是注意到4.2.30版本不包括
protected bool Set<T>(
ref T field,
T newValue,
[CallerMemberName] string propertyName = null)
{
return Set(propertyName, ref field, newValue);
}
由于汇编常数," cmnattr"未定义为释放模式中的构建参数。有什么想法是出于错误或故意吗?
谢谢。
我今天偶然发现了这一点,也想将[callermembername]与mvvmlight提供的一些方法一起使用。劳伦特(Laurent)在此问题之前给出了一个答案,但似乎他还没有时间解决这个问题。因此,一个选择是下载源,设置符号并在发布模式下重建。我自己没有尝试过,我不确定这是否会有其他影响。
目前的另一个解决方法是扩展ViewModelBase,并使用[Callermembername]添加所需方法的变体。例如。在您的情况下:
public class ViewModelBaseCustom : ViewModelBase
{
public bool Set<T>(ref T field, T value, [CallerMemberName] string propertyName = "")
{
return this.Set(propertyName, ref field, value);
}
}
,然后使用Laurent的原始版本的自定义版本,直到更新MVVMLIGHT。