Showing posts with label C# Programming Language. Show all posts
Showing posts with label C# Programming Language. Show all posts

Saturday, 25 August 2012

Simple if statement in C# !!

Hello Friend !! Today I am going to tell u about decision making statement and branching in C#....

Decision Making & Branching Statement !!
A C# program is a set of statements that are normally executed sequentially in the order in witch they appear.We will study this concept one by one.These are mainly three type which is as given below..
  1. Branching Statement (simple if,if-else,Nested if...else,else if ladder ,switch statement).
  2. Jumping Statement (go to label,continue break)
  3. Looping.(while,do-while,for)
Firs we will study about branching statement which is as given below...
Branching Statement:=>
                When a program break the sequential flow and jumps to another part of the code is called branching statement.
Decision making Statement with Simple If Statement:=>
                  The if statement is a powerful -making statement and is used to control the flow of execution of statements.Its two way decision statement and is used to in conjunction with an expression.
if(expression )
It allow the computer to evaluate the expression first and then depending on whether the value of the expression is true or false.The program at this point has two paths to follow one for the true condition and the other for the false condition.
some example of the decision making using if statement are:
1)if(bank balance is zero)
borrow money 
2)if(room is dark)
    put on lights.
The syntex of the simple if statement :
if(boolean expression)  
{
statement block;
}
statement-x    
Description:The 'statement-block' may be a single statement or a group of statements.If the boolean-expression is true then the statement-block will be executed otherwise the statement -block will skipped and the execution will jump to the statement-x
Example:
{
int value =10/5;
if(value ==2)
{
console.write(true);
}
Output:
true
The flow chart of simple if statement:=>
Now ! You can download the copy of the article in pdf file  by just click on below download link...
If still You have any query regarding  to this  article then please post your comment i will 100% reply back  you…..Thanks……:)

Tuesday, 7 August 2012

DATA TYPE IN C# !!

                             Data Type In C#

Data Types is  describes that what type of data a variable can hold .Every variable in C# is a associated with a data type.Data type specify the size and type of value that can be store in C# is a language rich in its data types.

C# commonly divided into three categories which are as give below:=>

  1. Value Type.
  2. Reference Type.
  3. Pointer.
The diagram of the data type that is how it categorize as give below :=>


                                                                     
Value Type:=>
                 Value Type which are of fixed length are stored on the stack and when a value of a variable is assigned to another variable ,the value is actually copied.This mean the two identical copies of value available in memory.

The value type in C# is further group into two categories :=>

  1. User-Define Type or complex Type
  2. Predefine Type or Simple Type .
User-Define value Type:=>
                            User-Define value which we can use own complex type is known as user-define data type which is include struct type and enumeration.

Predefine value  Type:=>
                           Predefine value type are also called simple type which are further subdivided as five below.
  • Numeric Type.
  • Boolean Type.
  • Character Type.
Further Numeric Type include integral type,floating type and decimal type.
Further integral subdivided into signed type and unsigned  types.

Numerical Type=>
                  Numerical Type include integral type,floating point and decimal types.These are shown diagrammatically ....
Integral Type:=> 
  •   Integral Type can hold whole number such as 123,-96 and 5639.
  •   The size of the values that can be stored depends on the integral data type we choose .
Signed Integer:=>
                    =>Signed Integer Type can hold the both positive and negative numbers.

The memory size and range of all the four signed integer data type is given below.


Now diagram of the Signed integer is given below:=>


Unsigned integers:=>
  • We can increase the size of the value stored in an integers by making it unsigned.for example a 16 bit short integer can store values in the range -32,768 to 32,767.However by making it unshort ,it can handle values in the range of o to 65,535.
The size and range of all the four unsigned integer data type is given below..

Now the diagram of the unsigned integers is given below :->

Floating point Type :=>
                         Integer type can hold only whole numbers and therefore we use another type known as floating point type to hold number  containing functional part such as27.59 and -1.375.
There are two kind of floating point store in C#:=>
  1.   float type values.
  2. double types 
Float type values:=>
              The float type value are single-precision number with a precision of seven digits
Double Type values:=>
              The double type value represent  double-precision with a precision of 15/16 digits.

=>Double -precision type are used when we need greater precision in storage of floating point numbers.
=>Floating point data type are support a special value known as Not a Number (NaN).
NaN:=>NaN(Not a Number ) is used to represent the result of operators such as dividing by dividing.Where actual value is not produce.

Decimal Type:=> 
  •  The decimal type is a high precision 128-bit data type that is design for use in financial and monetary calculation.
  • It can store values in the range 1.5*10^-28 to 7.9*^28 with 28 significant digits 
  • To specify a number to be decimal type we must append the character M(or m) to the value like 123.45M.If we omit  M the value will be treated as double .
Character Type:=>
                In order to store single characters in memory  c# provides a character data  type called char .A char is assumes a size of two byte  but in fact it can hold only a single character.it has been design for  hold a 16 bit Unicode character .

Boolean Type:=>
                           Boolean type is used when we want to test a particular condition during the execution of the program.There are only two type of boolean that is true and false.Remember this this two word declare as keywords.Boolean type is denoted by the keyword bool.


Reference Type !!
Reference Type also divided into two group which is given below:
  1. User-Define (complex) Types 
  2. Predefined (Single ) Types.
User-Define Types:
               User-Define Types refer to those type which we define using predefined types.They includes 
  • Classes 
  • Delegates 
  • Interfaces
  • Arrays
Predefines Types:
            Predefined include two data types
1) Object Type
2)String Type.

Object Type:
           The object type is the ultimate base type of all other intrinsic and user define type in C#.
String Type:
          The string data type in c# provide its own string  type for creating  and manipulating strings 

Now !! You can download the copy of this article which created in Microsoft Word by click on below download link.

I hope this post will help you !!

If still you have some query regarding to this article then please post your comment after that 1 will 100 % help you...

Thursday, 2 August 2012

OPERATOR IN C#

                   Operator in C#
                                 


                             An operator is a symbol that tell the computer to perform certain mathematical or logical manipulations.Operator are used in programming to manipulate data and variables.They usually form a part of mathematical or logical expressions.

                     C# support a rich set of operation .C# operator  can be classified into a number of a number of related categories as give below.


  • Primary operator.
  • Unary Operators.
  • Arithmatic Operators.
  • Relation Operators.
  • Logical Operators.
  • conditional Operators.
Now the explanation of Operator is givn below one by one..

 Primary Operator:=>
  • Groping()
  • Member.
  • Struct Pointer Member Variable ->
  • Method call().
  • Increment ++.
  • Decrement--.
  • Constructor call(new();).
  • Array stack allocation[].
  • Sizeof.
  • Checked.
  • Unchecked.
Unary Operator's:=>
  • +
  • -
  • !
  • ~
  • ++
  • --
  • Type cast.
  • *
  • &
Airthmatic Operator's:=>
  • *
  • /
  • %
  • +
  • -
  • >>
  • <<
Relational operator:=>
                             When we compare two quantity and depending on their relation take certain decision.For example we may compare the age of two person or the price of two items and so on.These comparisons can be done with the help of relational operator.
  • <
  • <=
  • >
  • >=
  • ==
  • !=
These are relation Operator in C#..

Logical Operator:=>
                         The logical operators are used when we want to form compound condition by combining two or more relations.For example...
                                             a>&&x==10

  • &&
  • ||
  • !
  • &
  • |
  • ^
Conditional Operators:=>
                                   This operator is used to construct conditional expression of the form.For example...
exp1?exp2:exp3
where exp1,exp2 and exp3 are expressions.

Now you can download the copy of this article in pdf format by just click on below download link...

 I hope this post will help you !!

If still you have some query regarding to this article then please post your comment after that 1 will 100 % reply back you...                           

Wednesday, 1 August 2012

KEYWORD'S IN C#

                   C# Keyword's
                              
                                   

  1. Keyword's are the words whose meaning has already explain to the C compiler .Its mean these are predefine.
  2. The keyword can not be use as variables names because if we do so we are trying to assign a new meaning to the keyword which is not allowed by the computer.
  3. The keyword's are also called "Reserved Word".
  4. Example of keyword is False,interface ,Override ,Finally.
There is a list   of all keyword's in C# which is as given below........


Now you can download the copy of this article in pdf format by just click on below download link...


I hope this post will help you.

Thanks !!
If still you have some query regarding to  this then please post your comment after that i will 100% help you…:)
                      

IDENTIFIER AND VARIABLES

                                  Identifiers
              
                                              

  1. Identifiers is everything which is a user defined. for example variable name,function name ,templates ,class etc
  2. Identifier is everything which is used ti identify any language is known as identifier as the name suggestion.
  3. identifier have some rule that how they must define like begin with a character or $ sign.             
There are following name valid identifier in c#:=>

1.       WORLD

2.       world
3.       w_orld
4.       HelloWorld
5.       Z
6.       Z
7.       \u098world
8.       @public
9.       _world


                      Variables




Variables an entity that may vary during program execution is called variable.Variable names are names given to location in memory.These locations can contain integer,real or character constant.
The value of a variable can be changed through assignment or through use of the ++ and - operators.

Declaration:=>
              
             In  C# all variables are  declared before they are used. In the declaration of variables is specify a data type and a name for the variable so that memory can be set aside for the variable.

Syntax of Variable:=>

                           scope=initial value;


The scope determines the accessibility of the variable (public, local,
private) and the default is private. 

The data type specifies what kind of data the variable will hold.
Optionally the variable can be initialize to a specific value. 

All variables must be initialize (given a value) before they are used in
any calculation. 

If the variables are not initialize  the compilation of the program will fail.

Now you can download the copy of this article in pdf format by just click on below download link..


I hope this post will help you.

Thanks !!

If still you have some query regarding to  this article then please post your comment after that i will 100% reply back  you…:)                                                                        















Monday, 30 July 2012

MAIN FEATURE OF C#

                Main Feature Of C#
                                
  1.  Pointers are missing in C#. 
  2. Unsafe operations such as direct memory manipulation are not allowed. 
  3. In C# there is no usage of "::" or "->" operators. 
  4. Since it`s on .NET, it inherits the features of automatic memory management and garbage collection. 
  5.  Varying ranges of the primitive types like Integer, Floats etc. 
  6. Integer values of 0 and 1 are no longer accepted as Boolean values. Boolean values are pure true or false values in C# so no more errors of "="operator and "=="operator. "==" is used for comparison operation and "=" is used for assignment operation.
  7. C# has been based according to the current trend and is very powerful and simple for building interoperable, scalable, robust applications. 
  8.  C# includes built in support to turn any component into a web service that can be invoked over the Internet from any application running on any platform. 
  9.  C# supports Data Encapsulation, inheritance, polymorphism, interfaces. 
  10. Overflow of types can be checked.
  11. C# includes native support for the COM and windows based applications. 
  12. C# currently (as of version 4.0) has 77 reserved words.
  13. here are no global variables or functions. All methods and members must be declared within classes. Static members of public classes can substitute for global variables and functions.
  14. Enumeration members are placed in their own scope
Now you can download the copy of this article in pdf format by just click on below download link...

 I hope this post will help you !!

If still you have some query regarding to this article then please post your comment after that 1 will 100 % reply back you...



Saturday, 28 July 2012

HOW C# DIFFER FROM C++ & JAVA

                 How C# Differ From C++????


As started earlier ,C# was derived from C++ to make it the language of choice for C and C++ programmers.C#  therefor shares major parts of syntax with c++ .However ,the C# designers introduced a few changes in the syntax of C++ and removed a few feature to reduce the common pitfalls that occurred in C++ program development . They also added a number of additional features to make  C# a type safe and web-enabled language...


Some Point hare:->

  1. C# compiles straight from source code to executable code,with no object file.
  2. In c# class definition does not use a semicolon at the end.
  3. c# does not support #include statement.
  4. c# checks for uninitialized variable and gives error messages at compile time .In c++ an uninitialized variable goes undetected thus resulting in unpredictable output.
  5. c# does not support pointer types for manipulating data.
  6. We can only create object in C# using the new keyword.
  7. In c# switch can also be used on string value.
  8. C# does not support multiple code inheritance 
  9. When overloading a virtual method ,we must use the override keyword.
  10. C# does not support default argument.

                     How C# Differ from Java????

Like c#, Java was also derived from C++ and therefor they have similar roots.Moreover C# was developed by Microsoft as an alternative to Java for web programming .C# has borrowed many good feature from Java which has already become a popular internet language.There is exist a number of differences between C# and Java .


Some Point hare:->

  1. although c# uses .Net runtime that is similar to Java runtime ,the c#compiler produces an executable code.
  2. C# has more primitive data type.
  3. Unlike Java all c# data type are object.
  4. Array are declared differently in C#.
  5. c# support the struct type ans Java does not.
  6. Java does not provide for operator overloading.
  7. C# provides static constructors for initialization.
  8. in Java the switch statement can have only integer expression,while C# support either an integer or string expressions.
  9. C# allows a variable number of parameter using the params keyword .
  10. c# check overflows using checked statements.
Now you can download the pdf file of this article by just click on the below download link...

I hope this post will help you !!

If still you have some query regarding to this article then please post your comment after that i will 100 % reply back you..



Friday, 27 July 2012

INTRODUCTION TO C#

Hello Friend !! Now i am going to explain C# web application in this blog where  you will learn daily new topic of c# one by one. with example of every topic .You can download ppt of every topic from hare.........
                                                                  
                                                  Introduction To C# 

C# (pronounced "C sharp") is a simple, modern, object-oriented, and type-safe programming language. It will immediately be familiar to C and C++ programmers. C# combines the high productivity of Rapid Application Development (RAD) languages and the raw power of C++.


                                             What is C# ?


C# (pronounced "C sharp") is new computer-programming language developed by Microsoft corporation ,USA .C# is fully object-oriented language like Java and is the first component -oriented language .It has been designed to support the key feature of .NET Framework ,the new development platform of Microsoft for building component base software solutions.It is a simple ,efficient ,productive and type- safe language  derived from the popular C and C++ language.Although it belongs to the family of C/C++ ,it is a purely objected ,modern language suitable for developing web based application.
       C# is designed for building robust,reliable and durable component to handle  real-world application.
                    
Now you can download the copy of this article in pdf by just click on below download link..

I hope this post will help you !!

If still you have some query regarding to this article then please post your comment after that 1 will 100 % help you...


Share

Twitter Delicious Facebook Digg Stumbleupon Favorites