Finalize vs Dispose | C# Interview Questions

Поделиться
HTML-код
  • Опубликовано: 1 фев 2025

Комментарии • 23

  • @nabhoyar
    @nabhoyar 3 года назад +2

    Its best explanation. Just as how everyone suggested, you can slow down your speed as your contents are more when you are explaining. In between you can resummarize your points as well for better understanding. Other than that, it is the best explanation for GC. Keep it up

  • @anushinfobase3159
    @anushinfobase3159 Год назад

    Beautiful, well explained..
    Thanks
    ಚೆನ್ನಾಗಿದೆ ವಿವರಣೆ... 👌

  • @kadamrahulk
    @kadamrahulk 4 года назад +3

    Not understood 4:28 onward. I think It will not stop to dispose unmanaged resources.

  • @stoic2454
    @stoic2454 Год назад

    Let’s say my implementation uses dispose pattern, i wrap my object inside a using block there dispose will be called and unmanaged resource will be released, but what about managed resources for instance we maybe having a list or some variables like that, do we need to free their memory as well ? given the fact that we suppress finalise when we explicitly call dispose

  • @VSH077
    @VSH077 4 года назад +1

    Fantastic explanation. Thanks a lot.

  • @martapfahl940
    @martapfahl940 Год назад

    So is it somewhat comparable to e.g. removing event handlers in React in the useEffect cleanup function? I am javascript dev curious about C# programming. Thank you.

    • @Tmp6169
      @Tmp6169 6 месяцев назад

      Free Palestine

    • @martapfahl940
      @martapfahl940 6 месяцев назад

      @@Tmp6169 Fuck Palestine.

  • @theoceandragongaming
    @theoceandragongaming Год назад

    Why are you calling safe handle in the managed code section?

  • @DoGGy1110
    @DoGGy1110 Год назад

    Why u freeing umanaged where u should free managed?

  • @bishnupriyapradhan7768
    @bishnupriyapradhan7768 3 года назад +3

    I think you meant destructor and not destructure

  • @raghurambhagawatula7025
    @raghurambhagawatula7025 3 года назад +2

    4:28 and 5:24 doesnt make sense!!

  • @manishjawarkar84
    @manishjawarkar84 4 года назад

    very nicely explained...thank you

  • @wowpravin
    @wowpravin 2 года назад

    Good one! But not sure why recommend not implementing Finalizer? You are assuming that the clients of your class will always call Dispose.

    • @AvgDan
      @AvgDan Год назад

      When you add " : IDisposable" to a new class and select the potential fix for "Implement Interface with Dispose pattern", the boilerplate code will include this: "TODO: override finalizer only if 'Dispose(bool disposing)' has code to free unmanaged resources".
      Maybe the presenter is just regurgitating what MS says in the boilerplate code, I don't know. However, I did notice that not including the finalizer on a very small test class allowed me to create new instances of it ~3x faster.
      I think it's fair to expect programmers to dispose of objects that implement IDisposable. Perhaps a future version of Visual Studio will provide an informational underline under variable names which are instantiated as a type which implements IDisposable and they didn't do the instantiation in a using statement nor call Dispose.

  • @chennaiahp5765
    @chennaiahp5765 4 года назад

    good explanation

  • @AjaySingh-fq4fz
    @AjaySingh-fq4fz 5 лет назад +1

    Awesome

  • @vignesharunkumar6005
    @vignesharunkumar6005 4 года назад +2

    Nice explanation but very fast. Just give some gap

  • @SupriyaMondal3
    @SupriyaMondal3 4 года назад +2

    too fast, please give a pause between sentences.

  • @merajkhan5078
    @merajkhan5078 Год назад

    Please slow down your speed

  • @PyramidSpiritualSeekers
    @PyramidSpiritualSeekers 2 года назад

    not clearly understood and too fast explanation.

  • @wd669
    @wd669 Год назад

    Not clear explanation