Skip to content

Instantly share code, notes, and snippets.

@royosherove
Created September 11, 2012 05:51
Show Gist options
  • Save royosherove/3696270 to your computer and use it in GitHub Desktop.
Save royosherove/3696270 to your computer and use it in GitHub Desktop.
class for testing inheritance
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