If your generic type is _TITLE, then you need to do select new _TITLE {Prop = Value} .
Up vote 0 down vote favorite share g+ share fb share tw.
If I create this collection: IEnumerable _titles = null; How can I set the result set from Netflix in this expression: _titles = from t in Titles where t. Id == "ApUFq" select new {t, t. Cast} I am getting: Cannot implicitly convert type 'System.Linq.
IQueryable' to 'System.Collections.Generic. IEnumerable'. An explicit conversion exists (are you missing a cast?
) I understand it's because I am using an anonymous type. _TITLE is a custom complex object I create that exposes a subset of Netflix properties. If I add "_TITLE" in front the of the "new" it says that my object does not implement IENUMBERABLE.
If then _TITLE implements IENUMBERABLE, it says _TITLE does not contain a definition for ADD and still getting conversion error. Basically, I want to set the _TITLE properties with the data returned from Netflix. I have defined _TITLE to contain the fields I need, plus a collection of PERSON (for Cast).
Linq odata link|improve this question edited Dec 29 '10 at 0:43Jimmy21.6k4584 asked Dec 28 '10 at 23:20obautista467113 100% accept rate.
Please fix your text so it formats your code correctly – Pauli Østerø Dec 28 '10 at 23:59.
If your generic type is _TITLE, then you need to do select new _TITLE {Prop = Value}. If you intend to use a generic type, then you need to use var: var _titles = from t in Titles where t. Id == "ApUFq" select new {t, t.
Cast}; So perhaps this is what you meant: var _titles = from t in Titles where t. Id == "ApUFq" select new _TITLE {Title = t}; Something along those lines. Var can be used even if you don't intend to use an anonymous type.
In addition to vcsjones's answer, You don't need to implement IEnumerable on _TITLE. What's going on is that when you write var foo = new TYPENAME { a, be }; it means: create a new TYPENAME, which implements IEnumerable call foo. Add(a) then foo.
Add(b); Example: var names = new List { "Joe", "Mary", "Susan" }; As vcsjones mentioned, You need to use Parameter names when initializing an object, or perhaps you meant to use parentheses and call a constructor var title = new _TITLE { Title = t. ID, Cast = t. Cast }; // or var title = new _TITLE (t.
ID, t. Cast).
I think the way this is suppose to work is the LINQ operating returns IEnumerable. The problem I think that was arising was he was using {} as a collection initializer when he meant to use it as an object initializer. – vcsjones Dec 29 '10 at 1:59.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.