User Profile

Collapse

Profile Sidebar

Collapse
SimonDotException
SimonDotException
Last Activity: Jul 6 '11, 07:01 PM
Joined: Jul 18 '09
Location: UK
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Use XmlDiffPatch

    Having revisited this with a fresh pair of eyes, I've found a solution. It needs Microsoft's XmlDiffPatch to be installed from http://msdn.microsoft.com/en-us/library/aa302294.aspx, you can then add a reference to XmlDiffPatch to your project and a using Microsoft.XmlDi ffPatch to the top of your .cs file. Code along the lines of the following can then be used to compare two XML fragments.

    Code:
    		public
    ...
    See more | Go to post

    Leave a comment:


  • Order-insensitive comparison of serialized XML / order of property serialization

    I've got some C# classes which include methods for (de)serializing to/from XML and I'm trying to write unit tests for them, however I'm finding that the order in which the properties are serialized sometimes changes when I rebuild the project, so I can't just serialize an instance of my class and compare the resulting XML with a static XML file as I'd like.

    Is there any easy way of comparing the content of XML files in a way which...
    See more | Go to post

  • CA1000: Why shouldn't I declare static members on generic types?

    I've written an abstract base type which uses generics to provide XML serialization and deserialization methods for use by its derived types, but I'm seemingly unable to write it in a way which completely satisfies FxCop code analysis. Here is the simplest form of the base class which reproduces the problem:

    Code:
    public abstract class XmlSerializableItem<T>
    {
    	public string ToXml()
    	{
    		XmlSerializer
    ...
    See more | Go to post

  • Thank you!

    I changed the lines within the ConsolidatedSta te property

    Code:
    // Is this property a generic collection of MyDerived1?
    IEnumerable<MyDerived1> componentCollection 
        = property.GetValue( this, null )
        as IEnumerable<MyDerived1>;
    if( componentCollection != null )
    {
        // Yes, so inspect their ConsolidatedState properties.
        foreach( MyBase
    ...
    See more | Go to post

    Leave a comment:


  • Reflecting generic collections of derived types

    I am trying to use reflection in a property of a base type to inspect the properties of an instance of a type which is derived from that base type, when the properties can themselves be instances of types derived from that base type, or arrays or generic collections of instances of types derived from that base type.

    All is well until I come to the properties which are generic collections, I don't seem to be able to find an elegant...
    See more | Go to post
No activity results to display
Show More
Working...