定义一个变量 [英] Defining a variable
本文介绍了定义一个变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何定义公共SktClient变量以用于所有形式和功能:
How to define public SktClient variable for use in all forms and functions:
Socket SktClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
推荐答案
只需在您的表单中全局定义公共Socket SktClient.
然后,无论何时何地,只要使用SktClient.
喜欢:
Just defind public Socket SktClient globally in your form.
Then whenever/wherever needed, use the SktClient.
Like:
public Socket SktClient ; // defined gloabally
//Now somewhere in form
SktClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
这篇关于定义一个变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文