Monday, June 20, 2011

StringBuilder clear method


String builder does not have a clear method to clear the contents of stringBuilder, but if we want to add a clear method in StringBuilder, use the following method in your utility class.

 

    public static void Clear(this StringBuilder stringBuilder)

    {

      stringBuilder.Length = 0;

      stringBuilder.Capacity = 16;

    }

 

Benefit of this method is if we use same stringbuilder variable with clear the existing contents.

Like

 

StringBuilder sb =new StringBuilder();

Sb.append("abc xyz");

 

// If you want to clear the content of sb then

sb.Clear();

 

This should be provided by Microsoft by default because if we re-init the string builder variable every time when we want to clear the content it will take lots of memory.

Thursday, June 16, 2011

Noice Words in Sharepoint Search

Noise words in Share Point Search are words that have no search value in SharePoint. By default, there are few words (like a, and, is, in, it, of, the, to) in the English language that are ignored. 
You can find the noise words files for all of the languages at C:\Program Files\Microsoft Office Servers\12.0\Data\Config. 

This is a txt file (for English noiseeng.txt) and you can edit it to include the common 'curse' or ‘Bad’ words to prevent them from showing up when user type them into search.