Wednesday

serializable abstract class, can be used for inheritance , C# .net

can be used for serialize object to xml


abstract public class AbstractXMLObject
{
public string XML
{
get
{
XmlSerializer xmlSerializer = new XmlSerializer(this.GetType());
StringWriter stringWriter = new StringWriter();
xmlSerializer.Serialize(stringWriter,this);
return stringWriter.ToString();
}
set
{
XmlSerializer xmlSerializer = new XmlSerializer(this.GetType());
StringReader stringReader = new StringReader(value);
this = xmlSerializer.Deserialize(stringReader);
}
}
}


more...

No comments:

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...