Reading Microsoft documentation when we have all that stackoverflow questions with answers usually seems a waste of time. And as a typical, lazy programmer I admit that (much too often) I agree with that sentence 😉. But today I decided to check how Enumerable.Empty<T>() works and wasn’t satisfied with the knowledge I got. I started digging a little bit deeper and wasted some of the precious beauty-sleep time so if you want to know what’s happening when you add an element to an empty collection, let me tell you a story of today’s night.
No, not that story, you sick head! Continue Reading
Microsoft promised us another great feature in C# 8 – async streams. And believe me or not, it was first discussed in… 2015! In this short post I will try to explain the idea and purpose of this new C# 8 planned feature. Continue Reading
If you were online at least once in the previews week you probably noticed the biggest announcement from Microsoft! Yeah, everybody is talking about C# 8 planned features. And because the news is literally everywhere, I gave up and decided not to repeat what everybody already read. But that decision is no longer valid because back THEN (which means – yesterday or so) my pet project wasn’t so nasty and I wasn’t so stuck in the middle of some stupid, trivial task that seems to be unable to accomplish… So yeah, I changed my mind, I will wrote about C# 8, just to avoid touching (for at least a day 😉 ), the disaster I programmed :D. No, it’s not procrastination, not at all! 😉
Well, maybe not a totally ‘no’ NullReferenceException, but a whole lot less than now. Well, yeah, I had to catch your attention somehow :P. But anyway, have you heard those rumors about C# 8, how amazing it is going to be and how hard Microsoft is working on the release…? If not, you definitely should read this post! Because the promised changes sound really good and will be a must-to-know quite soon.
So today I wanted to write about one of the “louder” planned features – nullable reference types. Yes, you read it right. And yes, all the reference types we already have in C# are actually… nullable. Yeah, makes no sense, yeah, what a bullsh… No! Wait! Continue Reading
Have you ever wondered why blue screens of death happen so rarely, nowadays? Of course, we can thank Microsoft for this but the way they fixed this problem is not so obvious! According to Marino Posadas (and his book Mastering C# and .Net Framework) back in 2010, Microsoft made an analysis of this topic and they came to the conclusion that the 90% (wow!) of the blue screens were caused by drivers! So, Microsoft made manufacturers to follow the Hardware Compatibility List. That somehow solved most of the problem but what with the rest 10%? Most of them was due to the… Continue Reading
Many people neglect C# delegates because they cannot find a reason to use them. On the other hand, there is (rather small) group of people who overuse delegates in code that could be easily replaced by literal method call. So when should we use delegates? Well, they show their real power in situations when we need a mechanism to easily switch from one logic to another, without changing our application’s core code. Continue Reading
New year, new me… Just kidding, no running or yoga plans, but I decided to have a (temporary) break with ‘C# attributes you should know’ series and start with a brand new one – C# facts that somehow surprised me. For the first article, I will show you how (friendly looking, always helpful, good guy) enum can become an asshole. An asshole who will steal your precious time!
Today I again focus on the attributes that will make your debugging less painfull :). This time my scribbles should appeal to the programmers who prefer keeping their code clean (and adhere to the principle: the less ‘spare’ code the better).
So grab a mug of whatever you like and take a look at DebbugerBrowsable and DebuggerDisplay . The first one may be a good alternative to DebuggerTypeProxy I described in previous post and the second one is just ‘a must’ (really!) that makes life easier. Continue Reading
Last time I wrote about C# attribute DebuggerTypeProxy that helps us customize the way we display our type’s data while debugging. Today I would like to introduce you to the world of attributes that helps you skip some parts of code while debugging. Most of the C# programmers probably know them well, but I realized that only a few can tell the differences between them. So, ladies and gentlemen, let me introduce you the DebuggerStepThrough and DebuggerHidden. Continue Reading
[DebuggerTypeProxy] is very useful attribute when you have a class that inherits from another class and that one inherits from another one, and some of the classes contain collections of items and hundreds of properties that in fact are not important to you… Strictly speaking, when displaying class’ members while debugging makes you feel like quitting the job. Continue Reading