increasing names in C# with integers
<p>I need to get an object and check if it already exists. </p>

<p>In case it does, I want to add a number, or increase the number in its name.
For example if I have the object "a" and it exists, I need to add a 1 so it's called a1.
In case a1 exists, a2, etc.</p>

<p>How could I perform this?</p>

<p>My code:</p>

<pre><code>if (e.TreeNode.Tag is Variant)
{
    if (variantExists(e.TreeNode.Text))
    {
        Random r = new Random();
        int randomNumber = r.Next(0, 99);
        e.TreeNode.Text = e.TreeNode.Text + randomNumber;
        //e.TreeNode.Remove(); 
        return;
    }
}
</code></pre>
