本文整理汇总了C#中ImmutableHashSet.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ImmutableHashSet.Add方法的具体用法?C# ImmutableHashSet.Add怎么用?C# ImmutableHashSet.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImmutableHashSet
的用法示例。
在下文中一共展示了ImmutableHashSet.Add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Map
public Map(int id, bool[,] filled, PositionedUnit unit, ImmutableStack<Unit> nextUnits, ImmutableHashSet<PositionedUnit> usedPositions, Scores scores, bool died = false)
{
Id = id;
NextUnits = nextUnits;
Width = filled.GetLength(0);
Height = filled.GetLength(1);
Filled = filled;
Unit = IsValidPosition(unit) ? unit : PositionedUnit.Null;
UsedPositions = usedPositions.Add(Unit);
Scores = scores;
Died = died;
}
示例2: AddFieldIfNeeded
private static ImmutableHashSet<IFieldSymbol> AddFieldIfNeeded(IFieldSymbol fieldSymbol, ExpressionSyntax expression,
ImmutableHashSet<IFieldSymbol> fieldsAssigned)
{
var objectCreation = expression as ObjectCreationExpressionSyntax;
if (objectCreation == null ||
!IsNonStaticNonPublicDisposableField(fieldSymbol))
{
return fieldsAssigned;
}
return fieldsAssigned.Add(fieldSymbol);
}
示例3: CollectDisposeMethods
private static void CollectDisposeMethods(SymbolAnalysisContext c, IMethodSymbol disposeMethod,
ref ImmutableHashSet<IMethodSymbol> allDisposeMethods,
ref ImmutableHashSet<IMethodSymbol> implementingDisposeMethods)
{
var methodSymbol = c.Symbol as IMethodSymbol;
if (methodSymbol == null ||
methodSymbol.Name != DisposeMethodName)
{
return;
}
allDisposeMethods = allDisposeMethods.Add(methodSymbol);
if (methodSymbol.IsOverride ||
MethodIsDisposeImplementation(methodSymbol, disposeMethod) ||
MethodMightImplementDispose(methodSymbol))
{
implementingDisposeMethods = implementingDisposeMethods.Add(methodSymbol);
}
}
示例4: AppendToAliasNameSet
public static void AppendToAliasNameSet(this string alias, ImmutableHashSet<string>.Builder builder)
{
if (string.IsNullOrWhiteSpace(alias))
{
return;
}
builder.Add(alias);
var caseSensitive = builder.KeyComparer == StringComparer.Ordinal;
Contract.Requires(builder.KeyComparer == StringComparer.Ordinal || builder.KeyComparer == StringComparer.OrdinalIgnoreCase);
string aliasWithoutAttribute;
if (alias.TryGetWithoutAttributeSuffix(caseSensitive, out aliasWithoutAttribute))
{
builder.Add(aliasWithoutAttribute);
return;
}
builder.Add(alias.GetWithSingleAttributeSuffix(caseSensitive));
}
示例5: ProcessExpressionChange
private static void ProcessExpressionChange(ExpressionSyntax expression, SemanticModel semanticModel,
ref ImmutableHashSet<IFieldSymbol> nonCandidateFields, ref ImmutableHashSet<IFieldSymbol> assignedAsReadonly)
{
var fieldSymbol = semanticModel.GetSymbolInfo(expression).Symbol as IFieldSymbol;
if (fieldSymbol== null || !FieldIsRelevant(fieldSymbol))
{
return;
}
var constructorSymbol = semanticModel.GetEnclosingSymbol(expression.SpanStart) as IMethodSymbol;
if (constructorSymbol == null)
{
nonCandidateFields = nonCandidateFields.Add(fieldSymbol);
return;
}
if (constructorSymbol.MethodKind == MethodKind.Constructor &&
constructorSymbol.ContainingType.Equals(fieldSymbol.ContainingType))
{
assignedAsReadonly = assignedAsReadonly.Add(fieldSymbol);
}
else
{
nonCandidateFields = nonCandidateFields.Add(fieldSymbol);
}
}
示例6: HitTest
/// <summary>
///
/// </summary>
/// <param name="shape"></param>
/// <param name="rect"></param>
/// <param name="selection"></param>
/// <param name="builder"></param>
/// <param name="treshold"></param>
/// <param name="dx"></param>
/// <param name="dy"></param>
/// <returns></returns>
private static bool HitTest(
BaseShape shape,
Rect2 rect,
Vector2[] selection,
ImmutableHashSet<BaseShape>.Builder builder,
double treshold,
double dx,
double dy)
{
if (shape is XPoint)
{
if (GetPointBounds(shape as XPoint, treshold, dx, dy).IntersectsWith(rect))
{
if (builder != null)
{
builder.Add(shape);
}
else
{
return true;
}
}
return false;
}
else if (shape is XLine)
{
var line = shape as XLine;
if (GetPointBounds(line.Start, treshold, dx, dy).IntersectsWith(rect)
|| GetPointBounds(line.End, treshold, dx, dy).IntersectsWith(rect)
|| MathHelpers.LineIntersectsWithRect(rect, new Point2(line.Start.X, line.Start.Y), new Point2(line.End.X, line.End.Y)))
{
if (builder != null)
{
builder.Add(line);
return false;
}
else
{
return true;
}
}
return false;
}
else if (shape is XEllipse)
{
if (GetEllipseBounds(shape as XEllipse, dx, dy).IntersectsWith(rect))
{
if (builder != null)
{
builder.Add(shape);
return false;
}
else
{
return true;
}
}
return false;
}
else if (shape is XRectangle)
{
if (GetRectangleBounds(shape as XRectangle, dx, dy).IntersectsWith(rect))
{
if (builder != null)
{
builder.Add(shape);
return false;
}
else
{
return true;
}
}
return false;
}
else if (shape is XArc)
{
if (GetArcBounds(shape as XArc, dx, dy).IntersectsWith(rect))
{
if (builder != null)
{
builder.Add(shape);
return false;
}
else
{
return true;
}
}
//.........这里部分代码省略.........