我有这个类:我可以创建一个构造方法的对象,当我创建C#类
public class ContentViewModel
{
public Content Content { get; set; }
public bool UseRowKey {
get {
return Content.PartitionKey.Substring(2, 2) == "05" ||
Content.PartitionKey.Substring(2, 2) == "06";
}
}
public string TempRowKey { get; set; }
}
我现在这样做:有
var vm = new ContentViewModel();
vm.Content = new Content(pk);
vm.Content.PartitionKey = pk;
vm.Content.Created = DateTime.Now;
一些方法,我可以更改我的ContentViewModel,以便我不需要执行最后三条 语句?
当然......只需在构造函数中使用'this.Content'而不是'vm.Content'来构造这三个语句。 – 2012-07-08 05:17:03