Here are the examples of the csharp api System.Collections.Generic.HashSet.AddIfNotPresent(T) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4 Examples
19
Source : HashSet.cs
with Apache License 2.0
from theolivenbaum
with Apache License 2.0
from theolivenbaum
public bool Add(T item)
{
return AddIfNotPresent(item);
}
19
Source : HashSet.cs
with Apache License 2.0
from theolivenbaum
with Apache License 2.0
from theolivenbaum
void ICollection<T>.Add(T item)
{
AddIfNotPresent(item);
}
19
Source : HashSet.cs
with Apache License 2.0
from theolivenbaum
with Apache License 2.0
from theolivenbaum
public void UnionWith(IEnumerable<T> other)
{
if (other == null)
{
throw new ArgumentNullException("other");
}
foreach (T item in other)
{
AddIfNotPresent(item);
}
}
19
Source : HashSet.cs
with Apache License 2.0
from theolivenbaum
with Apache License 2.0
from theolivenbaum
private void SymmetricExceptWithUniqueHashSet(HashSet<T> other)
{
foreach (T item in other)
{
if (!Remove(item))
{
AddIfNotPresent(item);
}
}
}