开发者

Convert Boolean to generic type

In VB.NET 2010, how to return a boolean开发者_开发知识库 value as generic type without compile warning?

thanks! Michael


You could turn Options Strict Off


generic, you mean this?

Sub Main()
    Console.WriteLine(blah(True).ToString)
    Console.ReadLine()
End Sub

Public Function blah(Of t)(ByVal typ As t) As T
    Return typ
End Function
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜