我創建了一個遊戲,其中包括很多其他類中列出的方法...... 所以我想在全局中使用這個類,所以我將它存儲在一個DLL中(以便能夠在其他幾個項目中使用它)Visual Studio不讀我的dll嗎? (作爲命名空間)
但不知何故,Visual Studio沒有找到我引用的那個DLL的命名空間!
有什麼,我做錯了什麼? 'fncs'DLL的命名空間也被稱爲'fncs'... 它們都是在.NET的相同版本中創建的...... 在此先感謝!
的DLL:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
using System.Runtime.InteropServices;
namespace fncs {
class io {
public static bool write(string dir, object[] obj) {
try {
File.WriteAllLines(dir, ((System.Collections.IEnumerable)obj).Cast<object>().Select(x => x.ToString()).ToArray());
} catch (Exception e) {
return false;
} return true;
}
public static string read(string dir) {
StreamReader r = new StreamReader(dir);
return r.ReadToEnd();
}
public static void saveToServer(string x, string y) {
// hidden
}
}
class rc {
public static void echo(object obj) {
Console.WriteLine(obj.ToString());
}
public static string get() {
return Console.ReadLine();
}
}
class math {
public static int add(int a, int b) {
return a + b;
}
}
class web {
public static string getWebContent(string url) {
WebClient c = new WebClient();
string s;
try {
s = c.DownloadString(url);
} catch (WebException w) {
return w.ToString();
} return s;
}
public static string OpenSQL() {
SQLConnection SQL = new SQLConnection();
return SQL.BindStatus();
}
public static string post(string Url, params string[] postdata) {
string result = string.Empty;
string data = string.Empty;
System.Text.ASCIIEncoding ascii = new ASCIIEncoding();
if (postdata.Length % 2 != 0) {
Console.WriteLine("Parameters must be even , \"user\" , \"value\" , ... etc");
return string.Empty;
}
for (int i = 0; i < postdata.Length; i += 2) {
data += string.Format("&{0}={1}", postdata[i], postdata[i + 1]);
}
data = data.Remove(0, 1);
byte[] bytesarr = ascii.GetBytes(data);
try {
WebRequest request = WebRequest.Create(Url);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = bytesarr.Length;
System.IO.Stream streamwriter = request.GetRequestStream();
streamwriter.Write(bytesarr, 0, bytesarr.Length);
streamwriter.Close();
WebResponse response = request.GetResponse();
streamwriter = response.GetResponseStream();
System.IO.StreamReader streamread = new System.IO.StreamReader(streamwriter);
result = streamread.ReadToEnd();
streamread.Close();
} catch (Exception ex) {
Console.WriteLine(ex.Message);
}
return result;
}
}
class SQLConnection {
public string conn_bind;
public SQLConnection() {
//hidden
}
public string BindStatus() {
return conn_bind;
}
}
}
對不起,如果使用這個標題是錯誤的,但我不知道在這種情況下使用正確的話...我終究15歲了。 – John
說你的圖像是空的。你能把它粘貼在這裏嗎? –
噢,對不起,現在修復... – John