Home Videos Exercises MCQ Q&A Quiz E-Store Services Blog Sign in Appointment Payment

Introduction of C#

C# is object oriented programming language.


What is C#?

C# is object oriented programming language.

The C# programming language was designed by Anders Hejlsberg from Microsoft in 2000.


Features of C#.

  • Simple
  • Modern
  • Object oriented
  • Type safe
  • Interoperability
  • Scalable and updateable
  • Component oriented
  • Structured programming language
  • Rich library
  • Fast Speed

What is OOPS?

OOPS is a programming approach which revolvs around the concept of "object".
Any entity in the system that can be defined as a set of properties and set of operations performed using entity's property set, is known as object.'

  • Encapsulation
  • Data hiding
  • Abstraction
  • Polymorphism
  • Inheritance

Variables

variables are the names of memory locations where we store data.
variable name is any combination of alphabet (a to z or A to Z), digit(0 to 9) and underscore (_).


Rules for naming variables in C#

  • First character must be alphabet or underscore(_).
  • no commas, blanks allowed
  • no special symbol other than (_) allowed
  • variables names are case sensitive we must create meaningful variables name in our programms.

Types of variables

  • local
  • global
  • static

local variable

local variable can declare and defineinside function of constructor block. It cannot access outside of function block.


global variable

global variable can declare out side of function block. global variable can acces any where in program, if it is public.


static variable

static variable can declare at the class level. No need to create an object to access static variable.


Keywords

Keywords are reserved words, whose meaning is already known to the compiler.

abstract as base bool break byte
case catch char checked class const
continue decimal default delegate do double
else enum event explicit extern false
finally fixed float for foreach goto
if implicit in int interface internal
is lock long namespace new null
object operator out override params private
protected public readonly ref return sbyte
sealed short sizeof stackalloc static string
struct switch this throw true try
typeof uint ulong unchecked unsafe ushort
using virtual void volatile while var

Comments

comments are used to clarify something about the program in plain languagqe.

There are two types of comments in C#.

  • Single line comment.
  • Multi line comment.