AVOID these 3 COMMON C# Performance MISTAKES

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ก.ค. 2024
  • So, do you care about C# performance in your #dotnet apps? There comes a time when most engineers start to also think in terms of performance. One common behavior is to focus on complex topics when it comes to C# performance, like Spans, Marshal, GC functionalities and so on. And more often than not we don't even realize that there are some commonly used patterns that are a C# performance nightmare! In this video we try to explain what exactly C# performance means, then we look into 3 common C# performance mistakes and, of course, how we can fix them.
    Join this channel to get source code access and other perks:
    / @codewrinkles
    Contents
    1. Intro: 00:00
    2. What does C# performance mean? 00:43
    3. First mistake to avoid: 01:30
    4. Second mistake to avoid: 05:54
    5. Third mistake to avoid: 09:01
    6. Recap: 12:08
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 11

  • @raminquliyev2268
    @raminquliyev2268 ปีที่แล้ว +3

    Long video about marshalling will be awesome. Thanks

  • @Pegie98
    @Pegie98 ปีที่แล้ว

    Nice video!
    My question is regarding Asynchronous programming in Windows applications. Specifically, the sample form_load event currently uses a void method. I am interested in implementing an Asynchronous method in this event, but I am not sure how to do so. Can you provide guidance on how to properly implement an Asynchronous method in the form_load event and other control events in a Windows application?
    Thanks

  • @lucasblomhall1184
    @lucasblomhall1184 ปีที่แล้ว

    Thank you so much for sharing this

  • @owenpbarker
    @owenpbarker 11 หลายเดือนก่อน

    If you ever say "This code is complicated" start over and redo it. I know this is an example of what you are trying to explain. I see all these devs trying to do complex code but in reality, if you simplify it, you wouldnt have all these apis having massive development steps just to bring it out. Stop writing complicated code. If its easy to read your code, it is easy for other developers to expand from your current code for other parts of the api, app, etc.

  • @kamaldesai933
    @kamaldesai933 ปีที่แล้ว +2

    How about using nameof(Gender.Male) to get "Male" ?

    • @Codewrinkles
      @Codewrinkles  ปีที่แล้ว +3

      A nameof expression produces the name of a variable, type, or member as the string constant. Therefore it would work the same as the constant string I mentioned in this video. The only problem with nameof for enums comes when you have something like Roles.ProductManager, Roles.SoftwareDeveloper and you would like to output "Product Manager" and "Software Developer". That's why I only talked about const strings in this video.

    • @dikod1304
      @dikod1304 ปีที่แล้ว

      @@Codewrinkles and what about scalability? so if we add one more enum type, we have to update application in order to add new const

    • @Codewrinkles
      @Codewrinkles  ปีที่แล้ว +1

      @@dikod1304 Exactly. Everything is a trade off between what's most important in each given scenario. You can have different approaches. For instance having consts only for enums that we heavily use with ToString() and that have composite enumerations (like UserManager). For enums without composite enumerations you can use nameof. If the enums are not converted to string that often you can then just use enums regularly. As developers we need however to be aware of the pros and cons of each approach so that in a given and very specific context we can make the right choices.

  • @teckyify
    @teckyify 10 หลายเดือนก่อน

    nameof(Enum.P)