VB到C# [英] VB to C#

查看:75
本文介绍了VB到C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请有人将以下C#代码转换为VB .NET

据我所知,其中有一些错误,但我不确定。

if(WTSEnumerateSessions(IntPtr.Zero,0,1,ref buffer,ref count))

{

WTS_SESSION_INFO [] sessionInfo = new WTS_SESSION_INFO [count];

for(int index = 0; index< count; index ++)

sessionInfo [index] = Marshal.PtrToStructure(buffer +

(sizeof( WTS_SESSION_INFO)* index),typeof(WTS_SESSION_INFO));


TIA

Please, can someone convert the following C# code to VB .NET
As far as I can see there are some errors in it, but I am not sure.
if (WTSEnumerateSessions(IntPtr.Zero, 0, 1, ref buffer, ref count))
{
WTS_SESSION_INFO[] sessionInfo = new WTS_SESSION_INFO[count];
for (int index = 0; index < count; index++)
sessionInfo[index] = Marshal.PtrToStructure(buffer +
(sizeof(WTS_SESSION_INFO) * index), typeof(WTS_SESSION_INFO));

TIA

推荐答案

" Nikolay Petrov" ; <乔************** @ mail.bg> schrieb:
"Nikolay Petrov" <jo**************@mail.bg> schrieb:
请有人将以下C#代码转换为VB .NET
据我所知,其中有一些错误,但我不确定。

if(WTSEnumerateSessions(IntPtr.Zero,0,1,ref buffer,ref count))
{WTS_SESSION_INFO [] sessionInfo = new WTS_SESSION_INFO [count];
for(int index = 0; index< count; index ++)
sessionInfo [index] = Marshal.PtrToStructure(缓冲区+
(sizeof(WTS_SESSION_INFO)*索引),typeof(WTS_SESSION_INFO));
Please, can someone convert the following C# code to VB .NET
As far as I can see there are some errors in it, but I am not sure.

if (WTSEnumerateSessions(IntPtr.Zero, 0, 1, ref buffer, ref count))
{
WTS_SESSION_INFO[] sessionInfo = new WTS_SESSION_INFO[count];
for (int index = 0; index < count; index++)
sessionInfo[index] = Marshal.PtrToStructure(buffer +
(sizeof(WTS_SESSION_INFO) * index), typeof(WTS_SESSION_INFO));




\\\

如果WTSEnumerateSessions(IntPtr.Zero,0,1,Buffer,count)那么

Dim sessionInfo(count - 1)As WTS_SESSION_INFO

索引As Integer = 0 To count - 1

sessionInfo(index)= Marshal.PtrToStructure(New IntPtr(buffer +

(Marshal.SizeOf(GetType(WTS_SESSION_INFO))* index)),

GetType(WTS_SESSION_INFO))

下一个索引

结束如果

///


对于一个好的C#转VB.NET转换器,请看这里:


即时VB

< URL:http:// www。 tangibleoftoftwaresolutions.com/Product_Details/Instant_VB/Instant_VB.htm>


-

MS Herfried K. Wagner

MVP<网址:http://dotnet.mvps.org/>

VB< URL:http://dotnet.mvps.org/dotnet/faqs/>


如何转换有错误的代码?


" Herfried K. Wagner [MVP]" <喜*************** @ gmx.at>在消息中写道

news:O%**************** @ TK2MSFTNGP12.phx.gbl ...
What about converting code with errors?

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:O%****************@TK2MSFTNGP12.phx.gbl...
" Nikolay Petrov <乔************** @ mail.bg> schrieb:
"Nikolay Petrov" <jo**************@mail.bg> schrieb:
请有人将以下C#代码转换为VB .NET
据我所知,其中有一些错误,但我不确定。

if(WTSEnumerateSessions(IntPtr.Zero,0,1,ref buffer,ref count))
{WTS_SESSION_INFO [] sessionInfo = new WTS_SESSION_INFO [count];
for(int index = 0; index< count; index ++)
sessionInfo [index] = Marshal.PtrToStructure(缓冲区+
(sizeof(WTS_SESSION_INFO)*索引),typeof(WTS_SESSION_INFO));
Please, can someone convert the following C# code to VB .NET
As far as I can see there are some errors in it, but I am not sure.

if (WTSEnumerateSessions(IntPtr.Zero, 0, 1, ref buffer, ref count))
{
WTS_SESSION_INFO[] sessionInfo = new WTS_SESSION_INFO[count];
for (int index = 0; index < count; index++)
sessionInfo[index] = Marshal.PtrToStructure(buffer +
(sizeof(WTS_SESSION_INFO) * index), typeof(WTS_SESSION_INFO));

<如果WTSEnumerateSessions(IntPtr.Zero,0,1,Buffer,count)那么
Dim sessionInfo(count - 1)为WTS_SESSION_INFO
对于索引As Integer = 0要计数 - 1
sessionInfo(index)= Marshal.PtrToStructure(新IntPtr(缓冲区+
(Marshal.SizeOf(GetType(WTS_SESSION_INFO))* index)), GetType(WTS_SESSION_INFO))
下一个索引
结束如果
///

对于一个好的C#到VB.NET转换器ta请看这里:

即时VB
< URL:http://www.tangiblesoftwaresolutions.com/Product_Details/Instant_VB/Instant_VB.htm>

- -
MS Herfried K. Wagner
MVP< URL:http://dotnet.mvps.org/>
VB< URL:http://dotnet.mvps.org/ dotnet / faqs />



\\\
If WTSEnumerateSessions(IntPtr.Zero, 0, 1, Buffer, count) Then
Dim sessionInfo(count - 1) As WTS_SESSION_INFO
For index As Integer = 0 To count - 1
sessionInfo(index) = Marshal.PtrToStructure(New IntPtr(buffer +
(Marshal.SizeOf(GetType(WTS_SESSION_INFO)) * index)),
GetType(WTS_SESSION_INFO))
Next index
End If
///

For a good C# to VB.NET converter take a look here:

Instant VB
<URL:http://www.tangiblesoftwaresolutions.com/Product_Details/Instant_VB/Instant_VB.htm>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>



我们的转换器(Instant C#和Instant VB)能够转换不完整的

代码高成功率 - 即带有变量或方法的代码片段

在其他地方定义。但是,如果你的代码在语法上有错误,那么我们就不做任何预测 - 它可能会转换,或者会失败。正确

语法是必要的,以便解析成功。


David Anton

有形软件解决方案公司
< a rel =nofollowhref =http://www.tangiblesoftwaresolutions.comtarget =_ blank> www.tangiblesoftwaresolutions.com


" Nikolay Petrov" ;写道:
Our converters (Instant C# and Instant VB) are able to convert incomplete
code with a high success rate - i.e., code snippets with variables or methods
defined elsewhere. However, if you have code which has errors in syntax,
then we make no predictions - it may convert, or fail miserably. Correct
syntax is necessary to allow parsing to succeed.

David Anton
Tangible Software Solutions Inc.
www.tangiblesoftwaresolutions.com

"Nikolay Petrov" wrote:
如何转换代码有错误?

Herfried K. Wagner [MVP]" <喜*************** @ gmx.at>在消息中写道
新闻:O%**************** @ TK2MSFTNGP12.phx.gbl ...
What about converting code with errors?

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:O%****************@TK2MSFTNGP12.phx.gbl...
" Nikolay Petrov" <乔************** @ mail.bg> schrieb:
"Nikolay Petrov" <jo**************@mail.bg> schrieb:
请有人将以下C#代码转换为VB .NET
据我所知,其中有一些错误,但我不确定。

if(WTSEnumerateSessions(IntPtr.Zero,0,1,ref buffer,ref count))
{WTS_SESSION_INFO [] sessionInfo = new WTS_SESSION_INFO [count];
for(int index = 0; index< count; index ++)
sessionInfo [index] = Marshal.PtrToStructure(缓冲区+
(sizeof(WTS_SESSION_INFO)*索引),typeof(WTS_SESSION_INFO));
Please, can someone convert the following C# code to VB .NET
As far as I can see there are some errors in it, but I am not sure.

if (WTSEnumerateSessions(IntPtr.Zero, 0, 1, ref buffer, ref count))
{
WTS_SESSION_INFO[] sessionInfo = new WTS_SESSION_INFO[count];
for (int index = 0; index < count; index++)
sessionInfo[index] = Marshal.PtrToStructure(buffer +
(sizeof(WTS_SESSION_INFO) * index), typeof(WTS_SESSION_INFO));

<如果WTSEnumerateSessions(IntPtr.Zero,0,1,Buffer,count)那么
Dim sessionInfo(count - 1)为WTS_SESSION_INFO
对于索引As Integer = 0要计数 - 1
sessionInfo(index)= Marshal.PtrToStructure(新IntPtr(缓冲区+
(Marshal.SizeOf(GetType(WTS_SESSION_INFO))* index)), GetType(WTS_SESSION_INFO))
下一个索引
结束如果
///

对于一个好的C#到VB.NET转换器ta请看这里:

即时VB
< URL:http://www.tangiblesoftwaresolutions.com/Product_Details/Instant_VB/Instant_VB.htm>

- -
MS Herfried K. Wagner
MVP< URL:http://dotnet.mvps.org/>
VB< URL:http://dotnet.mvps.org/ dotnet / faqs />



\\\
If WTSEnumerateSessions(IntPtr.Zero, 0, 1, Buffer, count) Then
Dim sessionInfo(count - 1) As WTS_SESSION_INFO
For index As Integer = 0 To count - 1
sessionInfo(index) = Marshal.PtrToStructure(New IntPtr(buffer +
(Marshal.SizeOf(GetType(WTS_SESSION_INFO)) * index)),
GetType(WTS_SESSION_INFO))
Next index
End If
///

For a good C# to VB.NET converter take a look here:

Instant VB
<URL:http://www.tangiblesoftwaresolutions.com/Product_Details/Instant_VB/Instant_VB.htm>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>




这篇关于VB到C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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