本文整理汇总了C#中System.Reflection.PropertyInfo.Single方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyInfo.Single方法的具体用法?C# PropertyInfo.Single怎么用?C# PropertyInfo.Single使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.PropertyInfo
的用法示例。
在下文中一共展示了PropertyInfo.Single方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyFromModel
public void CopyFromModel(PropertyInfo vm, object model, PropertyInfo[] modelProps)
{
var ckf = vm.GetAttribute<FieldInfoAttribute>().CheckboxField;
var ckpi = modelProps.Single(ss => ss.Name == ckf);
var ck = ckpi.GetValue(model, null) as bool?;
var m = modelProps.FirstOrDefault(mm => mm.Name == vm.Name);
Number = ((string)m.GetValue(model, null)).FmtFone();
ReceiveText = ck ?? false;
}
示例2: GetValue
protected virtual object GetValue(PropertyInfo[] propertiesOnEvent, IEvent @event, EventMetaData metaData)
{
var property = propertiesOnEvent.Single(pi => pi.Name.Equals(_name, StringComparison.InvariantCultureIgnoreCase));
var value = property.GetValue(@event, null);
if (value is Guid)
return ((Guid)value).ToByteArray();
if (value is EventSourceVersion)
return ((EventSourceVersion)value).Combine();
return value;
}
示例3: CopyToModel
public List<ChangeDetail> CopyToModel(PropertyInfo vm, object model, PropertyInfo[] modelProps, bool track)
{
var changes = new List<ChangeDetail>();
var ckf = vm.GetAttribute<FieldInfoAttribute>().CheckboxField;
var ckpi = modelProps.Single(mm => mm.Name == ckf);
if (track)
{
model.UpdateValue(changes, vm.Name, Number.GetDigits());
model.UpdateValue(changes, ckf, ReceiveText);
return changes;
}
var ci = modelProps.FirstOrDefault(ss => ss.Name == vm.Name);
Debug.Assert(ci != null, "ci != null");
ci.SetValue(model, Number.GetDigits(), null);
ckpi.SetValue(model, ReceiveText, null);
return changes;
}
示例4: CopyToModel
public string CopyToModel(PropertyInfo vm, object model, PropertyInfo[] modelProps, bool track)
{
var ckf = vm.GetAttribute<FieldInfoAttribute>().CheckboxField;
var ckpi = modelProps.Single(mm => mm.Name == ckf);
if (track)
{
var changes = new StringBuilder();
model.UpdateValue(changes, vm.Name, Address);
model.UpdateValue(changes, ckf, Send);
return changes.ToString();
}
var ci = modelProps.FirstOrDefault(ss => ss.Name == vm.Name);
Debug.Assert(ci != null, "ci != null");
ci.SetValue(model, Address, null);
ckpi.SetValue(model, Send, null);
return string.Empty;
}