| HTML Tutorials |
|
|
| XML Tutorials |
|
|
| Browser Scripting |
|
|
| Server Scripting |
|
|
| .NET (dotnet) |
|
|
| Multimedia |
|
|
| Web Building |
|
|
| Java Tutorials |
|
|
| Programming Langauges |
|
|
| Soft Skills |
|
|
|
| To Begin With C# Programming |
|
To Begin With C# Programming
|
|
C# is a language that provides
|
|
Simplicity of Visual Basic
Power of C++
Concentrate on the high-value tasks;
Portability of Java
|
|
First C# program to display “hello, world “ on the console
|
using System;
class Hello
{
static void Main () {
Console.WriteLine("hello, world");
}
}
|
|
|
The source code for a C# program is typically stored in one or more text files with a
file extension of .cs, as in hello.cs. Using the command-line compiler provided with
Visual Studio .NET, such a program can be compiled with the command-line directive
|
|
csc hello.cs
, which produces an application, named hello.exe. The output produced by this
application when it is run is:
|
|
|
|
The using System; directive references a namespace called System that is provided by
the Microsoft .NET Framework class library. This namespace contains the Console class
referred to in the Main method. Namespaces provide a hierarchical means of organizing
the elements of one or more programs. A "using" directive enables unqualified use of
the types that are members of the namespace. The "hello, world" program uses Console.
WriteLine as shorthand forSystem.Console.WriteLine.
|
|
The Main method is a member of the class Hello. It has the static modifier, and so it
is a method on the class Hello rather than on instances of this class.
The entry point for an application — the method that is called to begin execution — is
always a static method named Main.
The "hello, world" output is produced using a class library. The language does not
itself provide a class library. Instead, it uses a class library that is also used by
Visual Basic .NET and Visual C++.NET.
|
|
The program does not use a global method for Main. Methods and variables are not
supported at the global level; such elements are always contained within type
declarations (e.g., class and struct declarations).
|
|
C# language does not use either "::" or "->" operators. The "::" is not an operator at
all, and the "->" operator is used in only a small fraction of programs — those that
employ unsafe code. The separator "." is used in compound names such as Console.
WriteLine.
|
|
The program does not contain forward declarations. Forward declarations are never
needed, as declaration order is not significant.
C# does not use #include to import program text. Dependencies among programs are
handled symbolically rather than textually. This approach eliminates barriers between
applications written using multiple languages..
|
Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
Keywords To Begin With C# Programming, vb net programming, asp net programming, visual basic programming,
c# vb net, visual basic net programming, visual c++ programming, source code programming,
c# source code, windows forms c#, visual studio net c#, c# net framework, c# asp net,
visual basic c#, visual studio c#, c# dot net
|
|
| HTML Quizes |
|
|
| XML Quizes |
|
|
| Browser Scripting Quizes |
|
|
| Server Scripting Quizes |
|
|
| .NET (dotnet) Quizes |
|
|
| Multimedia Quizes |
|
|
| Web Building Quizes |
|
|
| Java Quizes |
|
|
| Programming Langauges Quizes |
|
|
| Soft Skills Quizes |
|
|
|