找不到类型或名称空间"Semaphore Slim" [英] The type or namespace 'Semaphore Slim could not be found
问题描述
有与此类似的问题
http://stackoverflow.com/questions/15658318/using-semaphore-in-c-sharp
我确定我的计算机上装有.NET 4.6.4预览版或更高版本.
那有什么呢?
我的理解是System.Threading包含SempahoreSlim类.
我正在使用此示例中的源代码
https://www.codeproject.com/articles/488668/csharp-tcp-server
仅列出了部分代码(TcpServer的前50行)
Having similar issue to this
http://stackoverflow.com/questions/15658318/using-semaphore-in-c-sharp
I have determined that I have .NET 4.6.4 Preview or greater on my machine.
So what gives?
My understanding is that System.Threading contains the SempahoreSlim class.
I am using source code from this example
https://www.codeproject.com/articles/488668/csharp-tcp-server
Just a partial code listing (first 50 lines of TcpServer)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
namespace tcpServer {
public delegate void tcpServerConnectionChanged(TcpServerConnection connection);
public delegate void tcpServerError(TcpServer server, Exception e);
public partial class TcpServer : Component {
private List<TcpServerConnection> connections;
private TcpListener listener;
private Thread listenThread;
private Thread sendThread;
private bool m_isOpen;
private int m_port;
private int m_maxSendAttempts;
private int m_idleTime;
private int m_maxCallbackThreads;
private int m_verifyConnectionInterval; private Encoding m_encoding;
private SemaphoreSlim sem;
private bool waiting;
推荐答案
忘记添加这是Unity C#项目!
如果我在VS中打开源项目,则看不到错误,并且项目属性显示我的目标是.NET Framework4.所以我想我的问题更多与Unity处理.net类的方式有关. .困惑我是否应该尝试在WITHIN内修复此问题 解决方案资源管理器中的VS还是...?
If I open the source project in VS I don't see the error and project properties shows I am targeting .Net framework 4. So I guess my question is more to do with the way Unity handles .net classes. Confused whether I should be trying to fix this WITHIN VS in the Solution explorer or...?
这篇关于找不到类型或名称空间"Semaphore Slim"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!