本文整理汇总了C#中ResolveResult.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ResolveResult.GetType方法的具体用法?C# ResolveResult.GetType怎么用?C# ResolveResult.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResolveResult
的用法示例。
在下文中一共展示了ResolveResult.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsEqualResolveResult
bool IsEqualResolveResult(ResolveResult rr1, ResolveResult rr2)
{
if (rr1 == rr2)
return true;
if (rr1 == null || rr2 == null)
return false;
if (rr1.GetType() != rr2.GetType())
return false;
bool eq = true;
foreach (var property in rr1.GetType().GetProperties()) {
object val1 = property.GetValue(rr1, null);
object val2 = property.GetValue(rr2, null);
eq &= Compare(val1, val2, property.PropertyType);
}
foreach (var field in rr1.GetType().GetFields()) {
object val1 = field.GetValue(rr1);
object val2 = field.GetValue(rr2);
eq &= Compare(val1, val2, field.FieldType);
}
return eq;
}
示例2: Visit
Value Visit(ResolveResult result)
{
if (result is ErrorResolveResult) {
var err = (ErrorResolveResult)result;
if (!string.IsNullOrWhiteSpace(err.Message))
throw new GetValueException(err.Message);
}
if (result.IsError)
throw new GetValueException("Unknown error");
if (result.ConstantValue == null && result.Type.Equals(SpecialType.NullType))
return Eval.CreateValue(evalThread, null);
throw new GetValueException("Unsupported language construct: " + result.GetType().Name);
}
示例3: Visit
Value Visit(ResolveResult result)
{
if (result is ErrorResolveResult) {
var err = (ErrorResolveResult)result;
if (!string.IsNullOrWhiteSpace(err.Message))
throw new GetValueException(err.Message);
}
if (result.IsError)
throw new GetValueException("Unknown error");
throw new GetValueException("Unsupported language construct: " + result.GetType().Name);
}