This morning was going through a book where I found a paragraph as stated below :
Each data field in a table is a strongly typed data member, fully compliant wit
No. It means that 1
and "1"
(or any other number and string for that matter) are different values that cannot be casually interchanged in expressions.
For e.g you cannot Multiply or Divide two different types i.e String vs Integer
var answer = 1 * "1"; // you cannot do this
You have to explicity cast it, this is known as strongly typed
where as if you see in php
$x = "3" * 1; // is correct in php
So here you dont need to explicitly cast it.
When we say something is strongly typed we mean that the type of the object is known and available.
Let say I have a function like following
public int Add(int a, int b){
return a+b;
}
We can call this function like
int result = Add(5,4);
But we can not do like following
int result = Add(5.2,4.5); // We will get here compilation error.
C# (and C++ and many other languages) is strongly typed because the compiler will detect and flag these errors at compilation time.
See here
This means, if there are two variables of different types, you have to cast them, to make an operation executable.
Else it will throw an exception.
"fully compliant with .NET’s Common Type System" means that the data types are usable in any .NET language. So if you created a class that exposes a property in c# that is CTS compliant, that class can be consumed from say VB.net.
"Each data field in a table is a strongly typed data member" means that you can rely on the type of the value in the table, and you would have to cast it to another type if that was required. You can't do implicit casting.