开发者

C # to VB.NET - Using interface

开发者 https://www.devze.com 2022-12-14 11:29 出处:网络
Hey, I wonder how all this is in VB.NET In C# UserSettings vUsers = new UserSettings(); UserSettings.IUserSettings vUserI = (UserSettings.IUserSettings)vUsers

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

精彩评论

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