开发者

C # to VB.NET - Using interface

Hey, I wonder how all this is in VB.NET

In C#

UserSettings vUsers = new UserSettings();
UserSettings.IUserSettings vUserI = (UserSettings.IUserSettings)vUsers

I took a chance to try to write it in VB.NET, but is this right?

In VB.NET

Dim vUsers As UserSettings = New UserSettings()
Dim vUserI As UserSettings.IUserSettings = (UserSettings.IUserSetting开发者_开发知识库s)vUsers


You are casting directly in c#, so I should think DirectCast would be the method to use here.

Dim vUsers As New UserSettings()

Dim vUserI As UserSettings.IUserSettings = DirectCast(vUsers, UserSettings.IUserSettings)


it will be written in vb.Net as:

Dim vUsers As New UserSettings()
Dim vUserI As UserSettings.IUserSettings = DirectCast(vUsers, UserSettings.IUserSettings)

Further, you can try this for any C# to VB.Net conversion:

http://www.developerfusion.com/tools/convert/csharp-to-vb/

Hope this Helps!!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜