本文整理汇总了C#中ISetting.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ISetting.GetType方法的具体用法?C# ISetting.GetType怎么用?C# ISetting.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISetting
的用法示例。
在下文中一共展示了ISetting.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSettingsAttribute
private static SettingAttribute GetSettingsAttribute(ISetting setting)
{
var settingsAttribute = AttributeRetrieval.GetAttribute<SettingAttribute>(setting.GetType());
if (settingsAttribute == null)
{
throw new InvalidOperationException(string.Format("ISetting \"{0}\", does not include the SettingAttribute.", setting.GetType().Name));
}
return settingsAttribute;
}
示例2: GetSettingSerializerData
public static SettingSerializerData GetSettingSerializerData(ISetting setting)
{
var settingType = setting.GetType();
var settingSerializerData = new SettingSerializerData();
FillSettingAttribute(settingSerializerData, setting, settingType);
FillSettingParameterAttributes(settingSerializerData, setting, settingType);
return settingSerializerData;
}
示例3: Validate
public static bool Validate(ISetting setting)
{
var settingType = setting.GetType();
var settingParameters =
settingType.GetProperties()
.Where(p => AttributeRetrieval.GetAttributes<ValidateAttribute>(p).Any())
.Select(p => new { Info = p, Value = p.GetValue(setting) })
.ToList();
return settingParameters.All(p => Validate(settingType, p.Info, p.Value));
}