Dynamic Data type in C#4.0

No.of Views1803
Bookmarked0 times
Downloads 
Votes0
By  usamawahabkhan   On  17 May 2010 08:05:20
Tag : CSharp , CSharp4.0
Dynamic Datatype in C# 4.0 is quit bit familiar to Var Datatype. Deference between Var and Dynamic is VAR initialized on CompileTime and Dynamic initialized On Runtime
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction

Dynamic Datatype in Csharp 4.0 is quit bit familier to Var Datatype. Deference betweet Var and Dynamic is VAR initialized on CompileTime and Dynamic initialized On Runtime.that's why Dynamic Data Type able define anonymous function on Compile Time. 

Image Loading

Dynamic datatype allow to declare anonymous. this feature is really important when your work with com specially Silverlight .To add Properties on runtime it was really big problem in C#. some of practice are available. like using IDictionary interface in C#. but now in C#.4 by using dynamic datatype with ExpandoObject dynamic datatype you can add properties on runtime. Dynamic Type inherit IDictionary to maintain add dynamic properties.

 

Image Loading

Dynamic initialized its type on runtime like object but object initialized its type on compile time.

 

Image Loading

When we use ObjectType as parameter in overload object initialized on compile time. dynamic parameter accept as anonymous datatype and initialized its self on runtime for overload method.

 

Image Loading

Object class initialized complie time thats its not allow it to act anonymous Type

 

Image Loading

Dynamic datatype initialized runtime its allow it to act anonymous Type define its type on runtime according to type overload methad will call 

Image Loading

Dynamic datatype as function argument is little bit confusing in overloading cause is there is no other argument matched datatype then Dynamic will call. 

Image Loading

 

Image Loading

Enjoy new dynamic datatype in c#4.0.

 
Sign Up to vote for this article
 
About Author
 
usamawahabkhan
Occupation-Not Provided
Company-Not Provided
Member Type-Senior
Location-Pakistan
Joined date-06 May 2010
Home Page-Not Provided
Blog Page-Not Provided
 
 
Other popularSectionarticles
    Since we have multicore processors are now so we can take advantages of multicore processor with parallel execution in C# 4.0. There are some time consuming task for the computer for example a long for loop or similar kind of things. This kind of task can be done parallel with parallel class in C# 4.0.
    Published Date : 12/Jul/2011
    In this article, i will explain how to use the How to use ExpandoObject Class in .NET 4.0.The ExpandoObject class is introduced on .NET Framework 4.0 and inherited using many interfaces.
    Published Date : 16/Apr/2011
    C# 4.0 supports Dynamic Programming by introducing new Dynamic Typed Objects
    Published Date : 26/May/2010
    In this article I will show how to use the IObserver and IObservable Interfaces in C#. These two interfaces is work with connection to Push based approach on Reactive Framework
    Published Date : 15/Dec/2010
    Through this article, i will introduce in FCL named Tuple which can store n - number of values in it. Yes, you specify the type of each of those variables as generic parameters, and the object will create those values for you
    Published Date : 15/Nov/2010
Comments
By:Usama Wahab KhanDate Of Posted:8/9/2010 4:54:54 AM
Usama Wahab Khan
sorry about the grammatical mistakes. but i thing my article is not about English grammar its all about C# .net and technologies thats why shown Images in it via image and code u can understand ezzly ok and source code is also available Thank you
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top