C Sharp Development 101 – A Tutorial Series

In this tutorial series we are going to look at C# Development using the Visual Studio 2010 Express editions.  This will take you from the basics of installing Visual Studio 2010 Express, to the Object Oriented Programming style associated with C# and other languages, dabble in some database access (Access & SQL Server Express) and finally, design a project that will pull all of our knowledge together into a final solution.

We are going to begin by downloading the Visual Studio 2010 express from Microsoft’s website so that we can get started on some C# development.  After the file has been downloaded you will need to have a connection to the Internet so that the program can download the necessary files to complete the install.  For the sake of customization we won’t walk through the rest of the install and will pick up with some add-ons that will make your coding experience easier.

With the Express edition now installed, it is good to know that the express editions of Visual Studio 2010 do not support extensibility.  This means that the ability to install plug-ins and add-ons is not included.  If you happen to acquire or have a full version of Visual Studio 2010 then the option is there for you to add these plug-ins that have helped me out in a tough spot before.

  • Visual Assist X
    • This is probably one of the best applications out there for intellisense and document syntax highlighting.  Now many of you might be saying that Visual Studio already does this.  Yes they do, but not as well as Visual Assist X.  This add-on will look into your added in files such as the Boost library, and retrieve all of the Boost functions and try and piece together a description of what that particular function would do.  Syntax highlighting is the best around with the quick option to do minimal to maximum highlighting.  A must have for the avid programmer but will run you $249 for a one year subscription and $49 maintenance fee every year afterwards.  This price tag might discourage most but take the 30 day trial and take it for a test run.

  • Ghost Doc
    • A product of SubMain, this add-on will allow you to document your code quickly and efficiently using XML markup.  To generate these comments it uses the elements type, parameters of the function as well as its name to generate the comment.  This is especially useful for people who do not enjoy documenting functions in their code.   Most promising add-on if you are looking for code documentation.

  • AnkhSVN
    • A free SVN add-in for Visual Studio that allows you to connect to a repository, browse the branches all within the comfort of the Visual Studio environment.  Very easy to use for people who want to start a community project on Google Code or host their own.  A must have for people who like to collaborate and don’t want to hover over one persons computer to review code.

AnkhSVN logo

All of these have been personally used and are highly recommended for use when developing for the .NET framework.  The next part in this series will go back to an old classic for programmers; Hello World.  We will go through making a project file and printing Hello World to the console as well as on a form.  As always, any problems with the series or if you just have questions post to the comments so that we may learn from each others mistakes and grow as a community.  If you can’t wait until the next post, here is how to start making a Hello World console app.  Until next time, Happy Hacking!

107 thoughts on “C Sharp Development 101 – A Tutorial Series

  1. I second Michael’s sentiments. C# makes Windows development palatable. The IDE, compiler, and debugger in all editions of Visual Studio are really slick. I only use C# for native apps though, my heart still belongs to PHP when doing web development.

    Anybody that ever has to build anything for Windows should definitely learn C#… it’s RAD without compromising.

  2. I love C# so much that I use it all the time on Ubuntu thanks to Monodevelop, I’ve even made a program to send data to a Pic18f2550 using the usb port, all in C#.
    you should keep in mind making a new part in this awesome tutorial, to show how to use monodevelop on ubuntu or even in a mac. that would be great!

    Greetings from Colombia.

  3. I also love the .NET platform. I love C#, I love LINQ, I love the .NET technologies, I love F#, I love everything somehow connected to .NET, .NET languages, etc. Give me more .NET and I’ll be happy. Go to hell with Java 7.

  4. I have been using C# for a couple years, and its great! For years I only knew embedded programming, and it was really tough to develop things when I couldn’t even make a simple PC app to communicate with the microcontroller! Now I can whip up simple utilities, or even complex ones, pretty quickly.

    And for what its worth, one of my buddies who is a $130k/yr veteran programmer recently started doing some stuff with C#, and he really likes it. He does a lot of C and Python, but he said C# has really nice structure and he likes the IDE. A lot of people gripe about C# for some reason, but its actually really nice. Yeah, you get more control with C++, but sometimes you don’t need that much control.
    -Taylor

  5. Now there’s a coincidence, I downloaded Visual C# Express not two hours ago. I need a program that takes a BMP stored in RGB565 format and spits out C-source describing an array containing the hex values of the file so that I can use it in a PIC+LCD project (hah, good luck deciphering that one).

    No luck thus far though.

  6. you know… this is i believe my first post here. in the 6 or so months i have been watching this site i have been “happy”. Seeing you …people… go through and suddenly “offer” .net/mono developmental tutorials on your front page make me wonder if i should even bother coming back.
    .Net/Mono is basically a dead/dieing language with microsoft/novell both disbanding massive amounts of projects .net/mono look to be disbanded soon.
    While i have no proof of that actually happening Techrights will show you that they have been disbanding at what was “last month” an accelerating rate. you should be encouraging the use of development languages/enviroments from places not in the middle of a “fire-sell”

  7. What does this have to do with hacks? If you’d focused on some specific thing that makes C# cool (like elegant uses of LINQ, or clean uses of generics) rather than advertising commercial software (VS2010, Visual Assist X) it’d be different. As much as I love C#, the post is not informative or interesting or inspiring.

  8. I think that while this post may not be inspiring, it is quite possible (hoping) a lead-in to bigger and better things. I myself requested more software h@ck$ as well as some more ground-up style information when I took the HAD survey..

  9. @Amtal:
    “the post is not informative or interesting or inspiring.”
    Yeah, thats YOUR opinion…there are about 11 other people having another opinion. So please…stop trolling. Thank you.

  10. So far they’ve provided an intro and some info on additional packages in preparation for the tutorial. Lets give Greg a break and a chance to actually write a tutorial shall we? “this post is not informative or interesting” – it’s not meant to be, it’s a bit of a starter/intro to what’s coming. Good grief.

  11. well I don’t feel compelled to download and setup all this stuff from this article

    I dunno, get all this stuff and sit on it for the next tutorial on a undisclosed date sometime?

    and being Ctarded what is this stuff? yea he explains it, but what is boost library, why do I want to highlight it? Do I need ghost doc for simple hello world learning tutorials? why would I want to have a SVN repository when I dont even know hello world

    to me its a link list and not “OMG WOW THAT! is something I want to get into”

    this could have been truncated, and included the next planned article in one roll, then I might have been more enthusiastic about it as something to get my feet wet with over the long weekend

    oh well (shrug)

  12. Not that I have a problem with learning C# or anything – quite the opposite, it’s on my todo list, but this is most certainly NOT one of the reasons I read hackaday. Don’t get me wrong – want to teach me about raw memory writing in other programs spaces, or some clever hardware interface using it? Sure, awesome. But, there’s a million billion basic programming tutorials out there, Hackaday doesn’t need to start with them as well.

  13. C# and Visual Studio 2010 are rapidly becoming the best development environment period. The only thing that’s lacking is Javascript intellisense support. JQuery is an awesome technology and ironically enough really does an excellent job augmenting ASP.NET development by making client side UI elements and AJAX data access very simple to program and debug.

    Silverlight (XAML, a WPF derivative) is going to be an awesome GUI based web modeling tool but it’s severely limited by browser and consequently the host OS. So, ultimately I’m holding out hope for HTML 5 to replace both Javascripting and Flash/Silverlight style code. It will be incredibly easy to build intellisense technology around HTML 5.

  14. RE: AnkhSVN, I prefer the file system based client to the IDE environment. It’s just so much easier to simply fire up Visual Studio and do your work without all the integrated synchronization hoopla.

  15. Sorry, the whole Idea of C (the beginning my uncle helped develop it) was cross platform compatibility, adding a bunch of M$ PROPRIETARY stuff makes it a USELESS LANGUAGE. I don’t care how “Nifty” it is.

    The problem is like dealing with DirectX, if it locks you in to one vendor it’s a BAD THING.

    Whatever the merits are of C# they are outweighed by that simple fact. C# could be the end all super fantastic wonderful language from heaven, Tie it to M$ and it’s just another useless non-standard standard.

    I’m sure to get flamed by all the people who have serious investments of time, but I have been programming for 30 years, I have seen them come and go and Proprietary is ALWAYS BAD. Breaking standards, splitting groups dissension etc… The fact that it splits us here is more than enough to shy away.
    Java’s ability to run on multiple platforms has effectively
    unified all the UNIX flavors, and has allowed some software companies to
    deliver to both UNIX and Windows customers. This is the greatest challenge to the Microsoft dominance of PC-based software.

    Thus the REASON behind C#. If I can’t cross compile it’s not of any use to me. Yes there are some C# compilers under development for Nix environments, but they are fare from cross systems compile ready.

    Anyway I haven’t seen anything in C# that would make me sacrifice the ability to compile for multiple systems. What happens when you want to compile a version for some future PDA android type pad etc. or just for Linux Unix or even Mac? Your screwed. Might as well add some libraries in C++ to do the same functions and wait for the C# fad to pass.

    Sure you can run Mono(.NET for nix) but do you rally want to deal with M$ and it’s whims, which often are deliberate attacks on open systems, described nicely in the infamous M$ Halloween letters?

  16. Visual Assist is great for languages that have poor or no support for auto-complete in VS but C# already has pretty amazing Intellisense support via the .NET framework and Visual Studio. I would assume they did not remove this feature from the Express version.

    C# is a great fun language, and it’s excellent for quick development and prototyping. It is virtually identical to Java with a few minor exceptions. I think there’s a few of those proto-systems out there that have a simple micro and display that can be programmed in C# too.

  17. Someone mentioned Silverlight, Um isn’t that dead yet? It’s only real use is to deliver DRM’ed content.

    HTML5 doesn’t actually Need it, video is better done with ogg/theora or better yet VP8 (better picture less memory, faster and OPEN)

    x264 may be open, but it’s still has strings attaching it to one vendor.

    Anyway silverlight, C# who wants a development environment limited by the economic motives of the companies tied to it.
    M$, apple, nokia etc etc gets a hair up it’s ### and sorry all your work and your site has to be re-done.
    Proponents of such systems make headaches for those who try to make content available on as many platforms as they can.

    So I develop in silverlight, oh sorry Iphone, android Linux etc etc.. WHY? Anyway after the DISASTER NBC had with the Olympics silverlight is effectively dead. Most systems STILL can’t view the Olympics!!

    NBC DROPPED IT.

  18. “Now there’s a coincidence, I downloaded Visual C# Express not two hours ago. I need a program that takes a BMP stored in RGB565 format and spits out C-source describing an array containing the hex values of the file so that I can use it in a PIC+LCD project (hah, good luck deciphering that one).”

    That would be easy in MATLAB.

  19. @Eric, just get any language that can read the file,and the rgb pixel color (most game dev systems) and dump into a file, crap 2 off the top of my head with tutorials are processing and love2d, probably pygame

    or in other words don’t multipost off topic

  20. I have this love have thing with C# … but fortunately love portion is slightly more, depending on context and what I’m working on. Admittedly, I have only dabbled in C#, so my observations might be somewhat limited.

    I absolutely love the managed allocation concept in C#, it’s something C++ should adopt natively as a standard. Even C++ CLI is ok (which is what I use for some projects), but the syntax can be a bit hairy.

    The extensive use of namespaces (as opposed to header files declarations) in C# .NET libraries are well organised too. Again, I wish C++ compilers would use this concept.

    Getter/setter methods rock.

    That said, I’m not too enthused about having both class declarations and implementations in one big scope. Things get a bit messy when you have huge classes to deal with. (Maybe this is something I need to brush up on?)

    VisualStudio Express seems to be quite slow when dealing with C# source code, which annoys me.

    The #1 thing that really annoys me is the lack of native code generation in C#. Not a fan of MSIL at all, and quite frankly the JIT compiler doesn’t even start to compare with natively compiled C++ code in terms of CPU performance. While this may not be a big deal if you do mostly GUI programming, but for things like serious CPU based data processing, it doesn’t cut the mustard.

  21. “I second Michael’s sentiments. C# makes Windows development palatable.”

    Exactly. _Windows_ development. And only in small scale. Don’t even start with Mono.

    It really is not palatable at all when you realize you have serious performance problems (no, wall really). And same thing when you realize that you’re paying lots of $$ for MS to get desent sw licences, and yet they are buggy crap. Yes, both the licences and the software.

  22. I will definitely be following this, I happen to love C# as well as most of everyone here. I would like to see some insight with respect to OpenGL (I know its not meant for C#) if possible. I have recently completed a 3D laser scanner (project website coming soon) using C#, and the OpenGL libraries & linking are lacking substantially (I’ve tried SharpGL, Tao Framework, OpenTK,… etc)

  23. The are a number of readers who don’t use windows, osx or even linux and will these readers may start reading other sites more and hackaday less as the number of ms, apple or ubuntu hacks increases.
    Hoping HAD keeps its balance.

  24. C# really shines when it comes to creating a usable user interface in 15 minutes.

    I hope you go into hardware interfacing so this is more relevant to HaD patrons; not many of us want to create a software suite just to monitor I/O.

  25. Great article, I look forward to follow up material.

    As a software developer I have used C# as my primary language for the last 9 years. The whole .NET eco system has matured greatly. My only gripe was moving from .Net1.1 to 2 as there were some code breaking changes to the libraries.

    I’m currently working on a C# winforms GUI to drive a 4WD robot over wifi using a web cam and an xbox 360 controller. The MS tools are making this a fairly painless and even fun endeavour.

    Keep up the great work guys :)

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.