Click here to Skip to main content
15,912,578 members
Home / Discussions / C#
   

C#

 
GeneralRe: return generic collection from webservice Pin
arkiboys28-Feb-07 6:44
arkiboys28-Feb-07 6:44 
GeneralRe: return generic collection from webservice Pin
arkiboys28-Feb-07 6:46
arkiboys28-Feb-07 6:46 
AnswerRe: return generic collection from webservice Pin
mike montagne28-Feb-07 8:32
mike montagne28-Feb-07 8:32 
GeneralRe: return generic collection from webservice Pin
arkiboys28-Feb-07 21:52
arkiboys28-Feb-07 21:52 
GeneralRe: return generic collection from webservice Pin
mike montagne1-Mar-07 6:25
mike montagne1-Mar-07 6:25 
AnswerRe: return generic collection from webservice Pin
mike montagne28-Feb-07 18:18
mike montagne28-Feb-07 18:18 
GeneralRe: return generic collection from webservice Pin
arkiboys28-Feb-07 21:57
arkiboys28-Feb-07 21:57 
GeneralRe: return generic collection from webservice Pin
mike montagne1-Mar-07 6:49
mike montagne1-Mar-07 6:49 
OK. As I wrote in my post, it is impossible for me to tell from just your code snippets just how the declaration has to be written because I cannot research your types. But you have to learn how to do this.

What you have here is a relatively common error. In your professional career (I'm assuming you are a student) you will encounter this error occassionally when you get a bit too casual about matching your type declaration with a return or reference type (etc -- matching one type with another, so that assignments and comparisons can be made). Remember, you are working with a type safe language, and therefore type compatibility is enforced (because it *has* to be).

So what you have to do here is an absolutely obligatory skill. But this is a very routine thing to resolve.

The error is about a type mismatch. It always means that what you are comparing or assigning is not compatible with its counterpart.

As I intimated in my earlier post, if my assumption that Forward was the type to declare (which is only deduced from its presence in your foreach iteration), you have to look up the return type for your method call and declare your list to be that type. Evidently, you (too) are not making the right deduction as to what the necessary type is, or you are not declaring it properly. You will probably have to change it in your foreach iteration when you get it right in the statement above.

The most efficient way to do what you are trying to do *is* indeed to get a reference to the list. The only other alternative is bad practice -- to iterate the list, populating your own -- and this too (of course) will require type matching, so it wouldn't let you off the hook.

You have the tools (libraries) before you to do the research on the type declaration, so we can't help you with that. You have to play with the declaration and/or assignment syntax until you get it right -- and the easiest and fastest way to get it right is to look up the return type for the method call, then see any language rules (which we all need to see when we are students) for how to make the necessary declaration.
Question"cardlayout" in C# ? Pin
bubuzzz28-Feb-07 5:09
bubuzzz28-Feb-07 5:09 
AnswerRe: "cardlayout" in C# ? Pin
Luc Pattyn28-Feb-07 10:24
sitebuilderLuc Pattyn28-Feb-07 10:24 
GeneralRe: "cardlayout" in C# ? Pin
bubuzzz1-Mar-07 5:16
bubuzzz1-Mar-07 5:16 
QuestionWebbrowser control Pin
hung_ngole28-Feb-07 5:03
hung_ngole28-Feb-07 5:03 
AnswerRe: Webbrowser control Pin
Stefan Troschuetz28-Feb-07 5:28
Stefan Troschuetz28-Feb-07 5:28 
GeneralRe: Webbrowser control Pin
hung_ngole28-Feb-07 6:24
hung_ngole28-Feb-07 6:24 
GeneralRe: Webbrowser control Pin
Stefan Troschuetz28-Feb-07 7:53
Stefan Troschuetz28-Feb-07 7:53 
QuestionInvokeMethod ???????????? Pin
Saaaaz28-Feb-07 4:49
Saaaaz28-Feb-07 4:49 
AnswerRe: InvokeMethod ???????????? Pin
Dave Kreskowiak28-Feb-07 5:21
mveDave Kreskowiak28-Feb-07 5:21 
GeneralRe: InvokeMethod ???????????? Pin
Saaaaz28-Feb-07 23:29
Saaaaz28-Feb-07 23:29 
GeneralRe: InvokeMethod ???????????? Pin
Dave Kreskowiak1-Mar-07 2:24
mveDave Kreskowiak1-Mar-07 2:24 
Questiondate Conversion problem[Modified] Pin
jaganil28-Feb-07 4:37
jaganil28-Feb-07 4:37 
AnswerRe: date Conversion problem[Modified] Pin
kubben28-Feb-07 4:51
kubben28-Feb-07 4:51 
AnswerRe: date Conversion problem[Modified] Pin
Luc Pattyn28-Feb-07 4:55
sitebuilderLuc Pattyn28-Feb-07 4:55 
QuestionIO Exception for Full Capacity Pin
Ian Uy28-Feb-07 4:30
Ian Uy28-Feb-07 4:30 
AnswerRe: IO Exception for Full Capacity Pin
kubben28-Feb-07 4:54
kubben28-Feb-07 4:54 
GeneralRe: IO Exception for Full Capacity Pin
Ian Uy28-Feb-07 16:34
Ian Uy28-Feb-07 16:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.