VJs Tip Of The Day
Reply
![]() |
|
From:
![]() VishalRJoshi
|
Serializing Exceptions for Special Purposes
We should be aware that Exception class implements ISerializable interface for its serialzing needs. If we derive our own exception from ApplicationException and we anticipate chances of our exceptions to be marshaled across process boundaries we need to add [Serializable] attribute to our custom exception... Along with that we might have to implement ISerializable which can be done in the following way:
Have this special constructor and add each private member variable that you want to persist
protected customException(SerializationInfo info, StreamingContext context):base(info,context) { _myProperty = info.GetString("_myProperty") }
Override the GetObjectData method
public override void GetObjectData(SerializationInfo info, Streamingcontext context) { info.AddValue("_myProperty", _myProperty) base.getObjectData(info, context) } Vishal Joshi Microsoft MVP .Net If You Think YOU CAN... You Can... http://VishalJoshi.Blogspot.com http://www.microsoft.com/india/mvp/indiamvp.aspx http://groups.msn.com/ChennaiNetUserGroup http://groups.msn.com/CNUG-DAM http://groups.msn.com/NetBloomingtonUserGroup
PS: While browsing through the Microsoft site I found that MS is offering a free skill assessment for .Net (usually worth $40) to everyone... Visit the link http://www.microsoft.com/learning/assessment/ for details
|
|
View other groups in this category.
![]() |
To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.
Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.
If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.
|
|
- Re: VJs Tip Of The Day VishalRJoshi
-