3 writes to _one
Microsoft.CodeAnalysis.Workspaces (3)
src\Compilers\Core\Portable\InternalUtilities\OneOrMany.cs (3)
34
_one
= one;
47
_one
= item;
52
_one
= default;
25 references to _one
Microsoft.CodeAnalysis.Workspaces (25)
src\Compilers\Core\Portable\InternalUtilities\OneOrMany.cs (25)
58
/// True if the collection has a single item. This item is stored in <see cref="
_one
"/>.
60
[MemberNotNullWhen(true, nameof(
_one
))]
65
=>
_one
== null && _many.IsDefault;
78
return
_one
;
94
=> HasOneItem ? OneOrMany.Create(
_one
, item) :
102
builder.Add(
_one
);
111
=> HasOneItem ? EqualityComparer<T>.Default.Equals(item,
_one
) : _many.Contains(item);
117
return EqualityComparer<T>.Default.Equals(item,
_one
) ? Empty : this;
126
OneOrMany.Create(selector(
_one
)) :
133
OneOrMany.Create(selector(
_one
, arg)) :
140
=> HasOneItem ?
_one
: _many.FirstOrDefault();
146
return predicate(
_one
) ?
_one
: default;
156
return predicate(
_one
, arg) ?
_one
: default;
165
? new OneOrMany<T>(from.
_one
)
170
=> HasOneItem ? predicate(
_one
) : _many.All(predicate);
173
=> HasOneItem ? predicate(
_one
, arg) : _many.All(predicate, arg);
179
=> HasOneItem ? predicate(
_one
) : _many.Any(predicate);
182
=> HasOneItem ? predicate(
_one
, arg) : _many.Any(predicate, arg);
185
=> HasOneItem ? ImmutableArray.Create(
_one
) : _many;
188
=> HasOneItem ? new[] {
_one
} : _many.ToArray();
201
return HasOneItem ? comparer.Equals(
_one
, other.
_one
!) :
220
if (!first || !comparer.Equals(
_one
, otherItem))