请各位大侠帮我解释一下:SocketAsyncEventArgsPool

boss_kg 2012-04-23 10:32:36
菜鸟我刚刚开始学些网络这方面的,在msdn中看到SocketAsyncEventArgs例子中的SocketAsyncEventArgsPool 不太明白这个对象是什么意思,也没有找到在哪定义了这个类,求各位大侠帮忙解释一下。
非常感谢!
...全文
313 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
心如止水521 2013-08-13
  • 打赏
  • 举报
回复
对这个问题也是不明白,看了上面的回复才知道。原来这是自己写的一个类
boss_kg 2012-05-15
  • 打赏
  • 举报
回复
感谢各位了。!
马少华 2012-05-11
  • 打赏
  • 举报
回复
是的,这个类是自己写的。
boss_kg 2012-04-23
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]

看SocketAsyncEventArgs 构造函数的帮助,代码如下
C# code


// Represents a collection of reusable SocketAsyncEventArgs objects.
class SocketAsyncEventArgsPool
{
Stack<SocketAsyncEventArgs> m_pool;

// ……
[/Quote]

你的意思是说这个是自己写的不是系统自带的吗!
bdmh 2012-04-23
  • 打赏
  • 举报
回复
看SocketAsyncEventArgs 构造函数的帮助,代码如下


// Represents a collection of reusable SocketAsyncEventArgs objects.
class SocketAsyncEventArgsPool
{
Stack<SocketAsyncEventArgs> m_pool;

// Initializes the object pool to the specified size
//
// The "capacity" parameter is the maximum number of
// SocketAsyncEventArgs objects the pool can hold
public SocketAsyncEventArgsPool(int capacity)
{
m_pool = new Stack<SocketAsyncEventArgs>(capacity);
}

// Add a SocketAsyncEventArg instance to the pool
//
//The "item" parameter is the SocketAsyncEventArgs instance
// to add to the pool
public void Push(SocketAsyncEventArgs item)
{
if (item == null) { throw new ArgumentNullException("Items added to a SocketAsyncEventArgsPool cannot be null"); }
lock (m_pool)
{
m_pool.Push(item);
}
}

// Removes a SocketAsyncEventArgs instance from the pool
// and returns the object removed from the pool
public SocketAsyncEventArgs Pop()
{
lock (m_pool)
{
return m_pool.Pop();
}
}

// The number of SocketAsyncEventArgs instances in the pool
public int Count
{
get { return m_pool.Count; }
}

}
你想当“李逍遥”式的“大侠”吗? 这里无需计算机基础,无需编程经验,你也不必是计算机专业的在校大学生....只要爱好游戏,怀揣梦想! 有一定自主学习能力,跟着刘老师从“编程小白”修炼为游戏研发“大虾”吧!!!学习好Unity,其先决条件是一定要有稳固、扎实的编程基础!课程 《C# For Unity系列之入门篇》配套学习资料链接:http://pan.baidu.com/s/1gflxreN 密码:sou5;刘老师讲Unity学员群(2) 497429806一、热更新系列(技术含量:中高级):A:《lua热更新技术中级篇》https://edu.csdn.net/course/detail/27087B:《热更新框架设计之Xlua基础视频课程》https://edu.csdn.net/course/detail/27110C:《热更新框架设计之热更流程与热补丁技术》https://edu.csdn.net/course/detail/27118D:《热更新框架设计之客户端热更框架(上)》https://edu.csdn.net/course/detail/27132E:《热更新框架设计之客户端热更框架(中)》https://edu.csdn.net/course/detail/27135F:《热更新框架设计之客户端热更框架(下)》https://edu.csdn.net/course/detail/27136二:框架设计系列(技术含量:中级): A:《游戏UI界面框架设计系列视频课程》https://edu.csdn.net/course/detail/27142B:《Unity客户端框架设计PureMVC篇视频课程(上)》https://edu.csdn.net/course/detail/27172C:《Unity客户端框架设计PureMVC篇视频课程(下)》https://edu.csdn.net/course/detail/27173D:《AssetBundle框架设计_框架篇视频课程》https://edu.csdn.net/course/detail/27169三、Unity脚本从入门到精通(技术含量:初级)A:《C# For Unity系列之入门篇》https://edu.csdn.net/course/detail/4560B:《C# For Unity系列之基础篇》https://edu.csdn.net/course/detail/4595C: 《C# For Unity系列之中级篇》https://edu.csdn.net/course/detail/24422D:《C# For Unity系列之进阶篇》https://edu.csdn.net/course/detail/24465四、虚拟现实(VR)与增强现实(AR):(技术含量:初级)A:《虚拟现实之汽车仿真模拟系统 》https://edu.csdn.net/course/detail/26618五、Unity基础课程系列(技术含量:初级) A:《台球游戏与FlappyBirds—Unity快速入门系列视频课程(第1部)》 https://edu.csdn.net/course/detail/24643B:《太空射击与移动端发布技术-Unity快速入门系列视频课程(第2部)》https://edu.csdn.net/course/detail/24645 C:《Unity ECS(二) 小试牛刀》https://edu.csdn.net/course/detail/27096六、Unity ARPG课程(技术含量:初中级):A:《MMOARPG地下守护神_单机版实战视频课程(上部)》https://edu.csdn.net/course/detail/24965B:《MMOARPG地下守护神_单机版实战视频课程(中部)》https://edu.csdn.net/course/detail/24968C:《MMOARPG地下守护神_单机版实战视频课程(下部)》https://edu.csdn.net/course/detail/24979

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧