/// <summary> /// Creates a <see cref="List"/> instance with <paramref name="indirectValues"/> and /// a <paramref name="loader"/> used for loading unloaded values. /// </summary> /// <param name="indirectValues">The loaded and unloaded values to include.</param> /// <param name="loader">The <see cref="IndirectValue.Loader"/> delegate invoked when /// unloaded values are needed.</param> public List(IEnumerable <IndirectValue> indirectValues, IndirectValue.Loader loader) : this( indirectValues is ImmutableArray <IndirectValue> ia ? ia : indirectValues.ToImmutableArray(), loader ) { }
/// <summary> /// Creates a <see cref="Dictionary"/> instance with key-value /// <paramref name="indirectPairs"/>. (Note that only values can be indirect.) /// </summary> /// <param name="indirectPairs">Key-value pairs to include. Values can be either loaded or /// unloaded. If there are duplicated keys, later pairs overwrite earlier ones.</param> /// <param name="loader">The <see cref="IndirectValue.Loader"/> delegate invoked when /// unloaded values are needed.</param> public Dictionary( IEnumerable <KeyValuePair <IKey, IndirectValue> > indirectPairs, IndirectValue.Loader loader ) : this( indirectPairs is ImmutableSortedDictionary <IKey, IndirectValue> sd ? (sd.KeyComparer == KeyComparer.Instance ? sd : sd.WithComparers(KeyComparer.Instance)) : indirectPairs.ToImmutableSortedDictionary(KeyComparer.Instance), loader ) { }