Here are the examples of the csharp api System.Collections.Generic.ICollection.Add(char) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
6 Examples
19
Source : XunitConsoleForwarder.cs
with MIT License
from elsa-workflows
with MIT License
from elsa-workflows
public override void Write(char value)
{
if (value == '\n')
{
FlushLine();
_line = new List<char>();
return;
}
_line.Add(value);
}
19
Source : TimestampId.cs
with MIT License
from jianxuanbing
with MIT License
from jianxuanbing
private string Fill(long temp)
{
var num = temp.ToString();
IList<char> chars = new List<char>();
for (int i = 0; i < MAX_END_NUMBER.ToString().Length - num.Length; i++)
{
chars.Add('0');
}
return new string(chars.ToArray()) + num;
}
19
Source : MarshalHelper.cs
with GNU Lesser General Public License v3.0
from jmmorato
with GNU Lesser General Public License v3.0
from jmmorato
public static void PtrToWCharSequence(this IntPtr ptr, ref IList<char> sequence, int capacity = 0)
{
// Ensure a not null empty list to populate
if (sequence == null)
{
if (capacity > 0)
{
sequence = new List<char>(capacity);
}
else
{
sequence = new List<char>();
}
}
else
{
sequence.Clear();
}
if (ptr == IntPtr.Zero)
{
return;
}
// Start by reading the size of the array
int length = Marshal.ReadInt32(ptr);
// For efficiency, only compute the element size once
#if Windows
int elSiz = 2;
#else
int elSiz = 4;
#endif
// Populate the list
for (int i = 0; i < length; i++)
{
#if Windows
sequence.Add(Marshal.PtrToStructure<char>(ptr + sizeof(int) + (elSiz * i)));
#else
int utf32 = Marshal.PtrToStructure<int>(ptr + sizeof(int) + (elSiz * i));
sequence.Add(char.ConvertFromUtf32(utf32)[0]);
#endif
}
}
19
Source : restructuredtextParser.cs
with MIT License
from lextm
with MIT License
from lextm
public int Track(char item)
{
if (!_sections.Contains(item))
{
_sections.Add(item);
}
return _sections.IndexOf(item) + 1;
}
19
Source : CharFA.Duplicates.cs
with MIT License
from SpecFlowOSS
with MIT License
from SpecFlowOSS
public static void TrimDuplicates(IList<CharFA<TAccept>> closure, IProgress<CharFAProgress> progress = null)
{
var lclosure = closure;
var dups = new Dictionary<CharFA<TAccept>, ICollection<CharFA<TAccept>>>();
int oc = 0;
int c = -1;
var k = 0;
// we may have to run this multiple times to remove all references
while (c < oc)
{
if (null != progress)
progress.Report(new CharFAProgress(CharFAStatus.TrimDuplicates, k));
c = lclosure.Count;
FillDuplicatesGroupedByState(lclosure, dups);
if (0 < dups.Count)
{
// for each pair of duplicates basically we replace all references to the first
// with references to the latter, thus eliminating the duplicate state:
foreach (KeyValuePair<CharFA<TAccept>, ICollection<CharFA<TAccept>>> de in dups)
{
var replacement = de.Key;
var targets = de.Value;
for (int i = 0; i < c; ++i)
{
var s = lclosure[i];
var repls = new List<KeyValuePair<CharFA<TAccept>, CharFA<TAccept>>>();
var td = (IDictionary<CharFA<TAccept>, ICollection<char>>)s.InputTransitions;
foreach (var trns in td)
if (targets.Contains(trns.Key))
repls.Add(new KeyValuePair<CharFA<TAccept>, CharFA<TAccept>>(trns.Key, replacement));
foreach (var repl in repls)
{
var inps = td[repl.Key];
td.Remove(repl.Key);
ICollection<char> v;
if (!td.TryGetValue(repl.Value, out v))
td.Add(repl.Value, inps);
else foreach (var inp in inps)
if (!v.Contains(inp))
v.Add(inp);
}
int lc = s.EpsilonTransitions.Count;
for (int j = 0; j < lc; ++j)
if (targets.Contains(s.EpsilonTransitions[j]))
s.EpsilonTransitions[j] = de.Key;
}
}
dups.Clear();
}
else
break;
oc = c;
var f = lclosure[0];
lclosure = f.FillClosure();
c = lclosure.Count;
++k;
}
}
19
Source : CharFA.InputTransitionDictionary.cs
with MIT License
from SpecFlowOSS
with MIT License
from SpecFlowOSS
public void Add(char input, CharFA<TAccept> fa)
{
_charactersTransitions.Add(input, fa);
if (!_charactersByState.TryGetValue(fa, out var chars))
{
chars = new CharactersAndRanges(new List<char>(), new List<CharRange>());
_charactersByState[fa] = chars;
}
chars.characters.Add(input);
}