Introduction: Dynamic Type In C#

In this post, we will learn about Dynamic Type In C# with an example.


In my previous posts I have explained various topics likeĀ  Named Arguments In C#, Basics Of Pointers In C# Get site visitor count in, Convert generic list to datatable in Asp.Net C#.Net, Abstract Class in C# with Example, Routing in Asp.Net MVC with Example,Use of Global.asax in

Now in this post, I will explain about how to get Dynamic Type In C# with appropriate example.
‘Dynamic’ can be use to declare the variable of the dynamic type.Dynamic data type variable can store any type of value and data.Type of value contained is checked at runtime by compiler.’Dynamic’ keyword is much similar to ‘var’ keyword or you can think it as a replacement for var keyword.It is not necessary to initialize dynamic variable while declaring.

Now create Console Application in Visual Studio and write below lines of code in it.

using System;
using System.Collections;

namespace ConsoleDemo
    class Program
        static void Main(string[] args)

            dynamic _Test;
            _Test = 123;

            _Test = 0.234;

            _Test = true;

            _Test = "";

            _Test = null;
Dynamic Type In C#

Dynamic Type In C#

Read :


I hope you got an idea about Dynamic Type In C#.
I would like to have feedback from my blog readers.
Your valuable feedback, question, or comments about this article are always welcome.

Leave a Reply

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

Name *
Email *