public static IMutableSeq <T> Of <T>(IEnumerable <T> values) { IMutableSeq <T> mseq; if (values is IImmutableSeq <T> ) { var seq = (values as IImmutableSeq <T>); mseq = seq.IsEmpty ? Empty <T>() : Of <T>(seq); } else if (values is IMutableSeq <T> ) { var seq = (IMutableSeq <T>)values; mseq = seq.IsEmpty ? Empty <T>() : Of <T>(seq); } else if (values is ICollection <T> ) { var collection = (ICollection <T>)values; mseq = collection.Count == 0 ? Empty <T>() : OfLength <T>(collection.Count).SetAll(values); } else { var array = values.ToArray(); mseq = array.Length == 0 ? Empty <T>() : new ArrayMutableSeq <T>(Array.Of(ObjectStore.Of(array))); } return(mseq); }
public static IMutableSeq <T> Of <T>(params T[] values) { return(values.Length == 0 ? Empty <T>() : new ArrayMutableSeq <T>(Array.Of(ObjectStore.Of((T[])values.Clone())))); }
protected CharSeqBase(SerializationInfo info, StreamingContext context) : base(Array.OfLength <char>(0)) { Values = (char[])info.GetValue("_array", typeof(char[])); base.Values = Array.Of(CharStore.Of(Values)).Seal(); }
public static IMutableSeq <T> OfLength <T>(int length) { return(length == 0 ? Empty <T>() : new ArrayMutableSeq <T>(Array.Of(ObjectStore.OfLength <T>(length)))); }
protected CharSeqBase(char[] characters) : base(Array.Of(CharStore.Of(characters)).Seal()) { Values = characters; }