Thursday, December 25, 2014

Reference Type

6:07 AM - By azeheruddin khan 0

Reference Type: - The values assigned to variables of reference type are stored in heap memory instead of stack.  And a reference type variable points to an address of a data value but not to the data value.

  1. Object: - It is a general purpose data type, all pre-defined and user-defined data types inherit from System.Object class.
  2. String: - It represents a string of Unicode characters and allows easy manipulation and assignment of strings.

Example program for reference type

using System;
namespace DataType
    class Program
        static void Main(string[] args)
            String b = "Fresher2";
            b += "programmer";
            Console.WriteLine("website name is " + b);
            object a = 10;
            Console.WriteLine("the type of a is:" + a.GetType());

Note: - In the above given program, GetType() is a method of System namespace used to get the type of a given variable or object.

Output: - website name is Fresher2programmer
the type of a is: System.Int32

About the Author

I am Azeheruddin Khan having more than 6 year experience in c#, and ms sql.My work comprise of medium and enterprise level projects using and other Microsoft .net technologies. Please feel free to contact me for any queries via posting comments on my blog,i will try to reply as early as possible. Follow me @fresher2programmer
View all posts by admin →

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post



© 2014 Fresher2Programmer. WP Theme-junkie converted by Bloggertheme9
Powered by Blogger.
back to top