C# Tutorials
msdn.microsoft.com
msdn.microsoft.com
This is from Visual Studio 2003 and will be a terrible, terrible guide. Yes, that's 2003, over a decade ago.
C# programming has moved far away from the Java inspired boiler-plate of that time (as I assume Java has).
For example the properties tutorial is completely wrong as it doesn't include the new simple syntax which you should be using 95% of the time `public string Name { get; set; }`.
Also the way people use objects in C# has fundamentally shifted, in 2003 people didn't really get OO programming or when it was useful so almost everything was an object, frustratingly so at times.
And of course .net 3.5 & 4 have introduced massive programming paradigm shifts, transforming how you write C# completely, which aren't mentioned here, lambda expressions, async/await and extension methods.
(On top of that MS has never been very good at writing good example code anyway, generally use their code as documentation, not as inspiration. Their 'example' projects are often things to be laughed at, not imitated).
I love it's syntax, the libraries look great, and apparently the performance isn't that bad either.
[1]- http://www.mono-project.com/Main_Page [2]- http://xamarin.com/
That being said, Xamarin has done an admirable job keeping Mono up-to-date on the latest .NET features lately.
I submitted it because I read it last night after starting a new C# project, and was quite surprised to see that it wasn't just a strict subset of C like Objective-C is, but it's a whole language of its own, with some additions and changes that I really really like (especially coming from ObjC).
And yes, C# is only really practical for Microsoft's platforms. But the same could be said about Objective-C and Apple's platforms, and yet we don't mind that. Let's not be inconsistent with our biases.
Not necessarily. If you're doing game development with Unity3D, for example, you're probably going to write much of your game in C#, and it's going to run on Windows, Linux, OS X, Android and iOS.
It is true. You appear to be talking about something else.
Couldn't agree more with that. This is the reason I stick with JVM based languages (Scala, Java) for high level stuff, C/C++ for low level stuff and naturally JavaScript for browser stuff. This pretty much covers everything and at the same time is unbeatable in performance.
What I find missing from C# in this area is the use of operators in interfaces, which would let you do truly generic things such as make a matrix class that allows any element type that supports addition and multiplication.
Which is to say, newer versions of these tutorials probably do not exist.
Or GACs, or finding the right System.Data.SQLite module for your app - http://system.data.sqlite.org/index.html/doc/trunk/www/downl...
Or figuring out how exactly deployments/setups work - where things get put, etc.
I don't know much about java - but it seems easier there - here is the .jar, simple .zip file, look at the manifest - and you are done.
Install-Package System.Data.SQLite
In your VS package manager console and you are good to go.Deployment/Setup is not really something C# or .NET cares about, there are many different forms of deployment. (IIS, Windows desktop, ClickOnce, Azure) and in each case you can do it in several different ways. I agree it's tricky to know what goes where sometimes, but it's more a problem with those targets than with how you build the application in question.
Always deploy your dependency DLLs side-by-side with your code.
Another problem with .NET is that there is a lot to learn, then unlearn - language, api, frameworks, deployment-wise.
That by itself is not bad, if you are an active developer, but if you just given few times a year to fix this and that C# project, then it's a bit more painful.
For example I have to upgrade 32-bit app using Antlr3 and system.data.sqlite (matching 3.7.0.1) to 64-bit, antlr3 newer version and system.data.sqlite (matching 3.8.2) - and after the upgrade there is significant slowdown, and some things do not work (possibly sqlite, but who knows for sure).
I would recommend it if you think you already know C# basics and want to learn more advanced stuff.
(Disclosure: I hate Java)
- lambdas
- Expression trees
- sensible operator overloading
- value type semantics (you can define your own types that behave like primitives)
- reified generics instead of type erasure, which means that you can have an <int,int> table (just two ints instead two pointers to Integer)
- "async monad" baked into the syntax
On the other hand, Java wins easily on the open source lib count
Yes, the CLR gets a major advantage by having a better bytecode language design, but it can't be the real reason Java didn't get lambdas until Java 8.
That being said, Java broke other things along the way back then, if I remember correctly, so in hindsight type erasure for fake generics was maybe not the smartest choice.
C# is a streamlined platform that is designed to work with Microsoft's platforms and tools. If you use what Microsoft has to offer (Visual Studio, Windows, NuGet, IIS, ASP.NET MVC) and some of the really well-maintained OSS packages, you'll have a great experience. Bad news is: you don't get a lot of freedom in terms of platform choice.
Java is a broad platform that comes in thousands of different flavors; there are tons of mature, well-maintained options for just about everything from web framework to IDE to build tool and so forth. The problem is: everyone does everything their own way, so you kind of have to jerryrig everything yourself. Java can feel really janky, but you have a ton of options.
disclosure: I'm ex-Microsoft and LOVE .NET, but I feel that I need to know the JVM better in order to work on some of the projects I love.
[1]: I'm porting my OS X window manager (https://github.com/sdegutis/zephyros) to Windows.
Safe or not, does c# consider such dereference as defined behavior?
You seem to have confused C# with some totally different language [1].
- Null coalescing operator
- Tuple Construction/Deconstruction
- Algebraic data types/Pattern matching
- List comprehensions/array slicing
- Operators in interfaces
After 10 years of C# I really feel that F# is the future.
First sample is C#?
Today you write something like this
var street = (user != null && user.Address != null) ? user.Address.Street : null;
When you could use something like this var street = user?.Address?.Street; public static TReturn Try<TType, TReturn>(this TType value, Func<TType, TReturn> accessor)
{
if (value == null) return default(TReturn);
return accessor(value);
}
The compiler should infer the generic types for you: var street = user.Try(_ => _.Address).Try(_ => _.Street);
Sure the syntactic sugar is nicer but the extension method's not that much worse. var t = new Tuple<int, int>(1, 2);
I apologize if I misunderstood you. var p = SomeFunc();
print("X value is "+p.X);
You would do this (x, y) = SomeFunc();
print("X value is "+x);