C#到VB.net转换为“?”条件语句 [英] C# to VB.net conversion for "?" conditionals

查看:74
本文介绍了C#到VB.net转换为“?”条件语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将一些C#?条件转换为vb.net(最有可能使用If..Then语句在

vb.net中),但是C#2VBNETconverter由
$转换b $ b KamalPatel没有转换它们:


string PurchaseType =(Convert.ToString(drwData [" DailyItem"])==

" ;真的)? " ID" :PID;


XmlNodeList Selections = xdcData.GetElementsByTagName((X == 0)?

" Highlight":" Selection") ;


TIA

NetSports

I need to convert some C# ?Conditionals over to vb.net (most likely in
vb.net using If..Then statements), but the C#2VBNETconverter by
KamalPatel isn''t converting them:

string PurchaseType = (Convert.ToString(drwData["DailyItem"]) ==
"True") ? "ID" : "PID";

XmlNodeList Selections = xdcData.GetElementsByTagName((X == 0) ?
"Highlight" : "Selection");

TIA
NetSports

推荐答案

拿一个看看其他转换器。来自
的免费SharpDevelop http://www.icsharpcode.net/OpenSource/ SD / 可以做到这一点。
http://www.developerfusion.co.uk/uti...sharptovb.aspx

它似乎正确地处理了这些陈述。


-

Peter Macej

Helixoft - http://www.vbdocman.com

VBdocman - VB,VB自动生成技术文档

..NET和ASP .NET代码
Take a look at other converters. Free SharpDevelop from
http://www.icsharpcode.net/OpenSource/SD/ can do this. There is also
online version at
http://www.developerfusion.co.uk/uti...sharptovb.aspx.
It seems it handles these statements correctly.

--
Peter Macej
Helixoft - http://www.vbdocman.com
VBdocman - Automatic generator of technical documentation for VB, VB
..NET and ASP .NET code


.. Net Sports写道:
..Net Sports wrote:
我需要将一些C#?条件转换为vb.net(最有可能在
中)使用If..Then语句的vb.net,但是KamalPatel的C#2VBNETconverter没有转换它们:

字符串PurchaseType =(Convert.ToString(drwData [" DailyItem" ;])==
" True")? " ID" :PID;

XmlNodeList Selections = xdcData.GetElementsByTagName((X == 0)?
" Highlight":" Selection");
I need to convert some C# ?Conditionals over to vb.net (most likely in
vb.net using If..Then statements), but the C#2VBNETconverter by
KamalPatel isn''t converting them:

string PurchaseType = (Convert.ToString(drwData["DailyItem"]) ==
"True") ? "ID" : "PID";

XmlNodeList Selections = xdcData.GetElementsByTagName((X == 0) ?
"Highlight" : "Selection");




自从我完成VB编程以来已经很长时间了。

请检查我的工作。但是应该转换成这样的东西。


dim PurchaseType As String

dim选择为XmlNodeList


如果drwData [" DailyItem"]。ToString()=" True"然后

PurchaseType =" ID"

否则

PurchaseType =" PID"

结束如果


如果X = 0那么

Selections = xdcData.GetElementsByTagName(" Highlight")

Else

Selections = xdcData.GetElementsByTagName(" Selection")

结束如果


希望有所帮助,


-

Sean



It has been a very long time since I''ve done any VB programming so
please check my work. But that should convert to something like this.

dim PurchaseType As String
dim Selections As XmlNodeList

If drwData["DailyItem"].ToString() = "True" Then
PurchaseType = "ID"
Else
PurchaseType = "PID"
End If

If X = 0 Then
Selections = xdcData.GetElementsByTagName("Highlight")
Else
Selections = xdcData.GetElementsByTagName("Selection")
End If

Hope that helps,

--
Sean


我也推荐Sean'的解决方案。


if你真的想单行它,你总是可以使用iif函数:
http://msdn.microsoft.com/library/de...l/vafctiif.asp
< br $>
卡尔


-

我的ASP.Net教程
http://www.openmymind.net/

" Fao,Sean" <恩********** @ yahoo.comI-WANT-NO-SPAM>在消息中写道

新闻:OD ************** @ TK2MSFTNGP12.phx.gbl ...
I would recommend Sean''s solution as well.

if you really want to single-line it, you can always use the iif function:
http://msdn.microsoft.com/library/de...l/vafctiif.asp

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Fao, Sean" <en**********@yahoo.comI-WANT-NO-SPAM> wrote in message
news:OD**************@TK2MSFTNGP12.phx.gbl...
.Net Sports写道:
.Net Sports wrote:
我需要将一些C#?Conditionals转换为vb.net(很可能是使用If..Then语句在
vb.net中),但是C#2VBNETconverter由
KamalPatel没有转换它们:

字符串PurchaseType =(Convert.ToString(drwData [" DailyItem"])==
" True")? " ID" :PID;

XmlNodeList Selections = xdcData.GetElementsByTagName((X == 0)?
" Highlight":" Selection");
I need to convert some C# ?Conditionals over to vb.net (most likely in
vb.net using If..Then statements), but the C#2VBNETconverter by
KamalPatel isn''t converting them:

string PurchaseType = (Convert.ToString(drwData["DailyItem"]) ==
"True") ? "ID" : "PID";

XmlNodeList Selections = xdcData.GetElementsByTagName((X == 0) ?
"Highlight" : "Selection");



自从我完成VB编程以来已经很长时间了,所以请检查我的工作。但是应该转换成这样的东西。

dim PurchaseType As String
dim Selections选择为XmlNodeList

如果drwData [" DailyItem"]。ToString()= "真"然后
PurchaseType =" ID"
否则
PurchaseType =" PID"
结束如果

如果X = 0那么
选择= xdcData.GetElementsByTagName(" Highlight")
其他
选择= xdcData.GetElementsByTagName(" Selection")
结束如果

希望有所帮助,

-
肖恩



It has been a very long time since I''ve done any VB programming so please
check my work. But that should convert to something like this.

dim PurchaseType As String
dim Selections As XmlNodeList

If drwData["DailyItem"].ToString() = "True" Then
PurchaseType = "ID"
Else
PurchaseType = "PID"
End If

If X = 0 Then
Selections = xdcData.GetElementsByTagName("Highlight")
Else
Selections = xdcData.GetElementsByTagName("Selection")
End If

Hope that helps,

--
Sean



这篇关于C#到VB.net转换为“?”条件语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆