How to capture a variable in C# and not to shoot yourself in the foot

Back in 2005, with the release of C# 2.0 standard we got a possibility to pass a variable to the body of an anonymous delegate by capturing it from the current context. In 2008 the C# 3.0 brought us lambdas, user anonymous classes, LINQ requests and much more. Now it January, 2017 and the majority of C# developers are looking forward to the release of the C# 7.0 standard that should provide us a bunch of new useful features. However, there are still old features that need to be fixed. That’s why there are plenty of ways to shoot yourself in the foot. Today we are going to speak about one of them, and it is related with quite an unobvious mechanism of variable capture in the body of anonymous functions in C#.

image1

Continue reading

Critical stuff that every junior C# developer must know

441a75638eb5763f5be154e47660392e

Says Mosh Hamedani, author of courses on C# at udemy

Mosh, I just got my first junior level C# job. What advice do you have for me? What are some critical stuff I need to learn?

So, whether you’re looking for your first junior C# job, or you just got one, this post will give you an overview of the kind of skills that you need to be familiar with as a junior C# developer. I’ve tried to put it in a “learning path” that would give you direction, whether you want to build web or desktop applications.

Continue reading

Stories about Christmas and New Year Bugs

Do you believe in magic? Of course not – it’s just against logic! Programmers are serious-minded and well-educated people of a realistic outlook. Well, you didn’t favor fairy tales as a child either, did you? OK, I’m not going to answer for you. Just please make yourself a cup of tea, peel a tangerine, look at the snowflakes falling outside the window, and only then go on to read this Story.

image12

Continue reading