开发者

C# Equivlant of C void?

开发者 https://www.devze.com 2023-02-25 04:23 出处:网络
Hi I have the following sub: static ustr *construct_packet(int ptype, int stype, int argc, ...) static ustr *construct_subpacket(int sptype, const char *data, int datalen, 开发者_C百科int lenbyte)

Hi I have the following sub:

static ustr *construct_packet(int ptype, int stype, int argc, ...)

static ustr *construct_subpacket(int sptype, const char *data, int datalen, 开发者_C百科int lenbyte)

I tried the "..." in C# and it just gives me an error of "Type Expected."

I also need to send multiple construct_subpacket's into the construct_packet sub.

What would be the equivalent to these in C#?

Question 2:

I want to pass weird ASCII characters like "char(13)" the box through a string without it being replaced by "?." How do I go about doing such a thing? Or is there no way?

Thanks


static string construct_packet(int ptype, int stype, int argc, ...)
static string construct_subpacket(int sptype, string data, int datalen, int lenbyte)

Note:

  1. You don't really have to pass datalen in C# - unlike with pointers, with strings you always know length of the string by checking the Length property on the string

  2. If you want to pass variable number of arguments, you can use "params" keyword. All those arguments have to be the same type

0

精彩评论

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