惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy International News Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
V2EX - 技术
V2EX - 技术
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
O
OpenAI News
Cloudbric
Cloudbric
Google Online Security Blog
Google Online Security Blog
Schneier on Security
Schneier on Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Help Net Security
Help Net Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
L
Lohrmann on Cybersecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tenable Blog
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
The Hacker News
The Hacker News
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
V
Visual Studio Blog
P
Proofpoint News Feed
Webroot Blog
Webroot Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 三生石上(FineUI控件)
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
L
LangChain Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东

博客园 - James_Chen

SEO站内优化(On-page SEO) 一个逗号引发的IE7 Jquery Ajax失效 CSS IE6/IE7/IE8/FireFox CSS 兼容办法 hack - James_Chen Chromium书签同步无法连接到服务器的解决办法 jquery ajax 乱码解决 does not contain a definition for 80072745 80072efd 解决办法 FLASH ActionScript2.0 读取WebService数据 实现将dataset已有的一个datatable重新排序(转) ASP.NET程序中常用的三十三种代码 - James_Chen - 博客园 DataGridView 在程序集中找到无效的ServicedComponent派生类。 Cookie常用 - James_Chen - 博客园 regasm regsvcs区别 8004EOOF错误 - James_Chen - 博客园 给BindingNavigator加个保存按钮 DateSet和BindingNavigator合作的产物 Visual Studio 2005 中的 TableAdapter C#中计算两个时间的差
声明了属性后,可像使用类的字段那样使用这些属性。 - James_Chen - 博客园
James_Chen · 2006-06-20 · via 博客园 - James_Chen

private int myVar;

public int MyProperty
{
get return myVar;}
set { myVar = value;}
}

这使得获取和设置属性值时都可以使用非常自然的语法,如以下语句中所示:

person.Name = "Joe";
person.Age 
= 99;



class Person
{
private string m_name = "N/A";
private int m_Age = 0;

// Declare a Name property of type string:
public string Name
{
get
{
return m_name;
}

set
{
m_name 
= value;
}

}


// Declare an Age property of type int:
public int Age
{
get
{
return m_Age;
}


set
{
m_Age 
= value;
}

}


public override string ToString()
{
return "Name = " + Name + ", Age = " + Age;
}

}


class TestPerson
{
static void Main()
{
// Create a new Person object:
Person person = new Person();

// Print out the name and the age associated with the person:
System.Console.WriteLine("Person details - {0}", person);

// Set some values on the person object:
person.Name = "Joe"
person.Age 
= 99;
System.Console.WriteLine(
"Person details - {0}", person);

// Increment the Age property:
person.Age += 1;
System.Console.WriteLine(
"Person details - {0}", person);
}

}




/*输出
Person details - Name = N/A, Age = 0
Person details - Name = Joe, Age = 99
Person details - Name = Joe, Age = 100 
*/