Create IEnumberable from interface Programming Software Development by philiop Hi, I'm doing a short test for a job interview that I have. The code is C# and I am very new to this (2 days :S). One of the questions is. Write method to get all IPeople - Write a method in the SchoolManager to get all IPeople (Teachers and Students) in the system. Your method should return an IEnumerable of IPeople. You can make use of the … Re: Create IEnumberable from interface Programming Software Development by Momerath [code]IEnumerable<IPeople> GetAllPeople() { foreach (IPeople person in GetAllTeachers()) { yield return person; } foreach (IPeople person in GetAllStudents()) { yield return person; } }[/code] You'll have to fix the errors because I don't know what the classes are that contain GetAllXXX() methods. Re: Create IEnumberable from interface Programming Software Development by philiop Thank you momerath for the answer. That seems to be working how ever when I try and bind the result to a GridView I get this error Property accessor 'FullName' on object 'School.Code.Student' threw the following exception:'Object does not match target type.' Now fullname refers to the partial class in Student and Teacher like so. [CODE]… Re: Create IEnumberable from interface Programming Software Development by philiop Never Mind. After looking into a further question I only need to bind this to a ListView and bind the data that way. Re: Converting C# ideas to C++ (part 3) Programming Software Development by jonsca …] System::Collections::Generic [/icode] or qualify it as [icode] Generic::IEnumberable<Item ^> [/icode] You're not going to be… Re: Combination ..... Programming Software Development by Momerath …'s not quite fully generic (it uses IEnumerable rather than IEnumberable<T>, etc.) Re: Combination ..... Programming Software Development by Kath_Fish …'s not quite fully generic (it uses IEnumerable rather than IEnumberable<T>, etc.)[/QUOTE] How about if i don… Re: "Specified cast is not valid." - but it is - isn't it?! Programming Software Development by Momerath …. Try changing the type in Line 6 of Program to IEnumberable<SRType>. That should be the only thing you… Re: Combination ..... Programming Software Development by Kath_Fish …'s not quite fully generic (it uses IEnumerable rather than IEnumberable<T>, etc.)[/QUOTE] Can u show the combination… Re: help for fix the error.. Programming Software Development by Momerath To explain a little more, foreach expects the last argument (the one after the in) to have implemented the interface IEnumerable or IEnumberable<T>. Re: Filter IENumerable of Interface with property of class outside of interface Programming Software Development by Momerath [code]IEnumberable<IPeople> GetPeopleForCourse(int courseID) { foreach(IPeople person in … Re: for loop vs foreach c# Programming Software Development by DaveAmour … foreach then the collection you are iterating over must implement IEnumberable or IEumerable<T>. Almost all collections do. Here… Re: Container for Questions in Trivia Game Programming Software Development by DaveAmour … if you have a Deck class you can then implement IEnumberable and your deck is then both a collection of questions…