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" <[EMAIL PROTECTED]>
> To: "Lluis Sanchez" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> 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 <[EMAIL PROTECTED]>
// 
// System.EnterpriseServices.RegistrationException.cs
//
// Author:
//   Tim Coleman ([EMAIL PROTECTED])
//
// 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
        }
}

Reply via email to