views:

458

answers:

2

Is there a public implementation of the Rope data structure in C#?

+10  A: 

I'm not aware of a Rope implementation (though there probably is one!), but if you're only after doing concatenation, StringBuilder will do the job.

Richard
Very true here. I did an implementation in C# a while ago where I used a 'linked list' of char arrays and no matter what, it could not beat the StringBuilder class. The problem comes when you are trying to tie those together for concatenation, you do not have access to a couple of native methods that the StringBuilder class has access to for allocating a buffer and copying the characters in.
esac
+10  A: 

For what its worth, here is an immutable Java implementation. You could probably convert it to C# in less than an hour.

Juliet
Cool, thank you!
luvieere
Heh, this is a reference in the wikipedia article the poster linked to! :)
Vinko Vrsalovic
@Vinko: I love irony. Wait... *is* that irony? I never know anymore.
Randolpho