C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
Java
Learn iOS Programming
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
5
Reply
What is dynamic keyword ?
Lalit Raghav
10y
2.5k
0
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
Dynamic Keyword is the run time keyword
Manoj Kumar Duraisamy
8y
0
dynamic is the run time bounded so it will decide the type of value on run time. its dynamic typed variable
manisha verma
9y
0
Dynamic is a new type available in .NET to bypass compiler check during variable initialization and does it on run time. It is more flexible but dangerous and needs to be used more carefully. One cool feature of dynamic is to interact with other language code and execute them, e.g., in example PythonIron is used to interact with Python code and execute it. Also, dynamic can be used with ExpandoObject class available in .NET where you can declare properties and use them on run time. In ASP.NET MVC ViewBag is used to communicate data between Controller and Views which is a good example of dynamic. The simple example to run the Python code through dynamic is as follows: (Get IronPython from NuGet)Hide Copy Codepublic static void Main(){var pythonRuntime = Python.CreateRuntime();dynamic pythonFile = pythonRuntime.UseFile("Test.py");pythonFile.SayHellotoPython();Console.ReadLine();}Where Python.py is:Hide Copy Code import sys; def SayHellotoPython();print "Hello I am Python"
Balaji Palani
9y
0
No need to initialize dynamic variables at time of decalration. var types needs to initialize at of time of declaration becuase its statically typed variable. But dynamic is dynamically typed, so we can declare it and can initialize later,also the assigned value can change any time.Explanation of dynamic ------------------------------------------ Introduced in C# 4.0 No need to initialize at the time of declaration. Errors are caught at runtime eg: e.g., dynamic str; str=”I am a string”; //Works fine and compilesstr=2; //Works fine and compiles
vipin kv
9y
0
dynamic type is inferred at run-time and not the compile time.dynamic type variables need not be initialized when declared.
Anil Kumar Murmu
9y
0
what is virtual constructor?
C# is strong type ?
Message