using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;namespace ConsoleApplication34
{
class Program
{
class people
{
public string name;
public int age;
public string Name
{
get
{
return name;
}
set
{
name = value;
}
} public int Age
{
get
{
return age;
}
set
{
if (age > 0 && age < 120)
{
age = value;
}
else
{ throw new ArgumentOutOfRangeException("MyIntProp", value, "MyIntProp must be assingned a value between 0 and 120"); } }
} public people(string name, int age)
{
this.name = name;
this.age = age;
}
public void speak()
{ Console.WriteLine("我是{0},年龄:{1}",name,age);
}
}
static void Main(string[] args)
{ people op = new people("d",133);
op.speak(); Console.ReadKey();
} }
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;namespace ConsoleApplication34
{
class Program
{
class people
{
public string name;
public int age;
public string Name
{
get
{
return name;
}
set
{
name = value;
}
} public int Age
{
get
{
return age;
}
set
{
if (age > 0 && age < 120)
{
age = value;
}
else
{ throw new ArgumentOutOfRangeException("MyIntProp", value, "MyIntProp must be assingned a value between 0 and 120"); } }
} public people(string name, int age)
{
this.name = name;
this.age = age;
}
public void speak()
{ Console.WriteLine("我是{0},年龄:{1}",name,age);
}
}
static void Main(string[] args)
{ people op = new people("d",133);
op.speak(); Console.ReadKey();
} }
}
解决方案 »
- 各位Winform高手,过来帮个忙吧
- DataGridView里面的数据怎么打印出来?
- WCF 用netTcpBinding,相对于通常的socket通讯,网络上开销是不是会大?大约多少?
- 关于dropdownlist控件的问题?(顶者有分)
- WinForm中WebBrowser的Cookie问题
- 有没有长沙的同志,了解下长沙的.Net待遇和开发环境
- 请教Dataset.ReadXml读字符串XML数据的问题
- 水晶报表的图片问题?请大家帮忙!!!
- 我如何把一个int的Array拷贝到一个int[]?
- 请问, 银行系统一卡通, 第三磁道验证通常是怎么加密的。
- 随机生成密码时,随机数竟然重复... 在线求解...
- 求1000字的报表管理解决方案
{
this.Name = name;
this.Age = age;
}
{ }
people op = new people);
op.Name="d";
op.Age=133;