How do I convert a string into a variable reference?
<p>I have to add a lot of shared folders from a configuration file. the names are very long, but all ends in "Name", "Domain", "Username" and "Password".</p>

<p>An example is:</p>

<pre><code>AddSharedFolder(
  myConfigurationHandler.MyConfiguration.MyService.RSController.repositoryName,
  myConfigurationHandler.MyConfiguration.MyService.RSController.repositoryDomain,
  myConfigurationHandler.MyConfiguration.MyService.RSController.repositoryUsername,
  myConfigurationHandler.MyConfiguration.MyService.RSController.repositoryPassword);
</code></pre>

<p>My idea was to call it like</p>

<pre><code>AddSharedFolder(
  "myConfigurationHandler.MyConfiguration.MyService.RSController.repository");
</code></pre>

<p>Then have an overloaded AddSharedFolders method:</p>

<pre><code>private static void AddSharedFolder(string prefix)
{
   AddSharedFolder(prefix + "Name", prefix + "Domain", prefix + "Username", prefix + "Password");
}
</code></pre>

<p>Obviously the last method is wrong. But how do I convert the string into a variable name? Or is this a really dumb programming practice?</p>
