Posted By: The Channel 9 Team | Jul 26th, 2004 @ 3:09 PM | 136,083 Views | 29 Comments
Dan Fernandez, here, demonstrates how to build a cool little application in Visual C# Express Edition (you can download that from the Channel 9 Express site). 

Follow along as Dan takes you through the demo's source code and gives you a visual tour of C# Express.

Make sure while you are at it you submit an application to Channel 9's Summer of Express contest for a chance to win an XBox, Halo 2 and a year of Xbox live.
Tag: CSharp
Media Downloads:
Rating:
0
0
moofish
moofish
Living in Scotland, UK
i used to program a little, nothing serious. However I can see that these features look really good - really productive - well done.

samuel
gswitz
gswitz
Geoff
How super cool!  The more I see the more I like C# Express!

Asynch Background Worker (reporting progress (do work, report change, run worker completed)) is super powerful and easy, easy to use!  Next, the general RAD stuff is really impressive.  This video is a great example of how easy it is to add, edit and debug complexish code.  In debug, intellisense works in the watch window and you can view html from memory (variables) in a visualizer window.  Daniel shows how to use a dictionary with a key and an image class (keeping images in memory and never writing them to disc). 

RAD tools demonstrated include showing how to easily add the fully qualified name for a resource or add using to the top of the code with the appropriate namespace for missing data types.  Refactor and extract method are demonstrated which allow you to take a piece of code an set it as a new function.  You can see definitions of functions without jumping to the definition of the function.  You can click definitions, 'surround with' to automatically add a try catch.  Next, you can call a function without adding the stub for the new call.  The IDE then will offer to create the method stub for the new function and it will create the stub with the correct return (or void) and add necessary data types to the definition.  Code snippet expansions ('For Each' for example) will write out for you and you just pick a variable name, type and a collection to use for your for each and it's written.  Now you can just add the code you want to execute for each whatever.  Rename refactoring is shown to rename variables and objects in the program and it will change the reference in all comments, strings and code.  You can use rename refactoring to rename a progress bar for example. 

Thanks, Daniel, for another great demo!
Dan
Dan
Thanks Samuel and Geoff, definitely appreciate it Smiley

I've added a walkthrough of the code and some of the UI for the application on my blog if people want to know more about how the application works.
 
Thanks,
-Dan
Thank you! great show! Smiley C# Express realy rocks, any news on next beta?
keep the good work

/Tyko
Nice post. Though I do not have either of the two required OS (XP or Windows 2003 Server) to run the Express Editions of VC# or VB, I'd like to see the code that gets the return string from the HTML query passed to Google. Can you guys please post the code for the GetGoogleImages() function?

The search and replace is a good thing if it actually looks up object references and renames only those that actually match the object. I hope it doesn't simply perform a text-based search like what we already have. Consider this:

udtChild.Foo();
udtChildren.Goo();

I want to rename udtChild, which is an instance of a control, to udtBar. With a text-based search and replace, I end up with the unwanted scenario where all occurances of udtChild become udtBar, including the occurance of the substring udtChild in udtChildren. So, in effect, my code becomes:

udtBar.Foo();
udtBarren.Goo();

which is not so great. Thanks for the great post.
Gimped
Gimped
@caption goes here@
Kind of unfortunate that when Dan was demonstrating the IntelliSense Try Catch feature that he set the exception as System.Exception. A missed opportunity to teach newbie programers a best practice of not catching System.Exception.
Dan
Dan
Thanks Sathyaish,

One thing to note about your post is that you can install C# Express on Windows 2000 as well as XP and 2003. I'm not sure if this helps you, but I wanted to make sure you knew.  You can find the system requirements here.

Visual C# Express can be installed on any of the following systems:

  • Microsoft Windows® 2003 Server™
  • Windows XP
  • Windows 2000
To your question about how refactoring works, you are correct, we use the power of the compiler to find the exact references that need to be changed when invoking a refactoring rather then a using a simple search and replace.  The goal being that when you invoke a refactoring, you can trust that it's change the right code.  For more information, you might want to see Jay Bazuzi's blog which can provide more detail into how we've implemented refactoring.

Also, you can find the source code for the entire project, including the GetGoogleImages code here.

Thanks,
-Dan   

Dan
Dan

Tyko,

We haven't announced when Beta 2 will be available yet, stay tuned....


Gimped,

I hear what you're saying with not explaining try/catch, but what I was trying to show was how the tool makes adding try/catch statements easier rather then best practices for try/catch. The ResetForm method doesn't have an "expected" exception so I set it as System.Exception to catch any exception. I was going to add the try/catch code for the WebRequest where I could catch the System.Net.WebException type and see if the error was a 404 error, but it involved lots more time, code and might have been confusing for someone who hasn't programmed with the System.Net namespace before.

Thanks,
-Dan 

Hello, Dan!

I was itching to say thanks, but the slow connection wouldn't let me. Finally, I've made my way through.

Like always, you guys are amazing. I gather you put up the link to the zipped source code only after my post? Amazing! Thanks a big bunch, Dan.

It comes as news to me, and in that a pleasant one that I can run VS Express on Windows 2000 as well. Thanks for that info. I really didn't know that. I recollect reading something about...but never mind. I am way too forgetful.

I actually tried installing both, VB Express as well as VC# Express Editions on my PC around the time the betas were released. Also scraped through the instructions that said it appears to hang after the first reboot, while installation. But when I tried, it looked as though it had hung even prior to the first boot. There was a blank progress bar, and after a seemingly endless wait, no progress. So, I dropped the idea.

I thought if there have been major changes to the .NET Base Class Libraries, then I might as well stick to .NET 1.1, because I'm supposed to be doing a project on VC# with VS2003 in this month or the next. We've already started. So I didn't chase the idea.

Thanks again, Dan. I am excited about the way you guys are treating us all on Channel 9. In general, I'm overwhelmed by the responses and the attitude Microsoft employees have towards others. I guess that is another trait that makes people like Microsoft.
Microsoft Communities