本文整理汇总了C#中ISet.First方法的典型用法代码示例。如果您正苦于以下问题:C# ISet.First方法的具体用法?C# ISet.First怎么用?C# ISet.First使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISet
的用法示例。
在下文中一共展示了ISet.First方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CountCommonPathElements
private int CountCommonPathElements(ISet<Document> documents)
{
if (documents.Count == 0)
{
return 0;
}
var commonPathElements = 0;
for (var index = 0; ; index++)
{
var pathPortion = GetPathPortion(documents.First(), index);
if (pathPortion == null)
{
return commonPathElements;
}
foreach (var document in documents)
{
if (GetPathPortion(document, index) != pathPortion)
{
return commonPathElements;
}
}
commonPathElements++;
}
}
示例2: CreateMultipleDependencies
public static IDependencies CreateMultipleDependencies(ISet<IBuilder> subtasks)
{
if (subtasks.Count == 0)
return new NoDependencies();
else if (subtasks.Count == 1)
return new SubtaskDependency(subtasks.First());
else
return new MultipleDependencies(subtasks.Select(subtask => new SubtaskDependency(subtask)));
}
示例3: TermExpression
public TermExpression(ISet<TermExpression> terms)
{
if (terms == null || terms.Count == 0)
throw new CqlLinqException("Empty lists are not allowed");
_type = typeof(ISet<>).MakeGenericType(terms.First().Type);
_terms = terms.ToList().AsReadOnly();
_termType = CqlExpressionType.Set;
}
示例4: buildRequestString
private static string buildRequestString(ISet<int> setOfRbls) {
if (setOfRbls.Count <= 0) {
throw new ArgumentOutOfRangeException("setOfRbls", setOfRbls.Count, "Leeres Set von Rbls an den Requester übergeben");
}
StringBuilder builder = new StringBuilder();
builder.Append(ViennaTrafficMonitor.Properties.Settings.Default.MonitorRequestBegin);
builder.Append(_rblAllocator);
builder.Append(setOfRbls.First());
IEnumerable rblEnumerable = setOfRbls.Skip(1);
foreach (int rbl in rblEnumerable) {
builder.Append(_rblConnector);
builder.Append(rbl);
}
builder.Append(ViennaTrafficMonitor.Properties.Settings.Default.MonitorRequestEnd);
builder.Append(ViennaTrafficMonitor.Properties.Settings.Default.SenderIdProd);
return builder.ToString();
}
示例5: CreateSuite
public Suite CreateSuite(ISet<Goal> goals)
{
if (goals.Count == 0)
{
goals.Add(Suite.DebugGoal);
goals.Add(Suite.ReleaseGoal);
}
var activeGoal =
goals.FirstOrDefault(g => g.Name.Equals(targetGoal, StringComparison.InvariantCultureIgnoreCase));
if (activeGoal == null)
{
if (ignoreTargetGoal)
activeGoal = goals.First();
else
throw new InvalidGoalException(targetGoal, goals);
}
return new Suite(suiteRoot, goals, activeGoal);
}
示例6: AllPossibleValues
private List<string> AllPossibleValues(List<string> dimensions, IDataStructureObject kf, ISet<ICodelistObject> codelists)
{
if (NewLines.ContainsKey(string.Join("+", dimensions)))
return NewLines[string.Join("+", dimensions)];
Dictionary<string, string> allVals = new Dictionary<string, string>();
List<string> BuilderSeries = new List<string>();
foreach (var dim in dimensions)
{
if (dim == kf.TimeDimension.Id)
return new List<string>();
IComponent component = kf.Components.FirstOrDefault(c => c.Id == dim);
if (component == null || !component.HasCodedRepresentation() || string.IsNullOrEmpty(component.Representation.Representation.MaintainableReference.MaintainableId))
return new List<string>();
ICodelistObject codelist = codelists.First(c => c.Id == component.Representation.Representation.MaintainableReference.MaintainableId);
if (codelist == null)
continue;
List<string> InternalBuilderSeries = new List<string>();
if (BuilderSeries.Count == 0)
{
foreach (var code in codelist.Items)
InternalBuilderSeries.Add(code.Id);
}
else
{
BuilderSeries.ForEach(bs =>
{
foreach (var code in codelist.Items)
InternalBuilderSeries.Add(bs + "+" + code.Id);
});
}
BuilderSeries = InternalBuilderSeries;
}
NewLines.Add(string.Join("+", dimensions), BuilderSeries);
return BuilderSeries;
}
示例7: ReconcileGenericTheories
private IAstTypeReference ReconcileGenericTheories(ISet<IAstTypeReference> theories, IAstMethodReference method)
{
if (theories.Count > 1)
throw new NotImplementedException(string.Format("OverloadResolver: Generic theory aggregation is not yet supported. Method: {0}, theories: {1}.", method, string.Join(", ", theories)));
return theories.First();
}
示例8: ReconcileGenericTheories
private Type ReconcileGenericTheories(ISet<Type> theories)
{
if (theories.Count > 1)
throw new NotImplementedException("OverloadResolver: Generic theory aggregation is not yet supported (theories:" + string.Join(", ", theories) + ")");
return theories.First();
}
示例9: RemovePossibles
internal SudokuProgress RemovePossibles(IEnumerable<int> existingNumbers)
{
if (_blocked)
return SudokuProgress.NO_PROGRESS;
// Takes the current possible values and removes the ones existing in `existingNumbers`
possibleValues = new HashSet<int>(possibleValues.Where(x => !existingNumbers.Contains(x)));
SudokuProgress result = SudokuProgress.NO_PROGRESS;
if (possibleValues.Count == 1)
{
Fix(possibleValues.First(), "Only one possibility");
result = SudokuProgress.PROGRESS;
}
if (possibleValues.Count == 0)
return SudokuProgress.FAILED;
return result;
}
示例10: CommonPrefix
private int CommonPrefix(ISet<string> paths)
{
if (paths.Count <= 1)
{
return 0;
}
var first = paths.First().Split('/');
var last = paths.Last().Split('/');
int i = 0;
while (first[i] == last[i] && i <= first.Length)
{
i++;
}
// +1 to account for the '/'.
var result = String.Join("/", first.Take(i));
return String.IsNullOrEmpty(result) ? 0 : result.Length + 1;
}