News
IBM to offer mobile security as a service IBM will start delivering mobile security-as-a-service (MaaS) through its own cloud infrastructure in India, a move that is expected to better address in-country data requirements... IBM Spectrum Computing: IBM has enlarged its portfolio of software-defined infrastructure solutions with cognitive features for workload management.  * LiFi internet technology has been introduced, the new type of wireless internet connection that gives 100 times faster than traditional WiFi -- Invented by Professor Harald Haas from the University of Edinburgh. * Sci. Rachid Yazami has developed a smart chip that charges smartphones in less than 10 minutes. BenQ has launched BlueCore projector - Consumer electronics major BenQ has launched its first BlueCore laser light source projector. For those unaware, devices with BlueCore laser technology have a high contrast output of 80000:1 with an extended lamp life and efficiency. *** 
  Jan 3 2015 10:37PM     Mohammad Shaik
  0 Comments    1611 Views  
Here Mohammad Shaik provided a short tutorial with example, With the Basics of C# programming.
C# - Overview
  1. C# is a modern, general-purpose, object-oriented programming language developed by Microsoft and approved by Ecma and ISO.
  2. C# was developed by Anders Hejlsberg and his team during the development of .Net Framework.
  3. C# is designed for Common Language Infrastructure (CLI), which consists of the executable code and runtime environment that allows use of various high-level languages to be used on different computer platforms and architectures.
The following reasons make C# a widely used professional language:
  • Modern, general-purpose programming language
  • Object oriented.
  • Component oriented.
  • Easy to learn.
  • Structured language.
  • It produces efficient programs.
  • It can be compiled on a variety of computer platforms.
  • Part of .Net Framework.
Programming Features of C#
Although C# constructs closely follow traditional high-level languages C and C++ and being an object-oriented programming language, it has strong resemblance with Java, it has numerous strong programming features that make it endearing to multitude of programmers worldwide.
Following is the list of few important features:
  • Boolean Conditions
  • Automatic Garbage Collection
  • Standard Library
  • Assembly Versioning
  • Properties and Events
  • Delegates and Events Management
  • Easy-to-use Generics
  • Part of .Net Framework.
C# and its Features
  • C# is a simple ,modern,object oriented language derived from C++ and Java.
  • It aims to combine the high productivity of Visual Basic and the raw power of C++.
  • It is a part of Microsoft Visual Studio7.0.
  • Visual studio supports Vb,VC++,C++,Vbscript,Jscript.All of these languages provide access to the Microsft .NET platform.
  • .NET includes a Common Execution engine and a rich class library.
  • Microsofts JVM eqiv is Common language run time(CLR).
  • CLR accommadates more than one languages such as C#, VB.NET, Jscript, ASP.NET,C ++.
  • It support garbage collection, automatic memory management and a lot.
C# Program Structure
The example program is to print 'The Developer Tips',

A C# program basically consists of the following parts:
  • Namespace declaration
  • A class
  • Class methods
  • Class attributes
  • A Main method
  • Statements & Expressions
  • Comments
Let us look at a simple code that would print the words "The Developer Tips":

using System;
namespace MyFirstApplication
{
   class MyFirstApplication
   {
      static void Main(string[] args)
      {
         /* my first program in C# */
         Console.WriteLine("The Developer Tips - Beyond the Knowledge");
         Console.ReadKey();
      }
   }
}

Compilation and Execution
Steps:
  1. Open Visual Studio
  2. Locate the menu bar and Select File-> New-> Project
  3. Choose Visual C# from templates, and then choose Windows.
  4. Choose Console Application.
  5. Specify a name for your project, select the physical path, and then click the OK button.
  6. The new project appears in Solution Explorer.
  7. Write code in the Code Editor.
  8. Click the Run button or the F5 key to run the project. A Command Prompt window appears that contains the line 'The Developer Tips'.
You can compile a C# program by using the command-line instead of the Visual Studio IDE:
  1. Open a text editor and add the above-mentioned code.
  2. Save the file as MyFirstApplication.cs
  3. Type csc MyFirstApplication.cs and press enter to compile your code.
  4. If there are no errors in your code, the command prompt will take you to the next line and would generate MyFirstApplication.exe executable file.
  5. Next, type MyFirstApplicaton to execute your program.
  6. You will be able to see "The Developer Tips" printed on the screen.
I hope this page will helps to learn Basics of C#. Thanks.
BackToTop
Comments



 
Search
Recent Posts
Create Amazon ElasticCache Using Memcached in CSharp
Oct 29 2018 12:09PM Posted By Amose
Get Google Map Lat Lng (Geo Point) By Pincode in C#
Oct 28 2018 12:09PM Posted By Pranav
Google URL Shortener in C#
Oct 20 2018 12:09PM Posted By Sanjay
Bind Gridview from CSV file in Asp.Net C#
Oct 5 2018 12:09PM Posted By Michael
Call WebService method from jQuery in every 1 minute
Sep 26 2018 12:09PM Posted By John
Gridview custom CSS in ASP.Net
Sep 14 2018 12:09PM Posted By Micheal Ryan
Read excel file and bind to Gridview in C#
Sep 10 2018 12:09PM Posted By Micheal
Tags
Follow us on Facebook
Follow us on Google +
Recent post in your Email inbox.
Enter your email address: