.Net Queries

Hi All,
 I will be listing small problems with solutions in this post. This way it's easy for me and ajy of you reading this to get a solution quickly

1. How to split a string by another string:

Solution 1:
var result=  "StringToBeSplit".Split(new string[] { "To" }, StringSplitOptions.None);

Solution 2:
We can write a extension method:
public static string[] Split(this string toSplit, string splitOn)
{
            return toSplit.Split(new string[] { splitOn }, StringSplitOptions.None);
}

Comments

Popular posts from this blog

.Net Framework