Monthly Archives: March 2015

Repeat a character x times with c#

Hey everyone,

Just a neat little trick I came across on Stackoverflow, repeating a character x times without using a loop:

string result = new String(‘x’, 5); //xxxxx
string result = new String(‘a’, 3); //aaa

Check out the original post for more info: http://stackoverflow.com/a/3754700/522859

oldIndex must be a valid index in the Children collection (Visual Studio)

Hey everyone,

Just posting this in case anyone else runs into it. After unshelving, the following error kept popping up when I tried to open files using the solution explorer:

oldIndex must be a valid index in the Children collection
Parameter name: oldIndex
Actual value was -1.

I’m still not sure what caused it, but restarting visual studio seems to have fixed it.