I think this tutorial is not very good, use the openbooks, these are better.
This is not very descriptive :rolleyes:. Can you explain why it's not well written, or why you would prefer using (what I assume is) books over this tutorial?Quote:
I think this tutorial is not very good, use the openbooks, these are better.
(x) => x + 1;
int _method(int x) { return x + 1; }
pretty cool, cheers for the info.Quote:
Event's have practically been superseded by the Observable class in .NET 4.0. I don't see a real need for them any more. This class will be talked about in Unit 3.
Really, all you need to understand about lambda's is they're a short hand way of writing delegates. And essentially what is a delegate? A delegate is type used to represent a function.
So when someone writes:
What they're really saying is most likely:Code:(x) => return x + 1;
Code:int _method(int x) { return x + 1; }
That aint valid lambda syntax. The return keyword there is unnecessary and won't compile. You can say x => x+ 1, or x => { return x + 1; }. The braces are necessary in the case of multi-statement lambdas or those returning a unit.Quote:
So when someone writes:
Code:(x) => return x + 1;
Oh, damn, you're right. I'll get that fixed.Quote:
That aint valid lambda syntax. The return keyword there is unnecessary and won't compile. You can say x => x+ 1, or x => { return x + 1; }. The braces are necessary in the case of multi-statement lambdas or those returning a unit.
I think in that case it's worth getting a Delegates (II) done, which I'll do today. I didn't want to go too indepth with the C++-analysis/difference because it's bad to assume the reader has knowledge of C++, but I have an idea how I'll get that fixed.Quote:
Also, in your delegates lesson, you mention that they're "safe function pointers". You miss out the major differences, that a method also has an object instance associated with it. One might call the C++ equivalent a functor. Delegates also hold an invocation list and are capable of assigning many methods to a single instance (the MulticastDelegate), where a native function pointer is single-dispatch only.
I can't mention either of those yet as generics haven't been covered.Quote:
You should probably mention the special delegates Func<> and Action<> too, since they play a major role in lambdas.
Read these things and practice, once you get the basics down you can attempt a server.Quote:
I'm probably going to get flamed for this and shit, but can you program CO Private Servers using C#? I tried learning C++ but that's fuckin' ridiculous and I heard that C# was basically the same thing but simplified. Anyway, if anyone can give me lessons one on one via MSN or AIM or whatever, please PM me and let me know. Thank you very much.
If you take a look at the private server sources you'll notice that for conquer anyways almost all of them are written in C#.Quote:
I'm probably going to get flamed for this and shit, but can you program CO Private Servers using C#? I tried learning C++ but that's fuckin' ridiculous and I heard that C# was basically the same thing but simplified. Anyway, if anyone can give me lessons one on one via MSN or AIM or whatever, please PM me and let me know. Thank you very much.