[Mono-list] RegistrationException

Alexander Chan alexc2649@nyc.rr.com
18 Feb 2003 21:32:02 -0500


--=-lDnFJxz2GaGVW37reQUq
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

sorry for responding sooner...
i implemented your suggestion. can anybody else suggest if i am doing
this correctly ?

alex
On Thu, 2003-02-06 at 15:07, Lluis Sanchez wrote:
> Hi!,
> 
> You can simply and the whole array to SerializationInfo, like this:
> 
> public override void GetObjectData (SerializationInfo info, StreamingContext
> ctx)
> {
>     base.GetObjectData (info,ctx);
>     info.AddValue ("ErrorInfo",errorInfo);
> }
> 
> The formater will take care of serializing the contents of the array.
> You should also write a serialization constructor like this:
> 
> private RegistrationException (SerializationInfo info, StreamingContext
> ctx): base (info,ctx)
> {
>     errorInfo = (RegistrationErrorInfo[]) info.GetValue ("ErrorInfo", typeof
> (RegistrationErrorInfo[]));
> }
> 
> This will deserialize the info.
> 
> Regards,
> Lluis.
> 
> 
> ----- Original Message -----
> From: "Alexander Chan" <alexc2649@nyc.rr.com>
> To: "Lluis Sanchez" <lluis@ideary.com>; <mono-list@lists.ximian.com>
> Sent: Thursday, February 06, 2003 8:50 PM
> Subject: Re: [Mono-list] RegistrationException
> 
> 
> > lluis,
> > i have implemented the GetObjectData() functionality in
> RegistrationException.
> > I am not sure i am doing it right. this is my first time doing something
> > like this. i am wondering if i am doing it right. i have attched the
> > class in this email. any help would greatly be appreciated.
> >
> > alexander chan
> >
-- 
Alexander Chan <alexc2649@nyc.rr.com>

--=-lDnFJxz2GaGVW37reQUq
Content-Disposition: attachment; filename=RegistrationException2.cs
Content-Type: text/plain; name=RegistrationException2.cs; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

// 
// System.EnterpriseServices.RegistrationException.cs
//
// Author:
//   Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Tim Coleman, 2002
//

using System;
using System.Runtime.Serialization;

namespace System.EnterpriseServices {
	[Serializable]
	public sealed class RegistrationException : SystemException {

		#region Fields

		RegistrationErrorInfo[] errorInfo;

		#endregion // Fields

		#region Constructors

		[MonoTODO]
		public RegistrationException (string msg)
			: base (msg)
		{
		}

		#endregion // Constructors

		#region Properties
			
		public RegistrationErrorInfo[] ErrorInfo {
			get { return errorInfo; }
		}

		#endregion // Properties

		#region Methods
		//the coding of GetObjectdata() is so far written by alexander chan
		public override void GetObjectData (SerializationInfo info, StreamingContext ctx)
		{
			base.GetObjectData(info,ctx);
			info.AddValue("ErrorInfo",errorInfo);
		}

		private RegistrationException (SerializationInfo info, Streammingcontext ctx):base (info,ctx)
		{
		errorInfo = (RegistrationErrorInfo[]) info.GetValue ("ErrorInfo", typeof
(RegistrationErrorInfo[]));
		}
		#endregion // Methods
	}
}

--=-lDnFJxz2GaGVW37reQUq--