Skip to content

Instantly share code, notes, and snippets.

@vcsjones
Last active December 28, 2015 18:40
Show Gist options
  • Save vcsjones/fb6f8fd892fcc0076bde to your computer and use it in GitHub Desktop.
Save vcsjones/fb6f8fd892fcc0076bde to your computer and use it in GitHub Desktop.
using System;
using System.Diagnostics;
using System.IO;
namespace Baconator
{
class Program
{
static void Main(string[] args)
{
BaconConfigurator.Instance.DoSomethingWithBacon();
}
}
public class BaconConfigurator
{
public static BaconConfigurator Instance { get; } = new BaconConfigurator();
private static readonly string _path = Path.Combine(CONFIG.GetConfig("Root"), "bacon.xml");
private BaconConfigurator()
{
Debug.Assert(_path != null);
}
public void DoSomethingWithBacon()
{
var exists = File.Exists(_path);
Debug.WriteLine(exists);
}
}
public class CONFIG
{
public static string GetConfig(string path)
{
switch (path)
{
case "Root":
return @"C:\\bacon\\";
default:
throw new ArgumentException("Invalid path.", nameof(path));
}
}
}
}
using System;
using System.Diagnostics;
using System.IO;
namespace Baconator
{
class Program
{
static void Main(string[] args)
{
BaconConfigurator.Instance.DoSomethingWithBacon();
}
}
public class BaconConfigurator
{
private static readonly string _path = Path.Combine(CONFIG.GetConfig("Root"), "bacon.xml");
public static BaconConfigurator Instance { get; } = new BaconConfigurator();
private BaconConfigurator()
{
Debug.Assert(_path != null);
}
public void DoSomethingWithBacon()
{
var exists = File.Exists(_path);
Debug.WriteLine(exists);
}
}
public class CONFIG
{
public static string GetConfig(string path)
{
switch (path)
{
case "Root":
return @"C:\\bacon\\";
default:
throw new ArgumentException("Invalid path.", nameof(path));
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment