到Console.ReadLine() [英] console.ReadLine()

查看:82
本文介绍了到Console.ReadLine()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为一个有趣的聊天服务器提供了多个线程。



当我做控制台时。 ReadLine()和另一个线程执行console.WriteLine()它"break" console.readline()部分。我可以替换它吗?



我正在考虑为服务器制作一个表格,但我不知道是否有必要..

解决方案

顺便说一句,有人知道你是否可以在完成空白时使用〜来执行某个函数?



像void command(){


我在这里做的事情


}


~command(){


Console.WriteLine(" command void done!");


}


Hi, i got multiple threads for a chat server i been working on for fun.

When i do Console.ReadLine() and a another thread does console.WriteLine() it "breaks" the console.readline() part. Anything i can replace it with?

I was thinking of making a Form for the server but i dont know if that is necessary..

解决方案

By the way, does anyone know if you can use the ~ for a function when a void is done?

like void command(){

I do stuff here

}

~ command(){

Console.WriteLine("command void done!");

}


这篇关于到Console.ReadLine()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆