Last active
December 28, 2015 18:40
-
-
Save vcsjones/fb6f8fd892fcc0076bde to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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