public static void Rehydrate( XElement xml )
{
var lookup = new Dictionary<int, string>( ) ;
xml.CertainElement( @"TypeMap" ).Elements( @"Type" ).ForEach(
a => lookup[ (int) a.CertainAttribute( @"Index" ) ] = (string) a.CertainAttribute( @"Name" ) ) ;
xml.Descendants( ).Attributes( ).Where( a => a.Name.LocalName.StartsWith( @"ClrType" ) ).ForEach(
attribute =>
{
var index = (int) attribute ;
attribute.Value = lookup[ index ] ;
} ) ;
xml.Descendants( ).Where( a => a.Name.LocalName.StartsWith( @"ClrType" ) ).ForEach(
element =>
{
var index = (int) element ;
element.Value = lookup[ index ] ;
} ) ;
}