C# ASP.NET ADO.NET JAVASCRIPT JQUERY AJAX SILVERLIGHT WPF
C# OOPS HTML&CSS DHTML ASP.NET ADO.NET JAVASCRIPT JQUERY AJAX SILVERLIGHT MVVM WPF SQL SERVER Photoshop Dreamweaver Flash Illustrator
Blog Archive
-
2012
(83)
- September(2)
-
August(81)
- Important WPF Classes and Namespaces
- Applications of WPF
- Programming With WPF
- Limitations of Silverlight and flash
- Silverlight Feature comparison with Flash Features
- How to Add XML File in Your Silverlight Project
- 3 Pixel Shader Effects in Silverlight
- Rotate Image in 3D direction using Silverlight
- First Application of Silverlight
- Silverlight 2.0
- How Install Ajax?
- Ajax Advantage
- JavaScript Loops
- Show a Military Clock and ordinary clock
- How To validate a Form in ASP. Net
- How to show Day of Week
- How to Swap a Image using JavaScript
- Special Character in JavaScript
- Prompt Box in JavaScript
- The use of data adapter.?
- The steps involved to fill a dataset?
- Dataset object in ADO .NET
- Handling Connection Events
- The SQLCONNECTION OBJECT
- Command Constructors
- The SQLCOMMAND OBJECT
- Gridview in ASP.NET
- Introduction Of Master Page
- Server Side State Management
- Query String In ASP.NET
- Cookies in ASP.NET
- State Management in ASP.NET
- Various types of application that we can develop i...
- Properties
- Inheritance ,Polymorphism
- Array,Indexer and Collections
- Control Statements
- Operators, types and variables in C#
- Fundamental of C#
- C# & other Programming Languages
- The WPF Designer
- C# DataTypes
- What is Ajax?
- Silverlight 1.0
- Confirm Box in JavaScript
- Component classes
- Life Cycle of ASP.NET
- The Basics of JQuery
- Jquery Blog Content
- Birth Of WPF
- .Net Frameworks Architecture
- History Of Ajax
- Why Silverlight?
- How to access a URL of parent page in ASP. net
- THE ADO.NET Architecture?
- Architecture of ASP.NET
- Introduction Of Ajax
- Ajax Blog Content
- Introduction of SilverLight
- Silverlight Blog Content
- Introduction to Javascript Blog
- Javascript Blog Content
- Introduction to Ado.Net blog
- Ado.Net Blog Content
- Introduction to C# Blog
- C# Blog Content
- Introduction to Asp.Net
- Asp.Net Blog Content
- Introduction to WPF
- WPF Blog Content
- WPF Interview Question
- Silverlight Interview Question
- Ajax Interview Question
- JQuery Interview Question
- Javascript Interview Question
- DHTML Interview Question
- Ado.Net Inetview Questions
- SQL Interview Questions
- HTML&CSS Interview Questions
- Asp.Net Interview Qusetions
- C# Interview Questions
Fundamental of C#
Namespace in C#
Namespaces group related classes and types, and they define categories in which we can include any new class that provides related functionality.
namespace MyCompany.r4r
{
class MyClass
{
// some code here
}
}
namespace MyCompany.r4r
{
class MyClass1
{
// some code here
}
}
|
Classes and Object in C#
Defining Classes: To define a new type or class, first declare it, and then define
its methods and fields. Declare a class using the
class keyword. The
complete syntax is as follows: [attributes] [access-modifiers] class
identifier [:base-class]
{
class-body
}
For Example.
public class Test
{
public static int Main( )
{
Console.Writeline("This is Class");
}
}
|
Defining Object: A distinction is drawn between
value types and reference types. The primitive C# types (int, char, etc.) are
value types, and are created on
the stack. Objects, however, are reference types, and are created on the heap,
using the keyword new, as in the
following:
Test t = new Test(); |
t does not actually contain the value for the test class object; it contains the address of that (unnamed) object that is created on the heap. t itself is just a reference to that object.
How to create a program in C#?
Step 1: Start notepad from Start -> Program Files -> Accessories -> Notepad so that you can write the HelloWorld program. The program you write in C# is also called as source code.
Step 2: Write the HelloWorld program, you can either type the program shown below into notepad or just copy-paste it from here-
public class Helloworld
{
public static void Main()
{
System.Console.WriteLine("you are welcome in world
|
Step 3: Once you have finished typing
your program you should Save the source code file. In fact after making any
changes to your source code, you should always save the file. To save the
file for the first time in notepad click on File menu -> Save As. In the Save As
dialog select the directory from the Save In dropdown where you want to save
your files, I generally save my files to C:\csharp, and then in the File name
textbox, enter the file name as HelloWorld.cs (although you can provide any name
you want but it should have an extension.cs). and click Save. Once you have
saved the
source code, and if you make any further modifications, in notepad use the
Ctrl+S keyboard short-cut to save your source code file.
Step 4: Since you have finished
writing the source code its time to compile it. Since we are using a
command-line compiler that ships with the .NET SDK, start the command prompt
from Start -> Program Files -> Accessories -> Command Prompt. Or go to Start ->
Run, type cmd and press enter. Now from the command prompt navigate to the
directory where you have stored the source code file by issuing the following
DOS commands.cd\ -To navigate to the root of the derived csharp - To navigate to
the csharp directory. Once you are in the csharp directory where you
saved the source code file earlier, its time to run the C# Compiler csc.exe.
Issue the following command to compile our HelloWorld.cs
program:csc HelloWorld.cs
Step 5: If the compilation of the source code was successful then a new executable (Exe) file by the name HelloWorld.exe will be created in the directory you compiled the source code. To execute the program simply type the name of the executable file at the command prompt.
Points to Remember
- C# code can be written in any text editor like notepad.
- C# Source Code files are saved with the extension.cs.
- C# is a case-sensitive language so you have to be careful while typing.
- C# runs on the .NET Platform, hence you need to install the .NET SDK in order to compile C# programs.
- The C# compiler is contained within the file csc.exe, which generally resides in the C:\windows\Microsoft. NET\Framework\v1.0.4322 directory.









