WELCOME TO BHATI TRICKS WRITE FOR US ADVERTISE YOUR BLOG/SITE HERE POST YOUR ARTICLE/TRICK HERE



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

Sunday, 21 July 2013

DATA TYPES IN C#

0 comments
DATA-TYPES-IN-C#


DATA TYPES IN C#:-
C# provides various built =-in data types. Built-in data types are the predefined data types.
The following table lists some f the built-in data types.
S.NO
data type
RANGE
1
byte
0 TO 255
2
sbtype
-128 TO 127
3
short
-32,768 TO 32,767
4
ushort
0 TO 65535
5
int
-2,147,483,648 to 2,147,483,648
6
uint
0 to 4,294,967,295
7
long
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,808
8
ulong
0 to 18,446,744,073,709,551,615
9
float
-3.402823e38 to 2823e38
10
double
-1.79769313486232e308 to 76931386232e308
11
decimal
-792281625142643375593543950335 to 8162514264337593543950335
12
 char
A Unicode  Character
13
string
A string of Unicode characters
14
bool
True or false
15
object
An object
NOTE:-Built-in data types are represented at the machine level. The storage requirement, therefore, depends on the hardware. The #Bytes column in the preceding table depicts the bytes required to store the value in the memory.
c# also provides user-defined data types. You will learn about user-defined data types in subsequent chapters.

TYPES OF DATA TYPES:-
C# supports two types of data types. The types of data types supported by c# are:-
1.)                VALUE TYPES:- They directly contain data. Some examples of the value types are char, int, and float, which can be used for storing alphabets, integers, and floating point number, respectively. When you declare an int variable, the system allocates memory to store the value. The following figure shows the memory allocation of an int variables.
DATA-TYPES-IN-C#

2.)                REFERENCE TYPES:- The reference types do not maintain data but they contain a reference to the variable. Which are stored in memory. Using more than one variable, you can use the reference types to refer to a memory location. This means that if the value in the memory location is modified by one of the variables, the other variables automatically reflect the changed value. The example of a references type is string data type.
DATA-TYPES-IN-C#
The above figure shows the memory allocation of a string value “HELLO” in a variable named Str.
Previous post:- VARIABLE DECLARATION IN C#
Next post:-
NOTE:- PLEASE POST YOUR QUARRIES IN COMMENT BOX FOR US




VARIABLE DECLARATION IN C#

0 comments
VARIABLE-DECLARATION-IN-C#

VARIABLE DECLARING IN C#:-
A variable is a location in the memory that has a name and contains a value. The value could be a integer, such as 27, a decimal, such as 6.35, or a character, such as L. a variable is associated with data type that defines the type of data, which can be stored in a variable. For example, a variable called TennisplayerName will ideally store characters, whereas a variable called high_score will store numbers. A program refers to a variable by its name.
NAMING OF VARIABLES IN C#:
The following rules are used in the naming of variable in c#:-
1.                  Must begin with a letter or a underscore('_'), which may be followed by a sequence of letters, digits (0-9) or underscores. The first character in a variable name cannot be a digit.
2.                  Should not contain any embedded spaces or symbols such as ? ! @ # + % $ () [] {} .,;:'”. however, an underscore can be used whenever a space is required, like high_score.
3.                  Must be unique, For example, to store four different numbers, four unique variable names need to be used. Uppercase letters are considered distinct from lower-case letters.
4.                  Can have any number of character.
5.                  Keywords cannot be used as variable names. For example, you cannot declare a variable named class because it is keyword in c#.
FOR EXAMPLE:-
Game_level
High_score
This_variable_name_is_very_long
The following are the invalid variable names:-
#score
2stank.
NOTE:-
c# is a CASE-SENSITIVE language. This means that the variable TennisPlayerName is not the same as the variable tennisplayername.
DECLARING AND INITIALIZING VARIABLES:-
you can declare and initialize variables by using the following syntax:
<data-_type><variable_name>=<value>;
In the preceding syntax, the <data_type> represents the kind of data types that will be stored in a variable and <value> specifies the value that needs to be stored in a variable.
Consider the following statement of variable declaration:
int age;
The preceding statement declares that variable age of the int data type and initializes the variable with the value 0. the int data type is used to store numeric data.
Consider the following statement:
char choice=”Y”
The data type represents the kind of data will be store in a variable.
Previous post is:- WHAT IS C#
next post is:- DATA TYPES IN C#
PLEASE IF YOU HAVE ANY DOUBT, PLEASE COMMENT IT BELOW THE POST.

WHAT IS C#

0 comments
INTRODUCTION TO C# (PRONOUNCED C-SHARP)
WHAT-IS-C#


c# ( c-sharp) is no doubt the language of choice in the .NET environment.
It is a whole new language free of the backward compatibility curse with a whole bunch of new, exciting and promising features. It is an object oriented programming language and has at its core, many similarities to java, c++ and VB. In the fact, c# combines the power and efficiency of c++, the simple and clean OO design of java and the language simplification of visual basic.
Like java, c# also does not allow multiple inheritance or the use of pointers (in safe/ managed code), but does provide garbage memory collection at run time, type and memory access checking.
 However, contrary to JAVA, c# maintains the unique useful operations of c++ like operator overloading, enumerations, per-processor directives, pointers(in unmanaged / unsafe code), function pointers (in the form of delegates) and promises to have template support in the next versions. Like VB, it also supports the concepts of properties (context sensitive fields).
In addition to this, c# comes up with some new and exciting features such as reflections, attributes, marshaling, remoting, threads, streams, data access with ADO.NET and more.
THE .NET ARCHITECTURE AND .NET FRAMEWORK:-
In the .NET architecture and the .NET framework there are different important terms and concepts which we will discuss one by one:-
1.THE COMMON LANGUAGE RUNTIME (CLR):-
            The most important concept of .NET framework is the existence and functionality of the .NET common language runtime (CLR), also called .NET run time for short. It is a framework layer that resides above the OS and handles the execution of all the .NET applications. OUR programs don't directly communicate with the OS but go through the CLR.
WHAT-IS-C#
2.MICROSOFT INTERMEDIATE LANGUAGE CODE (MSIL):-
            When we compile our .NET program using any .NET complaint language such as c#, VB.NET or c++.NET our source code does not get converted into the executable binary code, but to an intermediate code known as MSIL which is interpreted by the common language run time. MSIL is operating system and hardware independent code. Upon program execution, this MSIL (intermediate code) is converted to binary executable code (native code). Cross language relationships are possible as MSIL code is similar for each .NET language.
IF YOU HAVE ANY QUESTION PLEASE POST IT IN THE COMMENT BOX.


 

ABOUT THE AUTHOR

Founder & Author:I ABHISHEK BHATI student of COMPUTER SCIENCE by education a Blogger by profession. Exploring Technology is my passion.BHATI TRICKS is place for Tech Lovers. ABHISHEK BHATI launched his frist Marketing Site in 2013.
...Read More

GET FREE EMAIL UPDATES

Join us for free and get valuable content delivered right in your inbox.



recent comments

BHATI TRICKS Widget

| BHATI TRICKS © BHATI TRICKS. All Rights Reserved | | Back To Top |