[英]using System.Net; IPEndPoint not found
過去,我是monodevelop和csharp litle經驗的新手。
嘗試執行此示例: http ://sharpsnmplib.codeplex.com/wikipage?title=600009&referringTitle= KB
我明白了
TestAsyncGet / Program.cs(32,32):錯誤CS0246:找不到類型或名稱空間名稱“ IPEndPoint”。 您是否缺少using指令或程序集引用? (CS0246)(TestAsyncGet)
感謝您的任何幫助。
參考文獻System.Net中還抱怨:
Projects / TestAsyncGet / TestAsyncGet / Program.cs(13,13):錯誤CS0825:上下文關鍵字“ var”可能僅出現在局部變量聲明(CS0825)(TestAsyncGet)中
從命令行運行:
mono TestAsyncGet.exe System.FormatException:輸入字符串的格式不正確,位於System.Int64.Parse(System.String s)[0x00000]中,位於TestAsyncGet.Program.Main的:0中(System.String [] args)[0x00000 ]在:0中
GetRequestMessage message = new GetRequestMessage(0,
VersionCode.V1,
new OctetString("stvtelco"),
new List<Variable> {new Variable(new ObjectIdentifier("1.3.6.1.2.1.1.4"))});
long ip = Int64.Parse("192.168.0.33");
var endpoint = new IPEndPoint(new IPAddress(ip), 161);
message.BeginGetResponse(endpoint, new UserRegistry(), endpoint.GetSocket(), ar => {
var response = message.EndGetResponse(ar);
Console.WriteLine(response);
}, null);
Console.Read();
確保您是:
.NET 4.0配置文件進行構建。 這將選擇dmcs
編譯器並啟用var
關鍵字語法;
在您的項目中有對System.dll
程序集的引用。 這就是System.Net
命名空間駐留在常規框架上的位置(對於Silverlight而言,這有點不同,因為它具有System.Net.dll
程序集);
using System.Net;
在文件的頂部。
在這些條件下,您應該能夠正確地編譯此代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.