#181 – C# Is Strongly Typed

C# is a strongly typed language, meaning that every variable and object has a well-defined type.  At compile-time, the compiler checks to make sure that all operations use objects of the correct type.  This generally means that if a function takes an argument of type double, you’ll get a compile-time error if you try to pass it something that is of a different type.

There are many benefits of using dynamically typed languages (e.g. Python, Ruby).  However, the main advantage of a strongly typed language is that errors related to type conversion are caught at compile-time rather than at run-time.  It’s always better to find a bug earlier, rather than later.  Finding a bug at compile-time forces the developer to fix it.  Finding it at run-time means that the bug might only be found by a customer, after the product has shipped.

Exception: the dynamic keyword