Thursday, 13 August 2015

OOP With C# Language

OOP:

C# is an object oriented programming language, which means that it is a true object oriented. C# supports all the key oop features like 

  • Object
  • Classes
  • Polymorphism
  • Abstraction 
  • Encapsulation
  • Inheritance 
Object:

Object are the basic run time entity in an object oriented system.
in other words object is an instance of classes.

Classes:

classes is a collection of objects of similar type.Once a class is defined,any objects can be created which belongs to the class.

Ploymorphism:







Assignment Operator in C language

=   This operator is called assignment operators

it is used for assign value in the variable like

a=90;
b=89;
etc.

Loops in C# language

A loop statement allows us to execute a statement or group of statements multiple times and following is the general form of a loop statement in most of the programming languages:
C# programming language provides the following types of loop:
for
while
do while
foreach

Syntax of for loop:

(1)
for(initialization; conditions;update_statements)
        statements

(2)
for(initialization; conditions;update_statements)
{        
block of statement
}

E.g.

main()
{
int a;
for(a=0;a<10;a++)
Console.WriteLine(" hello {0}",a);
}

output:
hello 0 hello 1 hello 2 hello 3 hello 4 hello 5 hello 6 hello 7 hello 8 hello 9

E.g.

main()
{
int a;
for(a=0;a<10;a++)
{
Console.WriteLine(" hello ");
Console.WriteLine("%d",a);
}
}

output:
hello 0 hello 1 hello 2 hello 3 hello 4 hello 5 hello 6 hello 7 hello 8 hello 9

Syntax of while loop:
while(condition)
{
statement's
}

E.g.
main()
{
int a=0;
While(a<10)
{
Console.WriteLine(" hello ");
Console.WriteLine(a);
a++;
}
}

output:
hello 0 hello 1 hello 2 hello 3 hello 4 hello 5 hello 6 hello 7 hello 8 hello 9

E.g.
main()
{
int a=0;
While(a<10)
{
Console.WriteLine(" hello {0}",a);
a++;
}
}

output:
hello 0 hello 1 hello 2 hello 3 hello 4 hello 5 hello 6 hello 7 hello 8 hello 9
Syntax of do while loop:

do
{
statement's
}
while(Condition);

E.g.
main()
{
int a=0;
do
{
Console.WriteLine(" hello ");
Console.WriteLine(a);
a++;
}
While(a<10);
}

output:
hello 0 hello 1 hello 2 hello 3 hello 4 hello 5 hello 6 hello 7 hello 8 hello 9

E.g.
main()
{
int a=0;
do
{
Console.WriteLine(" hello {0}",a);

a++;
}
While(a<10);
}

output:


hello 0 hello 1 hello 2 hello 3 hello 4 hello 5 hello 6 hello 7 hello 8 hello 9

foreach:

foreach statement repeats a group of embedded statements for each element in an array or an object collection. The foreach statement is used to iterate trough the collection to get the desired information but should not be used to change the contents of the collection to avoid unpredictable side effects.
Syntax:
foreach(type identifier in expression)
statements 

eg:
int ev=0,od=0;
int [] arr=new int [] {0,1,2,3,4,5,6,7,8,9};
foreach(int a in arr)
{
if(i%2==0)
en++;
else
od++;



}
Console.WriteLine("odd numbers{0} even numbers{1}",en,od);

Wednesday, 12 August 2015

Arithmetic Operators in C language

Arithmetic Operators in C language:-

In C language has following arithmetic Operators:

+   Plus   
-    Minus 
*   Multiply 
/    Divide 
%  Modulus 


+ Plus Operator:-

It is used for add two operands 
like
a=90;
b=10;
c=a+b; Result c=100

- Minus Operator:-

It is used for Subtract  1st operand to 2nd Operand 
like:
a=90;
b=10;
c=a-b; Result c=80

*  Multiply  Operator:-

It is used for Multiply two operands 
like
a=90;
b=10;
c=a*b; Result c=900

/ Divide  Operator:-

It is used for divide 1st operand to second operand
like
a=90;
b=10;
c=a/b;  Result c=9

% Modulus  Operator:-

It is used for calculating remainder 
like
a=90;
b=10;
c=a%b;  Result c=0








Operators in C language with example

Operators are the symbol which operates a variable. 
E.g.
 - is a operator to perform Subtractions.
In C programming language has the flowing types of operators to perform various operations.
(1) Arithmetic Operators 
(2) Assignment Operators
(3) Relational Operators
(4) Logical Operators 
(5) Increment and decrement Operators
(6) Conditional Operators
(7) Bit wise Operators 
(8) Sort Hand Operator 
(9) special Operator 




Differences Between the Versions of the MVC Framework

ASP.NET MVC’s first production release was in March of 2009. The initial version provided the basic plumbing: the extensibility model and a view engine based on ASP.NET Web forms.

In March 2010, version 2 was released and included more than 15 new features, such as API improvements and support for ASP.NET 4. MVC 3 was released in January 2011.

MVC 3 introduced the Razor view engine and many other features that simplified the creation of views and made it easier to maintain a separation of concerns.

In August 2012, MVC 4 was released, along with a massive wave of Microsoft products, including Visual Studio 2012. MVC 4 includes a new framework for creating HTTP services, a mechanism for allowing MVC application to change which view is selected based on the user agent, seamless deployments to Windows Azure, and bundling and minification, which can improve performance by reducing the number and size of the HTTP requests made by the client in order to render your page.

ASP.NET MVC Model View Control

What is ASP.NET MVC ( Model View Control)?