This probably sounds like a dumb question, but I still don't really understand what it's used for. Programs and stuff, but how, and why?
Is there a proper answer to this question?
This probably sounds like a dumb question, but I still don't really understand what it's used for. Programs and stuff, but how, and why?
Is there a proper answer to this question?
C# is commonly used as an efficient way to create software for distributed environments. Its very useful with its networking utilities and the fact that its quick to get it done. Its also quite fast to learn. I think I effectively learned C# in about 2 weeks or so (not every little tid bit but the majority of what one should know).
But there is never an exact answer to why a programming language should be used or what it's purpose is when talking about languages like Java, C++, and C#. This is pretty much just because its not dedicated only to scripting and its able to do anything (if you have the proper resources for the job). But most languages like C# are able to as well.
C# is basically like Java, but dedicated for use with Windows. Or at least that was the idea behind it when it was created. Whenever Java came around, it was cross platform, and Windows guys (fond of using C++, but not exactly fond of the difficulties that came with it) wanted a version that was specifically optimized for windows. They asked Java to do it, but they didn't do it since that basically defeats the purpose of Java in the first place. So, long story short, they made their own. It's a simplistic, entirely class based version of C++ for easy and fast development of relatively simple applications that don't require a lot of back end work, or ones that don't require a lot of specialized optimization.
As for what you can make with it, well...that's kind of up to how far you want to take it. You can make almost anything you want with almost any language you want to use. The only downsides are that the higher level you get, the less control you have over the machine. This is why some people learn assembly in order to make some specialized optimizations to their code. Sometimes you can leave out unnecessary checks if you know your program won't do a specific action. Basically, though, you can do almost anything you want with C#. Games, software, applications, whatever. Sometimes you might be better off using a lower level language to optimize things, and make it faster, but C# is great for rapid prototyping and development of simple applications.
tl;dr
Like Devon said, there isn't really an answer. It was made in order to simplify development for windows based applications. Some lower level languages are more powerful, but you can do quite a lot in C#. It's basically just Java, but it's specifically optimized for Windows, and it has syntax that is more similar to C++.
I can say that in terms of game programming. C# is superior to Javascript, and the only reason is that you have more control. The extra control is not that much of a benefit over Javascript but i tend to prefer C# because the naming conventions are more traditional for use of functions, variables, etc. I program on Unity, UDK and CryEngine and thats where C# shines for me because C# has a broad definition basis where it's more universal and i can transfer scripts from engine to engine much easier than Javascript. Many times on javascript i'll have to adjust more to port scripts over.
I'm not a pro programmer, i program because the team i work with, nobody rly programs so i got pushed into it because of my logic, i adapt to scripting easier than my peers. Overall, i'd say C# is great to work with, most of the language is pretty cut and dry; and once you get the hang of it, you can jump to other scripting languages, it's quite universal.
Yeah C# isn't that hard to learn. I'm learning it at school atm, it is pretty easy, so far..
What are C# 's networking utilities?
Can you use the applications you create with C# on Linux, or do you have to use an other language for that?
Are you still able to create games compatible with Linux with C#? Because C# was the microsoft version of Java it would be understandable if it can only create applications or games compatible with windows.
Yes, you can use the Mono framework on linux (including android),ios,windows.
you can, it's because most game engines have their own proprietary operating system in a way. It's a bit hard to explain but games almost run like emulators in the sense that they can run sub systems. For example Unity can take its own text format without needing it installed on the OS. The rules apply to coding, once it's done, Many game engines have something i guess you can call a "dictionary' or "language translator" that works in the middle sequencing, buffering, etc. Because of this, you can run things that wouldn't be formatted properly on other OS's.
have a look at this one
http://www.mono-project.com/Main_Page
edit: oops didnt read other threads, the suggestion was already done ;)
to say learning a programming language or any other language is easy seems a little strange to me.
I cant say i can learn spanish in two weeks. Yes i can learn a few phrases and buy a beer. But to have a decent conversation with a native about politics is something entirely different.
It just takes time learning a language properly.
Maybe its different if you have a firm basics in an other Objective Oriented language like Java, then you pick it up maybe faster cause there are so many similarities.
Same with spoken languages, you can put languages into groups. But to go from a West Germanic language like Enligh to go to Chinese is sometime totally different. Yet going from Spanish to Portugese is much easier.
Learning a programming language is learning the Libraries, so you can program faster and faster. Same with talking as a tourist with a dictionary in your hands trying to ask directions ;) Its not the same as Knowing the language....
unless you are like this guy :D http://www.youtube.com/watch?v=BPHv9KqpgqM
I totally agree with you. A thing you didn't know is that I knew the basics of Java already, well, the basics of C# aren't that hard to learn at all. But when I get into the more advanced stuff it's going to get harder, pretty sure about that. So far it has been relatively easy for me, but it'll get harder very soon :)
i learned a lot of c# from this site http://www.learnvisualstudio.net/
has everything from basics to really advanced stuff
The mono project is amazing. But there is no recent version of Xamarin studio for Linux available yet. I hope they will release a newer version for Linux aswell.
short answer, everything.
long question, is it used for everything? no, can it be? yes.
C# is what I call a "businessy" language. It's made for productivity and it enforces "best practices". It's semi-interpreted, like Java, so there's a large disconnect between what you are writing and what the computer is running. That makes it easier to use, yes, and that gives it a place to be used. It also makes it difficult to write really efficient code.
A great many (perhaps most) people using languages like that don't really know what it means when they define a class, for example. They just accept it as a feature of the language. C# gives you pointers, but you can't really picture what's going on in memory. It's all hidden behind frameworks and virtual machines. Understanding how a computer actually works is not a requirement for C# and similar languages, and that can be dangerous, in a way.
C#'s place is in business software, user interfaces, non-real-time portions of games, etc. It cannot really be used where real-time performance is desired, memory or CPU time is limited, or direct hardware access is necessary. Those are the domain of vanilla C or C++, if not even assembly.
This is not C#'s fault, and neither is it exclusive to C# or Java, but it sort of comes bundled with this idea that there is plenty of memory and CPUs are really, really fast, so optimizing isn't a priority. I've heard it stated as "hardware is cheap, coding time is expensive". This attitude easily tends toward bloated and/or inefficient code. See: Firefox, MS Office, Catalyst Control Center, pretty much any IDE out there, etc.
c# not used in real time applications
you have the XNA framework for games in conjunction with DirectX. Ok, maybe not the best example but pretty real time to me. But also https://code.google.com/p/aforge/ there are frameworks who do support hardware level and real time programming. Memory control is also possible in c#. Also such fine control of garbage collection only leads to human errors, there is nothing much wrong with the garbage collection in .Net And isnt code reuse through virtual machines on multiple platforms hard to beat?
In the end it comes down to knowing what you are doing, and yes there are just different tools to use for different jobs, no need to compare them.
Understanding how a computer actually works is not a requirement for C# and similar languages, and that can be dangerous, in a way.
Dangerous? do you mean less secure?
By "real-time" I didn't mean games, and I didn't say C# can't be used for games. Rendering code and such is not written in C#, it's provided to C# through frameworks. On top of that, games can be written in C#, the non-performance-critical portions.
I was referring to things like audio processing, where the exact code you want to run needs to be ready at just the right time. Also, any system-level code, drivers and such.
When I was talking about memory management, I did not mean garbage collection. I meant knowing how things are packed into memory and how much space things take up. Garbage collection is all well and good, but you have to remember that there is just as much room for human error in the .NET garbage collection code as there is in a custom memory management system. You're trusting that Microsoft implemented a robust system, rather than trusting that your own team did. Not necessarily better or worse, but it is different, and it does exclude C# from certain low level applications.
That also leads into what I meant by "dangerous". Someone who learned to code first in C# and did that for years will run into a wall if they ever try C or C++. Suddenly, they have the responsibility to manage memory, which isn't even something you need to think about in C#. Or if they go into embedded programming, same story. Same goes for high performance game engines or system level programming.
C#, Java, and other "easy" languages are kind of a pit, in that it's easier to get into than to get out. My problem is not at all with C# itself, it's with the atmosphere around (mostly) C# and Java. It's with universities teaching C# and Java and none of the fundamentals of computer science.
I was at a university (a full 4 year program) for 2 years that was all about Java and C#. I was told several times by different professors that I didn't care about the low level details, and I didn't need to worry about it. I learned what a stack is, but there was never any mention of the stack, or the general idea of a call stack. In top level courses, it was not expected that I even know what assembly language is. I left after 2 years because of all that (among other things), and the remaining courses that I didn't take were on .NET GUI stuff (with Forms), project management, and connecting with databases (which we'd assume someone else set up for us).
Schools like that are now commonplace, and typically more popular than tradition computer science or computer engineering schools. Add in the difficulty of moving from that sort of education to projects and environments where the details matter, or where knowing how common algorithms and data structures work, and you could imagine the effect this could have on the industry as a whole.
But again, not C#'s fault.
Plot twist: quality programmers manage and create quality custom garbage collectors.
I think many people are missing the point of what C# can do and just argue about whats best. Most programming language works quite similar and only a very few things separate their methodology. For example C# vs Js. C# in game development is more secure in the sense of allowing the choice of having more than 1 script within a confined script file (if you get what i mean). While Js will require you to have specifically 1 script per script file. This can be a double edged sword in many ways. Another thing is that for gaming C# has some variable/void functions that are quite more extensive for example physics can be defined more thoroughly because of the vocabulary set up. Js has an advantage for beginners where closing variable and functions are easier. Same with a simpler format, but can be misread if you're not used to other peoples programming methodology, so it's very effective if only YOU use that script.
I know there are tons of positive and negatives, but these are really nit picky points that in the grand scheme don't change in great way. There are tons of ways to go around missing vocabulary, definitions, etc.
About the garbage collection...it's quite pointless because most of the time in game engines there is one already there preprogrammed for the user which cuts out a lot of work. If it's not used, people will create their own, which is quite easy because if you can program at least at an intermediate level, you understand how to do garbage collection, nothing too complex.