public static IEnumerable Enum(TListInt64 AList) { if(AList == null) yield break; Int32 LIndex = 0; foreach(Int64 LKey in AList.FList) { yield return new KeyValuePair<Int64, Int32>(LKey, ++LIndex); } }
public static TListInt64 FromCompressedBinary(SqlBytes AData) { if (AData.IsNull) return TListInt64.Null; TListInt64 LResult = new TListInt64(); System.IO.BinaryReader r = new System.IO.BinaryReader(AData.Stream); int LCount = Sql.Read7BitEncodedInt(r); LResult.FList.Capacity = LCount; for(; LCount > 0; LCount--) LResult.FList.Add(Sql.Read7BitEncodedInt64(r)); return LResult; }
/// <summary> /// Возвращает значение параметра типа TListInt64 /// </summary> protected TListInt64 AsTListInt64(String AName) { Object LValue; if (!FData.TryGetValue(AName, out LValue)) return null; try { if(LValue is SqlUdt) LValue = ((SqlUdt)LValue).CreateUdtObject(true); if (LValue is TListInt64) return (TListInt64)LValue; else { TListInt64 LResult = new TListInt64(); if (LValue is SqlString) LResult.FromString(((SqlString)LValue).Value); else if (LValue is SqlChars) LResult.FromString(((SqlChars)LValue).ToString()); //else if (LValue is Sql.SqlAnsiString) return new SqlBinary(((Sql.SqlAnsiString)LValue).Buffer); else { System.IO.BinaryReader r; if (LValue is SqlBytes) r = new System.IO.BinaryReader(((SqlBytes)LValue).Stream); else if (LValue is SqlBinary) r = new System.IO.BinaryReader(new System.IO.MemoryStream(((SqlBinary)LValue).Value)); else throw new Exception(); LResult.Read(r); } return LResult; } } catch { throw new Exception(String.Format("Не удалось сконвертировать значение '{0}' параметра '{1}' в тип TListInt64", Sql.ValueToString(LValue, Sql.ValueDbStyle.Text), AName)); } }
public void AddTListInt64(String AName, TListInt64 AValue) { base.AddParam(AName, new SqlUdt(AValue)); }
public static TListInt64 Parse(SqlString AString) { if (AString.IsNull) return null; TListInt64 LResult = new TListInt64(); LResult.FromString(AString.Value); return LResult; }
public void Read(System.IO.BinaryReader r) { //if (r == null) throw new ArgumentNullException("r"); if(OResult == null) OResult = new TListInt64(); OResult.Read(r); }
public void Init() { OResult = new TListInt64(); }
public bool Equals(TListInt64 AList) { if(AList == null || FList.Count != AList.FList.Count) return false; for(int i = FList.Count - 1; i >= 0; i--) if(FList[i] != AList.FList[i]) return false; return true; }
public Boolean ContainsAll(TListInt64 AValue) { if(AValue == null || AValue.FList.Count == 0) return true; for(int i = AValue.FList.Count - 1; i >= 0; i--) if(!FList.Contains(AValue.FList[i])) return false; return true; }