If you are old enough to have experience in .net framework (and I hope you do, otherwise I will feel really old myself!), there is a high probability that you were concatenating directory paths wrong all the time! And that’s all because some time ago, somebody at Microsoft had, let’s say, not a best idea :P. But what’s the problem? Path.Combine can be used with one, two, three or even four arguments. In an ideal world the first argument should be passed as an absolute path and...
Strona głównaUżytkownik
AGirlAmongGeeks | użytkownik
Sztuka programowania 1495 dni, 14 godzin, 18 minut temu 112 źrodło rozwiń
Working with big databases, consisting of many, many tables (like hundreds or thousands), can be really painful. Recently, this happened to me and I discovered 2 lifehacks that help me survive this hard days. Filtering tables You know the struggle when you know a part of a database table name but cannot remember the whole name? How could it be named? BasketPositions, CustomerBasketPositions or maybe PositionsOfBasket? How can you know?! Yeah, it’s the everyday struggle with huge projects! This is...
In my previous post I wrote about Az-900 exam I took recently. Today I will write in general about taking exams online. Maybe somebody find it useful, in times of COVID-19 pandemic.
Masz do wydania milion dolarów i pomysł na produkt. Co robisz? Rekrutujesz najlepszych ludzi i wierzysz, że ich doświadczenie sprawi, że powstały zespół efektywnie wytworzy oprogramowanie wysokiej jakości, prawda?
Today I will write about the way variance influences type checking in C#. Yes, the fact that one type can be passed to a generic method that requires another type, depends on these 2 small keywords we write before ‘T’ (or whatever 😉) in interface header.
Sztuka programowania 1984 dni, 14 godzin, 56 minut temu 99 źrodło rozwiń
Have you ever seen these mysterious ‘in’ and ‘out’ keywords in generic interfaces’ definitions? If so, you’ve probably already checked what it means, but if not… You better read this and the next post. So today we will talk about the basics of variance in our own generic interfaces.
Sztuka programowania 1990 dni, 14 godzin, 48 minut temu 125 źrodło rozwiń
AsNoTracking()is a powerful method from DbExtensions class. And for sure – the method you should know and use 😉.Why should I use it? In short – when we call AsNoTracking(), less data is cached and tracked (we will talk about it later). And of course, the more records we retrieve from the database, the more RAM we spare.
Sztuka programowania 2012 dni, 14 godzin, 34 minuty temu 170 źrodło rozwiń
Today I decided to check how Enumerable.EmptyT() 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.
Architektura 2058 dni, 12 godzin, 39 minut temu 372 źrodło rozwiń
Tech I installed Visual Studio 2019 RC recently and accidently forget to select English as default language. Of course, I realized that mistake after installation and I had to spend much too much time on searching the solution for this problem (yeah, that’s weird, I know). So, I decided to write a short tutorial how to do it. I’m 100% sure, the future me will thank myself for this :D. The easy way If you have many languages installed, you simply go to the Tools -> Options -> Environment -> Internatio...
Reading application’s logs is not a big fun but let’s be honest – it is part of our job and we will not avoid it. So why don’t we make it slightly more pleasant? Stack traces explorers to the rescue! In fact, I didn’t know about the existence of stack trace explorers till the day I copied a part of app’s log to my clipboard with the plan to send it to the colleague. But when I opened Visual Studio a magic happened, fairytales flew on my desk and opened a new tab in my IDE.
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 ty...
Sztuka programowania 2284 dni, 8 godzin, 27 minut temu 101 źrodło rozwiń
I’ve always had the impression that companies like Microsoft or Google are some magical places in the far-far-away-land (yep, America seems quite far away for a European kiddo 😉 ). People working there must be some kind of amazing scientists who write their code by setting the appropriate voltage directly on transistors. Or, at least, use assembler-like languages every day 😉. If you have a similar idea, you may like to read some facts I discovered after talking to one of Microsoft employees...
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...
Sztuka programowania 2432 dni, 11 godzin, 20 minut temu 187 źrodło rozwiń
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. Sounds ok but what does it mean in a real life? It’s time for a fairy tale 😊. Imagine...
Sztuka programowania 2444 dni, 13 godzin, 32 minuty temu 117 źrodło rozwiń
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! One enum value passed to a method, other value received! What’s goin’ on?
Sztuka programowania 2488 dni, 6 godzin, 40 minut temu 427 źrodło rozwiń
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 DebuggerTypeProxyI described in previous post and the second one is just ‘a must’ (really!) that makes life easier.
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.
[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. [b]We decide how to display object while debugging[/b] Exactly! You can set a proxy that will inform debugger how you want a type to be displayed...
C# Attributes are very popular for ‘decorating’ assembly with some additional data, usually influencing on the application’s behavior or the way data are managed. You probably already used at least some of them – Obsolete, Serializable, Required, Display, MaxLength, RegularExpression, WebMethod are only a few of hundreds available in .Net world. What is more, you can write your own custom attribute and use it like a build-in one. I will write more about this in the next post. Right now, let’s focus o...
Sztuka programowania 2585 dni, 14 godzin, 31 minut temu 168 źrodło rozwiń
In the last post I wrote about one of the .Net Core 2.0 features – Razor Pages. Today, we will crawl a little bit in this mud… I mean, we will write some code. I chose a simple BMI calculator as a demo project (you can download the code from github). You know, 2 inputs and the code-behind that will tell us if we are very fat or just slightly fat or we are OK and it’s time for another cookie. Because, there is always a time for a cookie, no matter what! A warm up Last time we crea...