方法:public void abcd(int x,int y)
{
}
属性用public 声明
{
}
属性用public 声明
解决方案 »
- 怎样删除图片,请大侠们支个招,谢谢!
- 子窗体加到主窗体的TabControl中,关闭窗体时删除TabPage,关闭所有子窗体后,主窗体Close失效
- size和location也不能用于保证对齐?(外加一个字体的问题)
- 请问下(C#)学习Win Form编程如何啊?? 学习步骤又可以怎样划分呢??
- c#字符串中有"符
- 学员管理系统。
- 请教System.IO.Ports下SerialPort类的使用
- DataAdapter.fill数据的问题
- 不改变原来的类,监听属性值的修改,怎么实现?
- 怎么在datagrid custom webcontrols里实现动态列的数据绑定功能?谢谢!
- ADO数据库的问题,请大虾们救急。
- 怎样屏蔽在标题栏上的双击
public void yourMethod(string s)
{
}
属性
string connstr="";
public string ConnectionString
{
get
{
return connstr;
}
set
{
connstr=value;
}
}
{
//私有变量
private string priStr;
//可读写属性
//1、形如 public [类型] [名称]
public string Property1//2、使用get set
public string Property2
{
get
{
return priStr;
}
set
{
priStr=value;
}
}
//只读属性
public string PropertyReadOnly
{
get
{
return priStr;
}
}//只写属性
public string PropertyWriteOnly
{
set
{
priStr=value;
}
}
//方法:形如 public [返回值] 方法名([参数1],[参数2],……)
//3、无返回值方法
public void MyMethod(int index)
{
index++;
}
//返回int类型
public int MyAdd(int index)
{
return index++;
}
}
public void yourMethod(string s)
{
//do the operation
}
string strtemp;
public string temp_variable
{
get
{
return strtemp;
}
set
{
strtemp=value;
}
}