I have this line of code:
System.Drawing.Icon icon = System.Drawing.Icon.FromHandle(shinfo.hIcon);
A few lines later, after using the icon, I have a line:
Win32.DestroyIcon(shinfo.hIcon);
However, when running static analysis in my code, it says that there is potential for Resource_Leak from the icon. I am wondering if this will make a difference if I call the dispose method:
icon.Dispose();
not Win32.DestroyIcon (), which is being used right now. Is there any difference between the two? I just support this code, so I'm not sure if the original developer used the special Winnet.DestroyIcon.
source
share