eliza sahoo

eliza sahoo

  • NA
  • 41
  • 0

Loosely typed C#.

May 3 2010 7:32 AM

What :  A loosely typed programming languages is typically one that does not require the data type of a variable to be explicitly stated.

Example : As in JavaScript we can declare var count = 1;  which will automatically treat variable count as integer.

Advantage: The advantage of loosely typed is that we don't have to bother about the data type of the variable value and we have the benefit of changing the type of the variable at any instance of time.
Usage in C# : ASP.NET 3.5 gives a new keyword "var" which behaves similar to what "var" keyword seems to do in JavaScript. By using the var keyword we can implicitly convert to its originally data type.
So,
var firstName = "Aditya"; convert the data type of variable "firstName" to string data type implicitly.


Answers (1)