public class PGNsegmentTxMap { string pgn; public string segmentTx { get; set; } public string PGN { get { if (!String.IsNullOrEmpty(pgn)) return pgn.ToUpper(); else return string.Empty; } set { pgn = value; } } public PGNsegmentTxMap(string pgn, string segmentTx) { this.segmentTx = segmentTx; this.pgn = pgn; } } #endregion class ProductComparer : IEqualityComparer<PGNsegmentTxMap> { // Products are equal if their names and product numbers are equal. public bool Equals(PGNsegmentTxMap x, PGNsegmentTxMap y) { //Check whether the compared objects reference the same data. if (Object.ReferenceEquals(x, y)) return true; //Check whether any of the compared objects is null. if (Object.ReferenceEquals(x, null) || Object.ReferenceEquals(y, null)) return false; //Check whether the products' properties are equal. return x.segmentTx == y.segmentTx && x.PGN == y.PGN; } public int GetHashCode(PGNsegmentTxMap product) { //Check whether the object is null if (Object.ReferenceEquals(product, null)) return 0; //Get hash code for the Name field if it is not null. int hashProductName = product.segmentTx == null ? 0 : product.segmentTx.GetHashCode(); //Get hash code for the Code field. int hashProductCode = product.PGN.GetHashCode(); //Calculate the hash code for the product. return hashProductName ^ hashProductCode; } }
for (int i = 0; i < PGNsegmentMapLists.Count; i++) { PGNsegmentTxMap[] products = PGNsegmentMapLists[i]; } PGNsegmentTxMap[] products = PGNsegmentMapLists.ToArray();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)