代码中加这个是什么意思?

zhouyanlizyl 2009-03-26 10:53:11
别人的码中加了如下内容是什么意思:为什么要加这个,Serializable有什么用?
[Serializable]
public class TemplateConfiguration
{
#region members

/// <summary>
/// The base folder of the templates, if any.
/// </summary>
private string baseDirectory;

/// <summary>
/// The SMTP server to be used.
/// </summary>
private string smtpServer;

/// <summary>
/// The available template groups.
/// </summary>
private ArrayList templateGroups;

#endregion

#region properties

/// <summary>
/// The base folder of the templates, if any.
/// </summary>
[XmlElement()]
public string BaseDirectory
{
get
{
return System.Configuration.ConfigurationSettings.AppSettings["MailTemplateBaseDirectory"];//不是前面已经有了这句了吗?怎么这里还要呢?
}
set
{
this.baseDirectory = value;
}
}

/// <summary>
/// The SMTP server to be used.
/// </summary>
[XmlElement()]
public string SmtpServer
{
get
{
return this.smtpServer;
}

set
{
this.smtpServer = value;
}
}


/// <summary>
/// The available template groups.
/// </summary>
[XmlArray("Groups")]
[XmlArrayItem("TemplateGroup", typeof(TemplateGroupElement))]

public ArrayList TemplateGroups
{
get
{
return this.templateGroups;
}

set
{
this.templateGroups = value;
}
}
...全文
127 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
java343837022 2009-03-27
  • 打赏
  • 举报
回复
支持序列化
支持xml
ViewStates 2009-03-26
  • 打赏
  • 举报
回复
Attribute
Serializable 可序列化
kkun_3yue3 2009-03-26
  • 打赏
  • 举报
回复
都是特性
http://www.kuqin.com/dotnet/20080628/10196.html
伤心的小水沟 2009-03-26
  • 打赏
  • 举报
回复



这些都是特性,我不知道这些, 我知道在写WebService的时候每个方法前都得加[WebMothod],作用就是大概说这是一个外部可以调用的方法。
zhouyanlizyl 2009-03-26
  • 打赏
  • 举报
回复
如上红色内容

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧