本文整理汇总了C#中Microsoft.CSharp.RuntimeBinder.Semantics.AggregateType.isDelegateType方法的典型用法代码示例。如果您正苦于以下问题:C# AggregateType.isDelegateType方法的具体用法?C# AggregateType.isDelegateType怎么用?C# AggregateType.isDelegateType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CSharp.RuntimeBinder.Semantics.AggregateType
的用法示例。
在下文中一共展示了AggregateType.isDelegateType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFixedDelegateParameters
////////////////////////////////////////////////////////////////////////////////
private TypeArray GetFixedDelegateParameters(AggregateType pDelegateType)
{
Debug.Assert(pDelegateType.isDelegateType());
// We have a delegate where the input types use no unfixed parameters. Create
// a substitution context; we can substitute unfixed parameters for themselves
// since they don't actually occur in the inputs. (They may occur in the outputs,
// or there may be input parameters fixed to _unfixed_ method CType variables.
// Both of those scenarios are legal.)
CType[] ppMethodParameters = new CType[_pMethodTypeParameters.size];
for (int iParam = 0; iParam < _pMethodTypeParameters.size; iParam++)
{
TypeParameterType pParam = _pMethodTypeParameters.ItemAsTypeParameterType(iParam);
ppMethodParameters[iParam] = IsUnfixed(iParam) ? pParam : _pFixedResults[iParam];
}
SubstContext subsctx = new SubstContext(_pClassTypeArguments.ToArray(), _pClassTypeArguments.size,
ppMethodParameters, _pMethodTypeParameters.size);
AggregateType pFixedDelegateType =
GetTypeManager().SubstType(pDelegateType, subsctx).AsAggregateType();
TypeArray pFixedDelegateParams =
pFixedDelegateType.GetDelegateParameters(GetSymbolLoader());
return pFixedDelegateParams;
}
示例2: HasDelegateConversion
//////////////////////////////////////////////////////////////////////////////
private bool HasDelegateConversion(AggregateType pSource, AggregateType pDest)
{
Debug.Assert(pSource != null && pSource.isDelegateType());
Debug.Assert(pDest != null && pDest.isDelegateType());
return HasVariantConversion(pSource, pDest);
}
示例3: TryVarianceAdjustmentToGetAccessibleType
private bool TryVarianceAdjustmentToGetAccessibleType(CSemanticChecker semanticChecker, BindingContext bindingContext, AggregateType typeSrc, out CType typeDst)
{
Debug.Assert(typeSrc != null);
Debug.Assert(typeSrc.isInterfaceType() || typeSrc.isDelegateType());
typeDst = null;
AggregateSymbol aggSym = typeSrc.GetOwningAggregate();
AggregateType aggOpenType = aggSym.getThisType();
if (!semanticChecker.CheckTypeAccess(aggOpenType, bindingContext.ContextForMemberLookup()))
{
// if the aggregate symbol itself is not accessible, then forget it, there is no
// variance that will help us arrive at an accessible type.
return false;
}
TypeArray typeArgs = typeSrc.GetTypeArgsThis();
TypeArray typeParams = aggOpenType.GetTypeArgsThis();
CType[] newTypeArgsTemp = new CType[typeArgs.size];
for (int i = 0; i < typeArgs.size; i++)
{
if (semanticChecker.CheckTypeAccess(typeArgs.Item(i), bindingContext.ContextForMemberLookup()))
{
// we have an accessible argument, this position is not a problem.
newTypeArgsTemp[i] = typeArgs.Item(i);
continue;
}
if (!typeArgs.Item(i).IsRefType() || !typeParams.Item(i).AsTypeParameterType().Covariant)
{
// This guy is inaccessible, and we are not going to be able to vary him, so we need to fail.
return false;
}
CType intermediateTypeArg;
if (GetBestAccessibleType(semanticChecker, bindingContext, typeArgs.Item(i), out intermediateTypeArg))
{
// now we either have a value type (which must be accessible due to the above
// check, OR we have an inaccessible type (which must be a ref type). In either
// case, the recursion worked out and we are OK to vary this argument.
newTypeArgsTemp[i] = intermediateTypeArg;
continue;
}
else
{
Debug.Assert(false, "GetBestAccessibleType unexpectedly failed on a type that was used as a type parameter");
return false;
}
}
TypeArray newTypeArgs = semanticChecker.getBSymmgr().AllocParams(typeArgs.size, newTypeArgsTemp);
CType intermediateType = this.GetAggregate(aggSym, typeSrc.outerType, newTypeArgs);
// All type arguments were varied successfully, which means now we must be accessible. But we could
// have violated constraints. Let's check that out.
if (!TypeBind.CheckConstraints(semanticChecker, null/*ErrorHandling*/, intermediateType, CheckConstraintsFlags.NoErrors))
{
return false;
}
typeDst = intermediateType;
Debug.Assert(semanticChecker.CheckTypeAccess(typeDst, bindingContext.ContextForMemberLookup()));
return true;
}
示例4: CreateAnonymousMethod
public EXPRBOUNDLAMBDA CreateAnonymousMethod(AggregateType delegateType)
{
Debug.Assert(delegateType == null || delegateType.isDelegateType());
EXPRBOUNDLAMBDA rval = new EXPRBOUNDLAMBDA();
rval.kind = ExpressionKind.EK_BOUNDLAMBDA;
rval.type = delegateType;
rval.flags = 0;
Debug.Assert(rval != null);
return (rval);
}