Patrick Borgogno
Patrick Borgogno
  • 6
  • 1 124
Why you can't use await inside a lock (C#/.NET)
Locking ensures, that only one thread can execute some code at a time. However, as soon as you use await, you can't use "lock" anymore. Why is that and what can you use instead?
Переглядів: 398

Відео

What is Cache Stampede?
Переглядів 1133 місяці тому
In this video we explore the cache stampede problem that can arise when cache entries get stale and multiple requests come in at the same time.
How big can a BigInteger get? (C#/.NET)
Переглядів 3583 місяці тому
Let's have a look into BigInteger. How does its size compare to common data types? How does it store the numbers?
Not Every Catch is Equal (C#/.NET)
Переглядів 874 місяці тому
For some time now we can use exception filters. However they are not exactly equal to a normal exception block with an if-statement. In this video we are exploring one major difference.
How to cancel work with CancellationTokens (C#/.NET)
Переглядів 784 місяці тому
If you ever wondered what these CancellationTokens in some method signatures are, look no further. In this video I will explain, how you can use them to cancel ongoing work.
Can you SHARE access to a file? (C#/.NET)
Переглядів 905 місяців тому
In this video we have a look into the FileStream class and more specifically the FileShare option.

КОМЕНТАРІ

  • @uwose
    @uwose Місяць тому

    It doesn't really matter whether you use if or when. The most important is to avoid buggy code within your catch. Check for "(obj is not null)" or "(obj is object)" and everything is fine. By the way: Don't use "object? ...". Simply write "object obj;" and as a member variable of a class it will be initialised to null, because it is a reference type. Nullable is only used for value types. (Or in printed documentation to make clear that null will be handled.)

    • @PatrickBorgogno
      @PatrickBorgogno Місяць тому

      I agree, but it is interesting to see that internally "catch when" is handled a little different. Nothing I would build on though. On the nullability part: I agree, that Nullable is only used for value types when you are talking about Nullable<T>. However, the nullable reference types feature in c# is something I activate on new code everywhere because it makes handling null values explicit. When turned on and you are dealing with "object" you know that it's never null. If you however allow it to be null you use "object?". Your IDE should highlight when you don't handle the null case on "object?". When code has this feature turned on, you don't have to dig into documentation or decompile source code to find out, if a function returns null in some cases. If it isn't turned on you never know without looking closely. And this is why I don't think that "object? ..." is the same as "object ..." when the nullable reference types feature is turned on as it was in my sample.

  • @mumk
    @mumk 2 місяці тому

    glad you recovered from sickness

  • @Harambe899
    @Harambe899 2 місяці тому

    Ich glaub ich bin verliebt!

  • @denoshanrajasingam6180
    @denoshanrajasingam6180 3 місяці тому

    Super erklärt mit verständlichen Grafiken. Freue mich auf das nächste Video.

  • @denoshanrajasingam6180
    @denoshanrajasingam6180 4 місяці тому

    Very exciting and interesting video. Very well explained with good reasoning. Looking forward to the next one.