示例#1
0
 private static IImmutableList<Symbol> AddSymbols(Type type, IImmutableList<Symbol> derivedTypeSymbols)
 {
    if (type == null)
       return derivedTypeSymbols;
    var symbolFields = type.GetFields(BindingFlags.Public | BindingFlags.Static)
       .Where(field => SymbolType.IsAssignableFrom(field.FieldType));
    var symbols = symbolFields.Select(field => (Symbol)field.GetValue(null));
    return AddSymbols(type.BaseType, derivedTypeSymbols.AddRange(symbols));
 }
示例#2
0
 public SorterStageImpl(int keyCount, IReadOnlyList <IKeyPair> keyPairs)
 {
     _keyCount = keyCount;
     _keyPairs = _keyPairs.AddRange(keyPairs.OrderBy(kp => kp.Index));
 }
示例#3
0
 public INonemptyList <T> AddRange(IEnumerable <T> items)
 {
     return(_list.AddRange(items)
            .AsNonemptyList()
            .Extract(() => throw new InvalidOperationException()));
 }