Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StringBuilder should be used in CsQuery.HtmlParser.ExtensionMethods #24

Closed
matt-psaltis opened this issue Jul 20, 2012 · 2 comments
Closed

Comments

@matt-psaltis
Copy link

There's other ways of achieving this but in keeping with the existing method format...
The existing result += text[i]; kills performance when parsing larger html blocks.

    public static string SubstringBetween(this char[] text, int startIndex, int endIndex)
    {
        var result = new StringBuilder();
        for (var i = startIndex; i < endIndex; i++)
        {
            result.Append(text[i]);
        }
        return result.ToString();
    }
@jamietre
Copy link
Owner

By the way feel free to make pull requests if you find more things in the future that can be improved. This is a big codebase, some of which is well over a year old and hasn't been touched since CsQuery was little more than a proof of concept. It's impossible for me to keep everything clean by myself and I welcome the outside interest and involvement.

jamietre added a commit that referenced this issue Jul 20, 2012
@jamietre
Copy link
Owner

Revised this to use StringBuilder native Append overload to add an char array substring directly

http://msdn.microsoft.com/en-us/library/ms149397.aspx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants