本文整理汇总了C#中IConstraint.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IConstraint.GetType方法的具体用法?C# IConstraint.GetType怎么用?C# IConstraint.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IConstraint
的用法示例。
在下文中一共展示了IConstraint.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InstanceRegistration
public InstanceRegistration(IConstraint constraint, ActionDescriptor actionDescriptor, ControllerDescriptor controllerDescriptor, FilterScope scope1)
: base(actionDescriptor, controllerDescriptor, scope1)
{
if (constraint == null)
{
throw new ArgumentNullException("constraint", "Constraint instance can not be null.");
}
Constraint = constraint;
ConstraintType = Constraint.GetType();
}
示例2: ExtendConstraint
private static ExtendedConstraint ExtendConstraint(IConstraint constraint, ReadOnlyCollection<DimensionWithValues> dimensionValues)
{
List<int> dimensionIndexes = GetDimensionIndexes(constraint, dimensionValues).ToList();
if (dimensionIndexes.Count == 0)
{
throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture,
"Constraint {0} doesn't have any required dimensions.", constraint.GetType().Name));
}
ReadOnlyCollection<DimensionWithValues> dimensionValuesSubset = dimensionIndexes.Select(di => dimensionValues[di]).ToList().AsReadOnly();
ExtendedConstraint ret = new ExtendedConstraint(dimensionIndexes, dimensionValues);
foreach (ReadOnlyCollection<int> indexes in CombinatorialUtilities.GetAllIndexCombinations(dimensionValuesSubset.Select(dv => dv.Values.Count)))
{
Vector v = CombinatorialUtilities.ConstructVector(dimensionValuesSubset, indexes);
if (constraint.IsValid(v))
{
ret.AddNewValueCombinations(indexes);
}
}
return ret;
}
示例3: GetIndexOfConstraintDimension
private static int GetIndexOfConstraintDimension(IConstraint constraint, ReadOnlyCollection<DimensionWithValues> dimensionValues,
QualifiedDimension dimension)
{
int ret = 0;
foreach (DimensionWithValues dv in dimensionValues)
{
if (IsSubset(dimension, dv.Dimension))
{
return ret;
}
ret++;
}
throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture,
"Dimension {0} from constraint {1} was not found in the matrix (all dimensions: {2}).",
dimension.FullyQualifiedName, constraint.GetType().Name, string.Join(",", dimensionValues.Select(dv => dv.Dimension.FullyQualifiedName))));
}