Type Safe C#

So I came across the words covariance and unchecked type casts while doing some random look ups about c#’s type safety. And then thought, I will do a detailed look up on Type Conversions and Casting in C# before I get into those.

User-defined type conversions got me stumbling upon Conversion Operators. Now for those who couldn’t grab it at once like me, have a look at an example usage.

Came across these links while taking a surface level look at type conversions using helper classes :  System.BitConverter Class , http://msdn.microsoft.com/en-us/library/bb384066.aspx.

If you are someone like me, by now you would have just checked out if the literal meaning of Helper Classes you assumed is right and have inferred Helper classes are static classes mostly. Lets take a look at Principles_and_Patterns before we get into the discussions about the evilness of such Helper/ Static Classes (This article only made me feel sick 🙂 ) So I made up my mind to just go through that later, and for now just limit my search to find What are the downsides of using Static Methods : Should I leave existing helper classes as such?Helper Design Pattern – an Antipattern?, Killing the Helper CLass. Tired of the vague aspects on Helper classes like me? Lets get outta there, back to type conversions . (I know there was too much deviation!!)

And what the heck I went into type safety and type casting stuff not knowing about Value Types and Reference Types (struct keyword – value types; class keyword – reference types story. Was I so dumb in not knowing :P)  all these days. Generics  is a topic in itself just like how Implicitly Typed Local Variables, Anonymous Types, Nullable Types are. Will post about them when I do the learning!  If u did  go into Implicitly typed local variables, you might wanna check out When to use Implicitly Typed Variables which didn’t actually mention that there’s no performance difference in using implicit types.If you  feel meh about the fact that we have left uncovered some aspects which we came across so far, for instance, linq query expressions etc, don’t ya worry. We can spawn another post for it.

Bothering about Boxing and Unboxing is not off topic I swear.

All this is too much a giant leap. I had actually started with CSharp Language Specification from which the word “type safe” got me into all this. I did know what it meant by the way 🙂

Stopping all the browsing and diving back into the C# language specification documentation!!




This entry was posted in c#.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s