如何从外部类调用过程 [英] How to call a procedure from an external class
问题描述
所以我在C#中创建了一个类,但该项目在vb.net中。我想调用一个名为main()的类中的过程我将类导入到vb.net项目但是我无法弄清楚我做错了什么...任何人都可以解释我怎么能在vb中做到这一点.net?
以下是我正在使用的类中的一些代码..类的名称是TagAPI.dll
使用系统;
使用 System.Collections.Generic;
使用 System.Linq;
使用 System.Text;
使用 System.Threading.Tasks;
使用 Newtonsoft.Json;
使用 System.Net;
使用 System.Xml.Linq;
使用 System.IO;
命名空间 TagAPI
{
public class Class1
{
// how这有效......
// 主应用程序读取并显示在列表框中的文件夹名称
// 用户选择和版本保存在versionselect.txt
// (此应用程序)应用程序读取versionselect.txt( - )并读取json并生成参数然后创建一个新的txt文件并运行参数。
// 返回主应用程序。
class atomMinecraft
{
内部 静态字典<字符串,字符串 [] < span class =code-keyword>> versionData = new 字典<字符串,字符串 [] >
{
。
。
。
}
静态 void Main()
{
// Environment.GetFolderPath(Environment.SpecialFolder .ApplicationData
string text = System.IO.File.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)+ /。minecraft / TagCraftMC Files / Settings / versionselect.txt);
}
有人能告诉我在Visual Basic应用程序中可以添加什么来调用主程序吗? div class =h2_lin>解决方案
我已经通过使用
public static void main()
An d更改名称空间的名称(不知道为什么这是一个问题......)无论如何,谢谢:D
So I created a class in C# but the project is in vb.net. I want to call a procedure that is inside that class called main() I have imported the class to the vb.net project but I can not figure out what I am doing wrong... Can anyone explain how I can do that in vb.net?
Here is some of the code in the the class I am using.. The name of the class is TagAPI.dll
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using System.Net;
using System.Xml.Linq;
using System.IO;
namespace TagAPI
{
public class Class1
{
//how this works...
//folder names read by main application and shown in listbox
//user selects and version gets saved in versionselect.txt
//(this application)application reads versionselect.txt (-) and reads json and makes arguments and then create a new txt file and run the argument.
//go back to main app.
class atomMinecraft
{
internal static Dictionary<string, string[]> versionData = new Dictionary<string, string[]>
{
.
.
.
}
static void Main()
{
//Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData
string text = System.IO.File.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/.minecraft/TagCraftMC Files/Settings/versionselect.txt");
}
Can anyone tell me what I can add in my visual basic application to call the main procedure?
Hi, I have fixed the issue by using
public static void main()
And changing the name of the namespace (not sure why this was an issue...) anyway thanks :D
这篇关于如何从外部类调用过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!