Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CollectionBase : IEnumerable
- public class BusinessObjectCollection : CollectionBase
- public class BusinessObjectCollection : List<BusinessObject>
- var d = new Dictionary<string, int>
- {
- {"hello", 0},
- {"the answer to life the universe and everything is:", 42}
- };
- class c1 : IEnumerable
- {
- void Add(int x1, int x2, int x3)
- {
- //...
- }
- //...
- }
- var x = new c1
- {
- {1,2,3},
- {4,5,6}
- }
- var x = new List<Customer>
- {
- new Customer("Scott Wisniewski", "555-555-5555", "Seattle", "WA"),
- new Customer("John Doe", "555-555-1234", "Los Angeles", "CA"),
- new Customer("Michael Scott", "555-555-8769", "Scranton PA"),
- new Customer("Ali G", "", "Staines", "UK")
- }
- class CustomerList : List<Customer>
- {
- public void Add(string name, string phoneNumber, string city, string stateOrCountry)
- {
- Add(new Customer(name, phoneNumber, city, stateOrCounter));
- }
- }
- var customers = new CustomerList
- {
- {"Scott Wisniewski", "555-555-5555", "Seattle", "WA"},
- {"John Doe", "555-555-1234", "Los Angeles", "CA"},
- {"Michael Scott", "555-555-8769", "Scranton PA"},
- {"Ali G", "", "Staines", "UK"}
- }
- public static int SomeCount(this IEnumerable<BusinessObject> someList)
- public class BusinessObjectCollection : List<BusinessObject> {}
- public IEnumerable<BusinessObject> GetBusinessObjects();
- public OrderItemCollection : IEnumerable<OrderItem>
- {
- private readonly List<OrderItem> _orderItems = new List<OrderItem>();
- void Add(OrderItem item)
- {
- _orderItems.Add(item)
- }
- //implement only the list members, which are required from your domain.
- //ie. sum items, calculate weight etc...
- private IEnumerator<string> Enumerator() {
- return _orderItems.GetEnumerator();
- }
- public IEnumerator<string> GetEnumerator() {
- return Enumerator();
- }
- }
- public MyTypeCollection : List<MyType>
- using BusinessObjectCollection = List<BusinessObject>;
- System.Collections.ObjectModel.Collection<BusinessObject>
Add Comment
Please, Sign In to add comment