Skip to main content

Posts

Showing posts from May, 2010

VB.NET and C# Comparisons

VB.NET Program Structure C# Imports System Namespace Hello Class HelloWorld Overloads Shared Sub Main (ByVal args() As String) Dim name As String = "VB.NET" 'See if an argument was passed from the command line If args.Length = 1 Then name = args(0) Console.WriteLine("Hello, " & name & "!") End Sub End Class End Namespace using System; namespace Hello { public class HelloWorld { public static void Main (string[] args) { string name = "C#"; // See if an argument was passed from the command line if (args.Length == 1) name = args[0]; Console.WriteLine("Hello, " + name + "!"); } } } VB.NET Comments C# ' Single line only REM Single line only ''' XML comments // Single line /* Multiple line */ /// XML comments on single line /** XML comments on multiple lines */ VB.NET Data Types C# Value Types Boolean Byte, SByte ...

How to display an assembly in the "Add Reference" dialog box

When you are developing a class library, you may want Visual Studio .NET to list your library in the Add Reference dialog box on the .NET tab without the user having to browse for it. This issue is not resolved if you install your assembly to the global assembly cache, because the Add Reference dialog box is path-based and does not enumerate the components from the global assembly cache. To display your assembly in the Add Reference dialog box, you can add a registry key, such as the following, which points to the location of the assembly [HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\ MyAssemblies ]@="C:\\ MyAssemblies " where MyAssemblies is the name of the folder in which the assemblies reside. NOTE : You can create the this registry entry under the HKEY_LOCAL_MACHINE hive. This will change the setting for all of the users on the system. If you create this registry entry under HKEY_CURRENT_USER , this entry will affect the setting for only the cur...