VB所需的帮助 - > C#翻译 [英] Help needed for VB --> C# translation

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

问题描述



我已经将一些API从VB转换为C#了几天了。

只有我是真正的新手对于这两种语言,但我设法完成了大部分工作

除了下一个语句,所以如果有人知道C#中的对应物是什么,那么这些VB语句的b $ b我会很感激:


公共功能(好吧,公众我知道但C#中的功能是什么?)


Public Enum


朋友财产(需要知道朋友和财产)


Dim wRecordset作为DAO.Recordset(我需要知道DAO.Recordset部分)


错误GoTo errHandler


私人mCol作为集合(C#对应的集合??,以为我可以

在这里使用对象)


退出功能


设置NewEnum = mCol。[_ NewEnum]


那里有在C#中类似于模块(类)的东西???


Thanx,如果您知道其中任何一个,请回复...

解决方案

2004年6月21日星期一15:06:00 +0200,tiger79< po ** @ freemail.nl>写道:


我已经将一些API从VB翻译成C#了几天了。
只有我''对于这两种语言都是真正的新手,但除了下一个语句之外,我设法做了大部分工作
,所以如果有人知道C#中对应的那些VB语句我会很感激:

公共函数(好吧,公众我知道但是C#中的函数是什么?)


Sub和Function在C#中是相同的。 Sub是一个返回''void''的方法,其中一个Function可以返回任何其他东西。


public void DoSomething()// Public Sub DoSomething

{

}


public string DoSomething()// Public Function DoSomething

{

}


公共枚举


公共枚举

朋友财产(需要知道朋友和财产)


其他人可以比我更好地解释这一点。我不认为C中有朋友#

Dim wRecordset作为DAO.Recordset(我需要知道DAO.Recordset部分)


DAO .Recordset wRecordset;

DAO是一个命名空间或类,其中定义了Recordset

On Error GoTo errHandler


试试

{

}

catch

{

}

私人mCol作为Collection(C#对应的Collection?,以为我可以在这里使用对象)


不确定是否有C#对应的Collection

退出功能


返回;

设置NewEnum = mCol。[_ NewEnum]


不确定

并且在C#中有类似模块(类)的东西???


如果这是你的意思,有一个Module类。它在.Net Framework中并且不属于任何特定语言。

Thanx,如果你知道其中任何一个,请回复...




-

快乐编码!

Morten Wennevik [C#MVP]


>公共功能(好吧,公众我知道但是C#中的功能是什么?)


public int myFunction()

{

}


(其中int是返回类型,myFunction是函数名称)

Public Enum
几乎一样。

public enum myEnum

{

element1,

element2

}

朋友财产(需要知道朋友和财产)
internal int myProperty

{

get

{

返回someValue;

}

set

{

someVariable = value;

}

}

Dim wRecordset作为DAO.Recordset(我需要知道DAO.Recordset部分)
没有这样的事情。 DataTable可能是最接近的东西,你必须阅读

up it ity恐惧因为它们完全不同。

私人mCol作为收藏(C#对应的Collection ??,以为i
可以在这里使用对象)
Hashtable mCol = new Hashtable();


别忘了放顶部有''使用System.Collections''。

退出函数
返回

设置NewEnum = mCol。[_ NewEnum]
IEnumerator newEnum = mCol.GetEnumerator()

并且在C#中有类似模块(类)的东西???



public class MyClass

{


}




首先是快速答案,

我想指出一些关于此事:

Dim wRecordset作为DAO.Recordset(我需要知道DAO.Recordset部分)
没有这样的事。 DataTable可能是最接近的东西,你必须阅读

up it ity恐惧因为它们完全不同。


我现在使用的是SQL CE 2.0数据库而不是现实数据集,因此

有直接连接到这些数据库的代码???

" John Wood" < SP ** @ isannoying.com>在消息中写道

news:uk ************** @ TK2MSFTNGP12.phx.gbl ...

公共功能(好吧,公众我知道,但C#中的功能是什么?)



public int myFunction()


}

(其中int是返回类型,myFunction是函数名称)

Public Enum


几乎相同。
public enum myEnum
{
element1,
element2
}

朋友财产(需要知道朋友和财产)


internal int myProperty
{
获得
{
返回someValue;
}
设置
{
someVariable = value;
}

Dim wRecordset作为DAO.Recordset(我需要知道DAO.Recordset部分)


没有这样的事情。 DataTable可能是最接近的东西,你必须



读取它我很害怕,因为它们完全不同。

私有mCol作为集合(C#对应的集合??,我认为


可以

在这里使用对象)


Hashtable mCol =新的Hashtable();

不要忘记在顶部放置一个''using System.Collections''。

退出函数

返回

设置NewEnum = mCol。[_ NewEnum]


IEnumerator newEnum = mCol.GetEnumerator()

C#中有类似模块(类)的东西???


公共类MyClass
{

}



Hi,
I''ve been translating some API''s from VB to C# for a couple of days now.
Only I''m a real newbie to both languages, but I managed to do most of it
except the next statements, so if anyone knows what the counterpart in C# is
of those VB statements I would appreciate :

Public Function (ok, public I know but what is a Function in C# ?)

Public Enum

Friend Property (need to know both Friend and Property)

Dim wRecordset As DAO.Recordset (I need to know the DAO.Recordset part)

On Error GoTo errHandler

Private mCol as Collection (C# counterpart of Collection ??, thought i could
use object here)

Exit Function

Set NewEnum = mCol.[_NewEnum]

And is there in C# something like modules (classes) ???

Thanx, please respond if u knw any of these...

解决方案

On Mon, 21 Jun 2004 15:06:00 +0200, tiger79 <po**@freemail.nl> wrote:

Hi,
I''ve been translating some API''s from VB to C# for a couple of days now.
Only I''m a real newbie to both languages, but I managed to do most of it
except the next statements, so if anyone knows what the counterpart in C# is
of those VB statements I would appreciate :

Public Function (ok, public I know but what is a Function in C# ?)
Sub and Function is the same in C#. A Sub is a method returning ''void'', where a Function can return anything else.

public void DoSomething() // Public Sub DoSomething
{
}

public string DoSomething() // Public Function DoSomething
{
}


Public Enum

public enum
Friend Property (need to know both Friend and Property)

Someone else could explain this much better than me. I don''t think there is a Friend in C#
Dim wRecordset As DAO.Recordset (I need to know the DAO.Recordset part)

DAO.Recordset wRecordset;
DAO is a namespace or class where Recordset is defined
On Error GoTo errHandler

try
{
}
catch
{
}
Private mCol as Collection (C# counterpart of Collection ??, thought i could
use object here)

Not sure if there is a C# counterpart of Collection
Exit Function

return;
Set NewEnum = mCol.[_NewEnum]

Not sure
And is there in C# something like modules (classes) ???

There is a Module class if that is what you mean. It''s in .Net Framework and doesn''t belong to any particular language.
Thanx, please respond if u knw any of these...



--
Happy coding!
Morten Wennevik [C# MVP]


> Public Function (ok, public I know but what is a Function in C# ?)

public int myFunction()
{

}

(where int is the return type, myFunction is the function name)

Public Enum pretty much the same.
public enum myEnum
{
element1,
element2
}
Friend Property (need to know both Friend and Property) internal int myProperty
{
get
{
return someValue;
}
set
{
someVariable = value;
}
}
Dim wRecordset As DAO.Recordset (I need to know the DAO.Recordset part) No such thing. DataTable is probably the closest thing, you''ll have to read
up on it I''m afraid as they''re quite different.
Private mCol as Collection (C# counterpart of Collection ??, thought i could use object here) Hashtable mCol = new Hashtable();

Don''t forget to put a ''using System.Collections'' at the top.
Exit Function return
Set NewEnum = mCol.[_NewEnum] IEnumerator newEnum = mCol.GetEnumerator()
And is there in C# something like modules (classes) ???


public class MyClass
{

}



First of all thanx for the swift answers,
I''d like to point out something regarding this :

Dim wRecordset As DAO.Recordset (I need to know the DAO.Recordset part) No such thing. DataTable is probably the closest thing, you''ll have to read
up on it I''m afraid as they''re quite different.

I am using a SQL CE 2.0 database now instead than a reald dataset, so is
there code that directly connects to such databases ???
"John Wood" <sp**@isannoying.com> wrote in message
news:uk**************@TK2MSFTNGP12.phx.gbl...

Public Function (ok, public I know but what is a Function in C# ?)



public int myFunction()
{

}

(where int is the return type, myFunction is the function name)

Public Enum


pretty much the same.
public enum myEnum
{
element1,
element2
}

Friend Property (need to know both Friend and Property)


internal int myProperty
{
get
{
return someValue;
}
set
{
someVariable = value;
}
}

Dim wRecordset As DAO.Recordset (I need to know the DAO.Recordset part)


No such thing. DataTable is probably the closest thing, you''ll have to


read up on it I''m afraid as they''re quite different.

Private mCol as Collection (C# counterpart of Collection ??, thought i


could

use object here)


Hashtable mCol = new Hashtable();

Don''t forget to put a ''using System.Collections'' at the top.

Exit Function


return

Set NewEnum = mCol.[_NewEnum]


IEnumerator newEnum = mCol.GetEnumerator()

And is there in C# something like modules (classes) ???


public class MyClass
{

}



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

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