PROCEDURES AND FUNCTIONS IN .NET LANGUAGES { //

PROCEDURES AND FUNCTIONS IN .NET LANGUAGES { // this will be executed Console.WriteLine( i1 Equals i2 ) } if(i1.ComparesTo(i2) == 0) { // this will be executed Console.WriteLine( i1 Compares To i2 ) } There is one more behavior of a SqlType, which is due to its inability to represent a null. Reference types, such as a string, can produce a runtime error because of a null reference. This typically happens because of a coding error. The following code fragment shows a simple way this can happen. string str = null; // this will cause a runtime error // because of a null reference Console.WriteLine(str.Length); An instance of a SqlTypethat is representing a null can produce a similar sort of error. A runtime error will occur when an attempt is made to get the Valueproperty of the SqlTypeor cast it to a CLR type, if that SqlType is representing a null. The following code fragment shows where this will happen. SqlInt64 i64 = SqlInt64.Null; // this will cause a runtime error long l1 = i64.Value; // this will cause a runtime error too l1 = (long) i64; Even though casting an instance of a SqlTypethat is representing a null to a CLR type will cause a runtime error, casting it to another SqlTypewill not, assuming that cast is allowed. For example, the following code fragment will not cause a runtime error. Int32 i32 = SqlInt32.Null; // this will compile and work as expected SqlInt64 i64 = i32; I64 = SqlInt64.Null; // this will compile and work as expected i32 = (SqlInt32)i64; To summarize what we have covered on SqlType, we can say that a SqlType is a value type that can represent a null but otherwise behaves much like the CLR type that corresponds to it. A SqlTypeis used when it is

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services

Bookmark the permalink.

Comments are closed.