Posts

Showing posts from May, 2015

BOXING AND UNBOXING

Image
Today in Engineer's World, we are discussinga very important topic of C# - Boxing and Unboxing in very easy way. Posted By- +Manish Kumar Gautam+LIVE VIAR+ASP.NET SOLUTIONS
Click imaginationhunt.blogspot to see latest BlogsTo read Usage of Reference Data Types in C# - Click here.
Welcome friends, the Blog is to explain Boxing and Unboxing. Confusing and useless terms for beginner's and even for some professional too.



In C# how can we convert one type to another? The first idea that comes to your mind is by using implicit or explicit conversion and type casting. But can we convert a value of one type into a value of another type? Can we? Answer is yes.
The process of converting a value type to a reference type is called boxing. The inverse process, converting a reference type to a value type, is called unboxing. This is illustrated in the following code:
int i = 58959; // a value type  
object o = i; // boxing  
int j = (int)o; // unboxing

What is object? And why object i…

USAGES OF REFERENCE DATA TYPES IN C#

Image
Today in Engineer's World, we are discussinga very important topic of C# - Reference Data Type in very easy way. Posted By- +Manish Kumar Gautam+LIVE VIAR+ASP.NET SOLUTIONS
Click imaginationhunt.blogspot to see latest BlogsTo read Usage of Value Data Types in C# - Click here.

REFERENCE TYPE
A variable holds a reference to the value, then that type of data type is reference types. These reference types are stored in "heap" memory and these types are not fixed in size. They are maintained in System managed heap but it also uses stack to store reference of the heap.

Two primitive types (string and object), and
Non-primitive data types (class, interface, delegates) are example of reference type.


Ex- class, interface, delegates, string, object and array.Things to Remember:
a) Object type is superior to all types. It can store any type or any size of data. It helps in Inheritance process.

1. string: It represent text as a Unicode characters.
Namespace -System.
Assembly- mscorlib (mscor…

USAGE OF VALUE DATA TYPES IN C#

Image
Today in Engineer's World, we are discussinga very important topic of C# -VALUE DATA in very easy way. Posted By- +Manish Kumar Gautam+LIVE VIAR+ASP.NET SOLUTIONS
Click imaginationhunt.blogspot to see latest BlogsTo read Data Types in C# - Click here.
VALUE TYPE

A variable which holds actual values then that type of data types are value types. Value type are stored in "stack" memory and these value types are fixed in size.
Value type variables are local copies. When they fall out of the scope they may die. Value types are derived from System.ValueType.


Ex- byte, short, int, float, double, long, char, bool, DateTime.
Things to Remember:
a) Primitive data type are value type except string.object.
b) struct, enum are value types.
c) The default value, if value is not assigned is 0 for value type(i.e. whether it may int, long, short, char).

For ex- The default values for value types can be understand by the following example
using System;

namespace AspnetSolutions
{
    class Dtype
    {
  …

DATA TYPES IN C#

Image
Today in Engineer's World, we are discussinga very important topic of C# - Data Types in very easy way. Posted By- +Manish Kumar Gautam+LIVE VIAR+ASP.NET SOLUTIONS
Click imaginationhunt.blogspot to see latest BlogsTo read Looping in C# - Click here.
DATA TYPES
Data Type in a programming language describes that what type of data a variable can hold. The type of data that a variable contains is called Data Type.C# is a Strongly type typed language so every variable and object must have a type.


1. Basic in-built or primitive or predefined:
Ex- byte, short, int, float, double, long, char, bool, DateTime, string, object,etc.

2. Non-primitive or User-defined:
Ex- enum, class, struct, interface, delegate, array.
The variables in C#, are categorized into the following types:Value typesReference types

VALUE TYPE:

A variable which holds the actual values then that type of data types are value types. Value type is stored in "stack" memory and these value types are fixed in size.
Value type…