本文整理汇总了C#中Mono.CSharp.TypeParameter.ResolveConstraints方法的典型用法代码示例。如果您正苦于以下问题:C# TypeParameter.ResolveConstraints方法的具体用法?C# TypeParameter.ResolveConstraints怎么用?C# TypeParameter.ResolveConstraints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.TypeParameter
的用法示例。
在下文中一共展示了TypeParameter.ResolveConstraints方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddPartialConstraints
//
// This is called for each part of a partial generic type definition.
//
// If partial type parameters constraints are not null and we don't
// already have constraints they become our constraints. If we already
// have constraints, we must check that they're the same.
//
public bool AddPartialConstraints (TypeContainer part, TypeParameter tp)
{
if (builder == null)
throw new InvalidOperationException ();
var new_constraints = tp.constraints;
if (new_constraints == null)
return true;
// TODO: could create spec only
//tp.Define (null, -1, part.Definition);
tp.spec.DeclaringType = part.Definition;
if (!tp.ResolveConstraints (part))
return false;
if (constraints != null)
return spec.HasSameConstraintsDefinition (tp.Type);
// Copy constraint from resolved part to partial container
spec.SpecialConstraint = tp.spec.SpecialConstraint;
spec.InterfacesDefined = tp.spec.InterfacesDefined;
spec.TypeArguments = tp.spec.TypeArguments;
spec.BaseType = tp.spec.BaseType;
return true;
}
示例2: AddPartialConstraints
//
// This is called for each part of a partial generic type definition.
//
// If partial type parameters constraints are not null and we don't
// already have constraints they become our constraints. If we already
// have constraints, we must check that they're the same.
//
public bool AddPartialConstraints(TypeContainer part, TypeParameter tp)
{
if (builder == null)
throw new InvalidOperationException ();
var new_constraints = tp.constraints;
if (new_constraints == null)
return true;
// TODO: could create spec only
//tp.Define (null, -1, part.Definition);
tp.spec.DeclaringType = part.Definition;
if (!tp.ResolveConstraints (part))
return false;
if (constraints != null)
return spec.HasSameConstraintsDefinition (tp.Type);
constraints = new_constraints;
return true;
}