别人的码中加了如下内容是什么意思:为什么要加这个,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;
}
}
[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;
}
}
这些都是特性,我不知道这些, 我知道在写WebService的时候每个方法前都得加[WebMothod],作用就是大概说这是一个外部可以调用的方法。
http://www.kuqin.com/dotnet/20080628/10196.html
Serializable 可序列化