Skip to content

Instantly share code, notes, and snippets.

@jsgao0
Last active May 12, 2016 02:59
Show Gist options
  • Save jsgao0/bd1b6b4ac12e06d36f570c6cfdb11dd1 to your computer and use it in GitHub Desktop.
Save jsgao0/bd1b6b4ac12e06d36f570c6cfdb11dd1 to your computer and use it in GitHub Desktop.
Group by some property in a class constructor.
public class BusinessHours {
public DateTime openAt { get; private set; }
public DateTime closeAt { get; private set; }
public BusinessHours(DateTime openAt, DateTime closeAt) {
this.openAt = openAt;
this.closeAt = closeAt;
}
}
public class GroceryStore<T> where T : Grocery {
public String storeName { get; set; }
public String storeLocation { get; set; }
public BusinessHours storeBusinessHours { get; set; }
// TODO: Contructor.
}
public abstract class Grocery {
public String itemName { get; set; }
public float itemPrice { get; set; }
public DateTime itemExpiryDate { get; set; }
}
public class Food : Grocery {}
public class DailyUse : Grocery {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment