本文整理汇总了C#中System.Dynamic.DynamicMetaObject.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# DynamicMetaObject.GetType方法的具体用法?C# DynamicMetaObject.GetType怎么用?C# DynamicMetaObject.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Dynamic.DynamicMetaObject
的用法示例。
在下文中一共展示了DynamicMetaObject.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FallbackGetIndex
public override DynamicMetaObject FallbackGetIndex(DynamicMetaObject target, DynamicMetaObject[] indexes, DynamicMetaObject errorSuggestion)
{
if (!target.HasValue)
return Defer(target);
foreach (var index in indexes)
if (!index.HasValue)
return Defer(index);
var targetType = target.LimitType;
if (target.GetType() != typeof(TotemType.MetaObject))
{
foreach (var type in _context.Types)
{
if (type.Handles(targetType))
{
return type.GetMetaObject(target.Expression, target.Restrictions, target.Value).BindGetIndex(this, indexes);
}
}
}
return errorSuggestion ?? TotemProtocol.TypeError(
this,
"Cannot get index of '{0}'",
target
);
}
示例2: FallbackGetMember
public override DynamicMetaObject FallbackGetMember(DynamicMetaObject target, DynamicMetaObject errorSuggestion)
{
if (!target.HasValue)
return Defer(target);
var targetType = target.LimitType;
if (target.GetType() != typeof(TotemType.MetaObject))
{
foreach (var type in _context.Types)
{
if (type.Handles(targetType))
return type.GetMetaObject(target.Expression, target.Restrictions, target.Value).BindGetMember(this);
}
}
return errorSuggestion ?? TotemProtocol.TypeError(
this,
string.Format("{0} has no property {1}", "{0}", Name),
target
);
}