Archives for the 'C#' Category
My Take on Visual Studio 2008
I just finished five days of Visual Studio 2005 (.NET 2.0) training, with a day of Visual Studio 2008 (.NET 3.5) sprinkled on. My take on VS2008 are as follows:
First, AJAX integration is very tight. I have actually done AJAX the manual way before (with PHP) and I appreciate how much coding VS has […]
Difference Between C# and VB
This is a beautiful interview trivia question: What is the major difference between C# and VB?
Answer: In C# you can write “unsafe” code, i.e., code involving pointers, whereas in VB you cannot.
Update 20 February 2008
Also, VB does not have anonymous methods.
Coding against the DB
If you have to embed SQL in your code, this is how to do it in C#.
Highlights:
the using statement, which is like try-finally
@-quoted string literals
Parameters.AddWithValue(parameterName, value) (new in .NET Framework 2.0)
Coming from an ASP/PHP-MySQL background, it’s great to not have to escape special SQL characters or to enclose varchar values within single quotes.
…
using System.Data;
using System.Data.SqlClient;
…
using […]
Polymorphism Explained
Polymorphism is the ability of an object to represent more than one type.
The MSDN Library explains polymorphism quite well. Emphasis mine.
public class A
{
…
}
public class B : A
{
…
}
“In the example above, class B is effectively both B and A. When you access a B object, you can use the cast operation to convert it to an […]
Comparative Overview of C#
I came across a clear and balanced overview of C# that pits it against C++ and Java. Do note that it was written just after Microsoft released .NET Framework 1.0, so it doesn’t cover generics and anonymous methods. It’s still good, though, as almost every point is illuminated by concise yet intuitive example code.