- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference between Var and Dynamics in C#
Var is strictly typed in C#, whereas dynamic is not strictly typed.
Var declaration
var a = 10;
Dynamic declaration
dynamic a = 10;
A Var is an implicitly typed variable, but it will not bypass the compile time errors.
Example of var in C#
var a = 10; a = "Demo"; // gives compile error
Example of dynamics in C#
dynamic a = 10; a = "Demo"; // won’t give error
Advertisements