简体   繁体   中英

How can I have a sub that accepts a variable as byref without declaring what type of variable it is?

How can I have a sub that accepts a variable as byref without declaring what type of variable it is (it could be int, string, etc.) but still have some of the other parameters defined?

I want a sub like this:

Private Sub example(ByRef variable, ByRef reader as MySqlDataReader, ByVal columnName as String)

您可以创建一个通用方法:

Private Sub Example(Of T)(ByRef variable As T, ByRef reader as MySqlDataReader, ByVal columnName as String)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM