Live data from Hacker News

C# Tutorials

msdn.microsoft.com

21–30 of 66 posts

Re: C# Tutorials

#21
post #8

Operator overloading is super useful - I help maintain FluentCassandra and we overload the implicit conversion operators to make it seamless to convert from built-in .NET types and their associated Cassandra types. It makes a MASSIVE impact on the user experience and amount of boilerplate code it eliminates.

Doing ObjC for the past 5 years, I jumped on the Apple-fanatic bandwagon and hated loudly on operating overloading. But I really really loved being able to use + on two strings. So much nicer than `[a stringByAppendingString: b]`!

Operator overloading is a powerful thing, but C# strikes a balance. It doesn't allow overloading assignment, logical operators and so on. While it should be used carefully, it really makes a difference for scientific types such as vectors.

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.

Re: C# Tutorials

#22
post #10
post #4

In broad strokes, what are the differences between Java and C# and why should I bother with it? (Disclosure: I hate Java)

C# is years ahead on the language feature side: - 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 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…

Java 8 supports lambdas

Re: C# Tutorials

#23
post #5

From a distance, C# looks like an incredibly awesome language, but the way it's tied so closely to Visual Studio and Windows really crimps its growth. I love it's syntax, the libraries look great, and apparently the performance isn't that bad either.

Mono and Xamarin [2] are things you should be looking at. [1]- http://www.mono-project.com/Main_Page [2]- http://xamarin.com/

Once we wanted to do app in mono for production, epic fail. Maybe simple apps would do but not if you need WCF which we needed. It had memory leaks and was incomplete just look at WCF site.

Re: C# Tutorials

#24
post #3

These feel pretty outdated. C# 2, I believe? It has generics and delegates, but none of the things C# is appreciated for these days, such as LINQ, lambdas, async/await, etc.

In fact, there's written "Visual Studio .Net 2003", so pretty outdated I'd say. There are no references about Lamda expressions, LINQ, dynamic support, async support and all the other awesomeness C# gives.

Re: C# Tutorials

#25
post #10

Earlier quoted context omitted.

C# is years ahead on the language feature side: - 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 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…

The way I heard it put some time ago was, Java/JVM couldn't make some important changes because it would break backwards compatibility in an unacceptable way (I'm assuming this means there are mission critical apps written in Java 1 that the whole world depends on), but since C#/.NET were from scratch, they were free from this legacy baggage and could take huge steps forward.

The JVM didn't want to break compat to add generics into the runtime, hence they adopted the erasure model. Other language features are still quite doable on top of the JVM (as evidenced by plenty of more advanced languages targeting the JVM).

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.

Re: C# Tutorials

#28
post #9

Fortunately this tutorial is very high-level and assumes you know another high-level programming language, which allows it to keep a quick pace, preventing it from getting too dry or slow. 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…

> C# is only really practical for Microsoft's platforms.

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.

Re: C# Tutorials

#29
post #12

Unsafe code( pointers ), shows and example of a copy, where a byte* is casted to a int* and then dereferenced. Such operation in c produces undefined behavior( even if byte points to data large enough ). Safe or not, does c# consider such dereference as defined behavior?

There is no concept of "dereferencing" in C# because there are no pointers. Technically it is possible to force the environment to allow you to write unsafe code but I've never seen this in reality and I'm having a hard imagining where it would be useful.
Post reply on HN