确定在VBScript(COM-互操作)的.NET方法后缀编号 [英] Determining .Net method suffix number in VBScript (COM-interop)

查看:167
本文介绍了确定在VBScript(COM-互操作)的.NET方法后缀编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以使用通过COM-互操作在VBScript .NET方法。你必须追加一定的后缀数字的方法,因为重载不交叉的托管/非托管边界。后缀数字似乎不具有特定的顺序...如何确定后缀数字?

You can use .NET methods through COM-interop in VBScript. You have to append a certain suffix number to the method since overloads don't cross the managed/unmanaged boundary. The suffix number doesn't seem to have a particular order...how is the suffix number determined?

例如:

Dim encoding, bytesthroughdotnet
Set encoding = CreateObject("System.Text.UTF8Encoding")
    bytesthroughdotnet = encoding.GetBytes_4("你好Ğ") 'get bytes
    WScript.Echo LenB(bytesthroughdotnet) 'length
Set encoding = Nothing

为什么_4用于GetBytes会?

How come _4 is used for GetBytes?

(这个问题遵循此<一个href="http://stackoverflow.com/questions/9753651/system-text-utf8encoding-from-vbscript/9754093#comment12409367_9754093">response )

推荐答案

由于VBScript中不具有重载方法的支持,在一个类中的每个重载的方法是使用附加到他们的名字号唯一命名的。它们被编号按照它们在原始类中定义的顺序。在我的文章在使用.NET互操作性展示的更多信息中的VBScript在ASP自由。

Since VBScript does not have support for overloaded methods, each overloaded method in a class is named uniquely using numbers appended to their name. They are numbered in the order in which they are defined in the original class. More information in my article Using .Net Interops in VBScript on ASP Free.

这篇关于确定在VBScript(COM-互操作)的.NET方法后缀编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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