I'm starting with BI, Analysis Services, Cubes and ADOMD.NET.

I searched a lot and was able to make some demos, but the performance is not good.

What I'm trying to do it's a Dimension tree view explorer.

Currently I have the following code:

CubeDef cube = conn.Cubes.Find( "SCA" );
            Dimension dim =  cube.Dimensions.Find( "CLIENTE" );
            Hierarchy hrc = dim.Hierarchies.Find( "LOCAL" );

            MemberCollection estados = hrc.Levels.Find( "EST" ).GetMembers();

            StringBuilder sb = new StringBuilder();

            // Loop first level
            foreach ( Member e in estados )
                sb.AppendFormat( @"<div class=""estado""><span class=""titulo"">{0}</span><div class=""cidades"">", e.Caption );

                MemberCollection cidades =  e.GetChildren();
                // Loop second level
                foreach ( Member c in cidades )
                    sb.AppendFormat( @"<div class=""cidade""><span class=""titulo"">{0}</span><div class=""bairros"">", c.Caption );

                    MemberCollection bairros = c.GetChildren();
                    // Loop third level
                    foreach ( Member b in bairros )
                      sb.AppendFormat( @"<div class=""bairro"">{0}</div>", b.Caption );
                    sb.Append( "</div></div>" );
                sb.Append( "</div></div>" );

How can i accomplish the same result with better practices?