public static StateCollection GetByName(String partialName) { StateCollection returnValue; returnValue = new StateCollection(); //baseList is some list I wasn’t nice enough to show where it came from. //It’s just a list of states. Get over it. var stateList = from state in baseList where state.Name.StartsWith(partialName) select new State(state.Name, state.Code); stateList.ToList().ForEach(currentState => returnValue.Add(currentState)); return returnValue; } So [...]
Tag Archives: Extension Methods
IEnumerable Extention Methods and Action
This may be slightly off, but I’ve pretty much figured them out and how they work with lambda expressions. First off, Lambda expressions. These are the odd looking currentItem => expressions you might see in my examples. They are a little misleading, at least to me they were. When I saw: ilist.SomeExtension(currentItem => SomeMethod(currentItem)); I [...]