Proper way to dispose a BitmapSource

后端 未结 1 716
南笙
南笙 2020-12-11 16:30

How are you supposed to dispose of a BitmapSource ?

// this wont work because BitmapSource doesnt implement IDisposable
using(BitmapSource bitmap = new Bitm         


        
相关标签:
1条回答
  • 2020-12-11 17:17

    You do not have to Dispose() a BitmapSource. Unlike some other "image" classes in the Framework, it does not wrap any native resources.

    Just let it go out of scope, and the garbage collector will free its memory.

    0 讨论(0)
提交回复
热议问题