Created
September 11, 2012 05:51
-
-
Save royosherove/3696270 to your computer and use it in GitHub Desktop.
class for testing inheritance
This file contains 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.IO; | |
namespace Demos.Inheritance | |
{ | |
interface ICustomLogger | |
{ | |
void Write(LogMessage msg); | |
void SetTarget(string locationOfFileOrService); | |
void Enable(); | |
void Disable(); | |
} | |
class CsvLogger : ICustomLogger | |
{ | |
private string target; | |
public void Write(LogMessage msg) | |
{ | |
var stream = File.AppendText(target); | |
using (stream) | |
{ | |
stream.WriteLine(string.Format("{0}\t{1}", msg.Text, msg.Severity)); | |
} | |
} | |
public void SetTarget(string locationOfFileOrService) | |
{ | |
target = | |
locationOfFileOrService; | |
} | |
public void Enable() | |
{ | |
} | |
public void Disable() | |
{ | |
} | |
} | |
internal class LogMessage | |
{ | |
public string Text { get; set; } | |
public string Severity { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment