Imports System.Drawing
Imports System.Runtime.CompilerServices

Public Module Extensions

    <Extension>
    Public Function ToIcon(image As Image)
        If TypeOf image Is Bitmap Then
            Return Icon.FromHandle(CType(image, Bitmap).GetHicon)
        End If
        Return Nothing
    End Function

End Module
