Hearing the term Lamba Expressions somewhere I was curious to dive into it. As always msdn links, led me into an infinite loops 🙂 With a surface level look, I learnt Anonymous functions, Delegates, Lamba Expressions were all to be comprehended together. Here is a non msdn link which attempts to help us comprehend all the three at once.
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.
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!!
So it all started with this. There was some code which periodically archived log files.Archival was failing arbitrarily (That’s a different issue). In the process of fixing that issue , repeated debugging and stuff I came across this Using quite frequently
using (FileStream streamReader = File.OpenRead(filename))
// do something
It was really after a long time that I was interested in checking out what was the whole thing about this Using block.Until then, I was interested in only fixing the issue and this block just looked like a normal block of statements to me, at least I dint care much more about it.
Then comes this whole story about its connection with IDisposable Interface
http://www.dotnetperls.com/using which said it was a synctactic sugar. So I went about seeing what a syntactic Sugar was (I had heard it somewhere before)
http://en.wikipedia.org/wiki/Syntactic_sugar which introduced the related term Syntactic Salt to me, which spoke about the compiler warning issued unless the new keyword is used to specify that the hiding is intentional (C#). Cursing my lack of context , I went about seeing what it was
Partly understanding what it was and having more confusions about how override was different,I went through this
http://msdn.microsoft.com/en-us/library/ms173153.aspx and after I was done with it, It was an AHAA moment, to look at where I started and where I ended up. And now I am curious to check how these behaviors are expected to behave in JAVA. Will Keep Editing this post as I dive deeper .