C# is strongly typed.
ECMA-334 Defines C# as "C# (pronounced “C Sharp”) is a simple, modern, object oriented, and type-safe programming language."
Wikipedia defines type safety
Type safety is synonymous with one of the many definitions of strong
typing; but type safety and dynamic typing are mutually compatible.
Wikipedia defines strong-typing as
In computer science and computer programming, a type system is said to
feature strong typing when it specifies one or more restrictions on
how operations involving values of different data types can be
intermixed. The opposite of strong typing is weak typing.
Perhaps it's better to ask if C# is a type-safe language since nobody can agree on what "strong" and "weak typing" really mean if the compiler will do type checking.
C# does have some dynamic language like constructs available but remarkably these are still type-safe at compile time.
Beginning in Visual C# 3.0, variables that are declared at method
scope can have an implicit type var
. An implicitly typed local
variable is strongly typed just as if you had declared the type
yourself, but the compiler determines the type.
http://msdn.microsoft.com/en-us/library/bb383973.aspx
The dynamic
keyword basically works the same way except it is evaluated at run-time instead of at compile time as the case with var
.
Visual C# 2010 introduces a new type, dynamic. The type is a static
type, but an object of type dynamic bypasses static type checking. In
most cases, it functions like it has type object. At compile time, an
element that is typed as dynamic is assumed to support any operation.
http://msdn.microsoft.com/en-us/library/dd264736.aspx