Search This Blog

Wednesday, June 24, 2015

C# Regex to match the words with dot

C#Text > Regular Expressions > Split with dot


 string[] substrings = Regex.Split("test.regex.dot", @"\.");




Thursday, June 18, 2015

Remove border Telerik RadGridView

Telerik > RadGridView > Remove border

radGridView1.GridViewElement.DrawBorder = false;
radGridView1.GridViewElement.GroupPanelElement.DrawBorder = false;






Monday, June 15, 2015

KeyNotFoundException Collection C# Example

Collections > Generic > KeyNotFoundException 

This is thrown when try to retrieve an element from a collection using a key that does not exist in that collection.

Example

   Dictionary<string, string> dict = new Dictionary<string, string>();
   dict.Add("key1","value1");
   try
   {
       string val = dict["key2"];
   }
   catch (KeyNotFoundException)
   {
       throw new KeyNotFoundException("KeyNotFoundException!");

   }