Introduction To C
Introduction To C
.NET Framework
.NETFramework(pronounceddot net)isasoftwareframework
developedbyMicrosoftthatrunsprimarilyonMicrosoftWindows
The.NETframeworkisarevolutionaryplatformthathelpsyouto
writethefollowingtypesofapplications:
Windowsapplications
Webapplications
Webservices
History of C#
DevelopedbyAndersHejlsberg(Microsoft).from
Denmark.
BasedonJavaandC++,buthasmanyadditional
extensions.
Cross-developmentwithVisualBasic,VisualC++,
F#,IronPython,andmanyother.NETlanguages
Overview
The following reasons make C# a widely used professional
language:
Modern,general-purposeprogramminglanguage.
Objectoriented.
Easytolearn.
Structuredlanguage.
Producesefficientprograms.
Partof.NETFramework.
OpenyourVisual Studio
OntheFilemenu,clickNewProject.
ThentheNewProjectdialogboxappears.Thisdialogboxliststhe
differentdefaultapplicationtypes.
SelectConsoleApplicationasyourprojecttypeandchangethenameof
yourapplicationatthebottomtextbox.
Ifyouarenotcomfortablewithdefaultlocation,youcanalwaysentera
newpathifyouwant.
ThenClickOK.
AfterclickOKbutton,youwillgetascreenlikethefollowingpicture.
In this session
Basicstructureofac#program.
WhatisaNamespace.
PurposeofMainmethod.
Simple Program
Program Explanation
Anamespaceisusedtoorganizeyourcode.
TheHelloWorldApplication namespacecontainstheclassHelloWorld.
Mainmethodistheentrypointintoyourapplication.
Sample program
Output
A) Concatenation
B) Placeholdersyntax-MostPreferred
Output
Arithmetic operator
Output
Comparison operator
Output
Conditional operator(And)
Conditional
operator(OR)
Ternary use
Example:
for(inta=10;a<20;a=a+1)
{
Statements(s);
}
Output
Output