Skip to content

Instantly share code, notes, and snippets.

@thedersen
Created August 4, 2010 15:30
Show Gist options
  • Save thedersen/508310 to your computer and use it in GitHub Desktop.
Save thedersen/508310 to your computer and use it in GitHub Desktop.
public class Prescription
{
public DateTime? CeasedAt { get; set; }
}
public class Prescription
{
public DateTime? CeasedAt { get; set; }
public string CeasedBecauseOf { get; set; }
}
public class Prescription
{
public DateTime? CeasedAt { get; private set; }
public void Cease()
{
if (CeasedAt != null)
throw new InvalidOperationException("Prescription is already ceased.");
CeasedAt = DateTime.Now;
}
}
public class Prescription
{
public DateTime? CeasedAt { get; private set; }
public string CeasedBecauseOf { get; private set; }
public void Cease(string reason)
{
if (CeasedAt != null)
throw new InvalidOperationException("Prescription is already ceased.");
if (string.IsNullOrEmpty(reason))
throw new ArgumentNullException("reason");
CeasedAt = DateTime.Now;
CeasedBecauseOf = reason;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment