473,409 Members | 1,934 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

XMLSerialization Framework version 2.0.40607

hi,

Perhaps someone can help me. I am trying to serialize an object but the
serialization isn't working. I have created a small console app to show my
problem. Perhaps someone with more knowledge could nudge me in the correct
direction.

Regards
Lee

#region Using directives

using System;

using System.Collections.Generic;

using System.Xml.Serialization;

#endregion

namespace TestSerialization

{

public class Employee

{

public Employee()

{

}

public Employee( string name )

{

this.Name = name;

}

public string Name

{

get

{

return _name;

}

set

{

_name = value;

}

}

private string _name = string.Empty;

}

public class Work

{

public Work()

{

}

public EmployeeCollection Employees

{

get

{

return _employees;

}

}

public string Name

{

get

{

return _name;

}

set

{

_name = value;

}

}

public class EmployeeCollection: ICollection<Employee>

{

#region ICollection<Employee> Members

public void Add( Employee item )

{

_employees.Add( item );

}

public void Clear()

{

_employees.Clear();

}

public bool Contains( Employee item )

{

return _employees.Contains( item );

}

public void CopyTo( Employee[] array, int arrayIndex )

{

_employees.CopyTo( array, arrayIndex );

}

public int Count

{

get { return _employees.Count; }

}

public bool IsReadOnly

{

get { return false; }

}

public bool Remove( Employee item )

{

return _employees.Remove( item );

}

#endregion

#region IEnumerable<Employee> Members

IEnumerator<Employee> IEnumerable<Employee>.GetEnumerator()

{

return _employees.GetEnumerator();

}

#endregion

private List<Employee> _employees = new List<Employee>();

}

private EmployeeCollection _employees = new EmployeeCollection();

private string _name = string.Empty;

}

class Program

{

private static string DumpException( Exception ex )

{

string info = string.Empty;

do

{

info += WriteExceptionInfo( ex );

ex = ex.InnerException;

} while( ex != null );

return info;

}

private static string WriteExceptionInfo( Exception ex )

{

string info = string.Empty;

info += string.Format( "--------- Exception Data ---------" ) +
Environment.NewLine;

info += string.Format( "Exception Type: {0}", ex.GetType().FullName ) +
Environment.NewLine;

info += string.Format( "Message: {0}", ex.Message );

return info;

}

static void Main( string[] args )

{

try

{

Work work = new Work();

work.Name = "SomePlace";

work.Employees.Add( new Employee( "Lee" ) );

work.Employees.Add( new Employee( "Stuart" ) );

XmlSerializer s = new XmlSerializer( typeof( Work ) );

s.Serialize( Console.Out, work );

}

catch( Exception e )

{

Console.WriteLine( DumpException( e ) );

}

Console.Read();

}

}

}
Nov 16 '05 #1
5 1425
Please post this to a Whidbey NG, the NG is for the release version of
CSharp.
Note that the 40607 is an old version of v2.0 beta1, the XML serialization
has changed a bit since then, I suggest you don't waste your time with this
version download the november or december CTP instead or wait for beta2.

Willy.

"Lee Alexander" <lpa@_removethis_pobox.com> wrote in message
news:Og**************@TK2MSFTNGP09.phx.gbl...
hi,

Perhaps someone can help me. I am trying to serialize an object but the
serialization isn't working. I have created a small console app to show my
problem. Perhaps someone with more knowledge could nudge me in the correct
direction.

Regards
Lee

#region Using directives

using System;

using System.Collections.Generic;

using System.Xml.Serialization;

#endregion

namespace TestSerialization

{

public class Employee

{

public Employee()

{

}

public Employee( string name )

{

this.Name = name;

}

public string Name

{

get

{

return _name;

}

set

{

_name = value;

}

}

private string _name = string.Empty;

}

public class Work

{

public Work()

{

}

public EmployeeCollection Employees

{

get

{

return _employees;

}

}

public string Name

{

get

{

return _name;

}

set

{

_name = value;

}

}

public class EmployeeCollection: ICollection<Employee>

{

#region ICollection<Employee> Members

public void Add( Employee item )

{

_employees.Add( item );

}

public void Clear()

{

_employees.Clear();

}

public bool Contains( Employee item )

{

return _employees.Contains( item );

}

public void CopyTo( Employee[] array, int arrayIndex )

{

_employees.CopyTo( array, arrayIndex );

}

public int Count

{

get { return _employees.Count; }

}

public bool IsReadOnly

{

get { return false; }

}

public bool Remove( Employee item )

{

return _employees.Remove( item );

}

#endregion

#region IEnumerable<Employee> Members

IEnumerator<Employee> IEnumerable<Employee>.GetEnumerator()

{

return _employees.GetEnumerator();

}

#endregion

private List<Employee> _employees = new List<Employee>();

}

private EmployeeCollection _employees = new EmployeeCollection();

private string _name = string.Empty;

}

class Program

{

private static string DumpException( Exception ex )

{

string info = string.Empty;

do

{

info += WriteExceptionInfo( ex );

ex = ex.InnerException;

} while( ex != null );

return info;

}

private static string WriteExceptionInfo( Exception ex )

{

string info = string.Empty;

info += string.Format( "--------- Exception Data ---------" ) +
Environment.NewLine;

info += string.Format( "Exception Type: {0}", ex.GetType().FullName ) +
Environment.NewLine;

info += string.Format( "Message: {0}", ex.Message );

return info;

}

static void Main( string[] args )

{

try

{

Work work = new Work();

work.Name = "SomePlace";

work.Employees.Add( new Employee( "Lee" ) );

work.Employees.Add( new Employee( "Stuart" ) );

XmlSerializer s = new XmlSerializer( typeof( Work ) );

s.Serialize( Console.Out, work );

}

catch( Exception e )

{

Console.WriteLine( DumpException( e ) );

}

Console.Read();

}

}

}

Nov 16 '05 #2
Willy,

Thanks for the heads up. I'll post where you said and also look into
downloading the latest bits.

Cheers
Lee
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:uX**************@TK2MSFTNGP10.phx.gbl...
Please post this to a Whidbey NG, the NG is for the release version of
CSharp.
Note that the 40607 is an old version of v2.0 beta1, the XML serialization
has changed a bit since then, I suggest you don't waste your time with
this version download the november or december CTP instead or wait for
beta2.

Willy.

"Lee Alexander" <lpa@_removethis_pobox.com> wrote in message
news:Og**************@TK2MSFTNGP09.phx.gbl...
hi,

Perhaps someone can help me. I am trying to serialize an object but the
serialization isn't working. I have created a small console app to show
my problem. Perhaps someone with more knowledge could nudge me in the
correct direction.

Regards
Lee

#region Using directives

using System;

using System.Collections.Generic;

using System.Xml.Serialization;

#endregion

namespace TestSerialization

{

public class Employee

{

public Employee()

{

}

public Employee( string name )

{

this.Name = name;

}

public string Name

{

get

{

return _name;

}

set

{

_name = value;

}

}

private string _name = string.Empty;

}

public class Work

{

public Work()

{

}

public EmployeeCollection Employees

{

get

{

return _employees;

}

}

public string Name

{

get

{

return _name;

}

set

{

_name = value;

}

}

public class EmployeeCollection: ICollection<Employee>

{

#region ICollection<Employee> Members

public void Add( Employee item )

{

_employees.Add( item );

}

public void Clear()

{

_employees.Clear();

}

public bool Contains( Employee item )

{

return _employees.Contains( item );

}

public void CopyTo( Employee[] array, int arrayIndex )

{

_employees.CopyTo( array, arrayIndex );

}

public int Count

{

get { return _employees.Count; }

}

public bool IsReadOnly

{

get { return false; }

}

public bool Remove( Employee item )

{

return _employees.Remove( item );

}

#endregion

#region IEnumerable<Employee> Members

IEnumerator<Employee> IEnumerable<Employee>.GetEnumerator()

{

return _employees.GetEnumerator();

}

#endregion

private List<Employee> _employees = new List<Employee>();

}

private EmployeeCollection _employees = new EmployeeCollection();

private string _name = string.Empty;

}

class Program

{

private static string DumpException( Exception ex )

{

string info = string.Empty;

do

{

info += WriteExceptionInfo( ex );

ex = ex.InnerException;

} while( ex != null );

return info;

}

private static string WriteExceptionInfo( Exception ex )

{

string info = string.Empty;

info += string.Format( "--------- Exception Data ---------" ) +
Environment.NewLine;

info += string.Format( "Exception Type: {0}", ex.GetType().FullName ) +
Environment.NewLine;

info += string.Format( "Message: {0}", ex.Message );

return info;

}

static void Main( string[] args )

{

try

{

Work work = new Work();

work.Name = "SomePlace";

work.Employees.Add( new Employee( "Lee" ) );

work.Employees.Add( new Employee( "Stuart" ) );

XmlSerializer s = new XmlSerializer( typeof( Work ) );

s.Serialize( Console.Out, work );

}

catch( Exception e )

{

Console.WriteLine( DumpException( e ) );

}

Console.Read();

}

}

}


Nov 16 '05 #3
hmm I can't seem to find the Whidbey group, is it on a different server?

Regards
Lee

"Lee Alexander" <lpa@_removethis_pobox.com> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
Willy,

Thanks for the heads up. I'll post where you said and also look into
downloading the latest bits.

Cheers
Lee
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:uX**************@TK2MSFTNGP10.phx.gbl...
Please post this to a Whidbey NG, the NG is for the release version of
CSharp.
Note that the 40607 is an old version of v2.0 beta1, the XML
serialization has changed a bit since then, I suggest you don't waste
your time with this version download the november or december CTP instead
or wait for beta2.

Willy.

"Lee Alexander" <lpa@_removethis_pobox.com> wrote in message
news:Og**************@TK2MSFTNGP09.phx.gbl...
hi,

Perhaps someone can help me. I am trying to serialize an object but the
serialization isn't working. I have created a small console app to show
my problem. Perhaps someone with more knowledge could nudge me in the
correct direction.

Regards
Lee

#region Using directives

using System;

using System.Collections.Generic;

using System.Xml.Serialization;

#endregion

namespace TestSerialization

{

public class Employee

{

public Employee()

{

}

public Employee( string name )

{

this.Name = name;

}

public string Name

{

get

{

return _name;

}

set

{

_name = value;

}

}

private string _name = string.Empty;

}

public class Work

{

public Work()

{

}

public EmployeeCollection Employees

{

get

{

return _employees;

}

}

public string Name

{

get

{

return _name;

}

set

{

_name = value;

}

}

public class EmployeeCollection: ICollection<Employee>

{

#region ICollection<Employee> Members

public void Add( Employee item )

{

_employees.Add( item );

}

public void Clear()

{

_employees.Clear();

}

public bool Contains( Employee item )

{

return _employees.Contains( item );

}

public void CopyTo( Employee[] array, int arrayIndex )

{

_employees.CopyTo( array, arrayIndex );

}

public int Count

{

get { return _employees.Count; }

}

public bool IsReadOnly

{

get { return false; }

}

public bool Remove( Employee item )

{

return _employees.Remove( item );

}

#endregion

#region IEnumerable<Employee> Members

IEnumerator<Employee> IEnumerable<Employee>.GetEnumerator()

{

return _employees.GetEnumerator();

}

#endregion

private List<Employee> _employees = new List<Employee>();

}

private EmployeeCollection _employees = new EmployeeCollection();

private string _name = string.Empty;

}

class Program

{

private static string DumpException( Exception ex )

{

string info = string.Empty;

do

{

info += WriteExceptionInfo( ex );

ex = ex.InnerException;

} while( ex != null );

return info;

}

private static string WriteExceptionInfo( Exception ex )

{

string info = string.Empty;

info += string.Format( "--------- Exception Data ---------" ) +
Environment.NewLine;

info += string.Format( "Exception Type: {0}", ex.GetType().FullName ) +
Environment.NewLine;

info += string.Format( "Message: {0}", ex.Message );

return info;

}

static void Main( string[] args )

{

try

{

Work work = new Work();

work.Name = "SomePlace";

work.Employees.Add( new Employee( "Lee" ) );

work.Employees.Add( new Employee( "Stuart" ) );

XmlSerializer s = new XmlSerializer( typeof( Work ) );

s.Serialize( Console.Out, work );

}

catch( Exception e )

{

Console.WriteLine( DumpException( e ) );

}

Console.Read();

}

}

}



Nov 16 '05 #4

"Lee Alexander" <lpa@_removethis_pobox.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
hmm I can't seem to find the Whidbey group, is it on a different server?


Lee,

Check this for both NNTP and web based NG access info:
http://communities.microsoft.com/new...y&amp;slcid=us

Willy.
Nov 16 '05 #5
Willy,

Thanks for info.

Regards
Lee
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:eZ**************@TK2MSFTNGP15.phx.gbl...

"Lee Alexander" <lpa@_removethis_pobox.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
hmm I can't seem to find the Whidbey group, is it on a different server?


Lee,

Check this for both NNTP and web based NG access info:
http://communities.microsoft.com/new...y&amp;slcid=us

Willy.

Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Harold Paine | last post by:
I just wrote an app with VS2005 December CTP which apparently installs Framework 2.0.41115. I tried to run the app on a workstation with the .NET Framework 2.0 RTM beta 1, which apparently...
0
by: Quimbly | last post by:
I recently installed the Visual Studio 2005 CTP Beta on my machine. That went fine, but when I uninstalled it (as my team later told me we were going to be working with VS2005 Beta 1), it didn't...
1
by: WahJava | last post by:
Hi developers, I've compiled the EnterpriseServices sample comes in .NET Framework SDK Documentation. BankAccount Sample compiles and executes fine with .NET Framework SDK v1.1.4322 on Windows...
1
by: Brad | last post by:
Problem: Get an unhandled exception on the target machine (see stack trace below) on this method related to panels System.MissingMethodException: Method not found: 'Void...
2
by: Richard West | last post by:
I have installed the beta of Dot Net Framework 2.0 on my server, running IIS 5 and Win 2K Server. I have configured my test virutal directory to use ASP.NET version 2.0.40607.0 (under the...
0
by: A programmer desperatly needing help! | last post by:
I use the xmlserialization on asp.net pages and on previous machines it never gave a problem. But now i somethings get a: Timed out waiting for a program to execute. The command being executed was...
2
by: Tod Birdsall | last post by:
Hi All, I am trying to secure non-ASP.NET files (i.e. .html, .pdf) in an application running on IIS 6.0, Win2K3 using the .NET Framework 2.0. What has worked in the past using .NET Framework...
6
by: Mark Oliver | last post by:
Hi, After I installed 2.0 Beta 1 my ASP.NET 1.1 project started trying to use the 2.0 Framework. When I try to run I get a "" referencing...
1
by: Frank | last post by:
Hi, Let's say I have a file named myFile.xml Within that file I have blocks of data which I'd like to add at different times during the day. e.g. <LogEntry>
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.