C# Reference Type Variable

reference-parameter
In this chapter you will learn:

  • What is Reference Type?
  • What is Reference type parameter?
  • How to use Reference Type Parameter in C#?

The Reference type variable is such type of variable in C# that holds the reference of memory address instead of value. class, interface, delegate, array are the reference type. When you create object of particular class with new keyword, a space is created in the managed heap that holds the reference of classes.

If you are passing reference type variable as parameter, then you will have to use ref keyword with variable.

Programming Example

Output

current value of Original is 9
Now the current value of Original is 729
__

referencetype-parameter-flowchart

Summary

In this chapter you learned about reference type parameter and variables in C#. In next chapter you will learn output parameter in C sharp.



Leave a Reply

Your email address will not be published. Required fields are marked *