Horje
C# list of unique values with group and counts Code Example
C# list of unique values with group and counts
// model
 public class orderviewmodel
    {
        public string OrderNumber { get; set; }
        public int Count { get; set; }
    }
    
 // BL
  public IList<orderviewmodel> Read(string tmpC)
        {
            try
            {
                using (var entities = new UrEntities())
                {
                    return entities.Masters.Where(w => w.ContainerNumber.Equals(tmpC)).GroupBy(g => g.OrderNumber)
                        .Select(s => new orderviewmodel { OrderNumber = s.Key, Count = s.ToList().Count,  }).ToList();
                }
            }
            catch (Exception)
            {

                throw;
            }
        }




Csharp

Related
conveyor function in f# Code Example conveyor function in f# Code Example
linq from multiple tables Code Example linq from multiple tables Code Example
c# signalr console app client example Code Example c# signalr console app client example Code Example
show a message box in c# Code Example show a message box in c# Code Example
find qual values in a dictionary c# Code Example find qual values in a dictionary c# Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10