<p>There is this example code, but then it starts talking about millisecond / nanosecond problems.</p>

<p>The same question is on MSDN, <em><a href="https://learn.microsoft.com/archive/blogs/brada/seconds-since-the-unix-epoch-in-c" rel="noreferrer">Seconds since the Unix epoch in C#</a></em>.</p>

<p>This is what I've got so far:</p>

<pre><code>public Double CreatedEpoch
{
  get
  {
    DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime();
    TimeSpan span = (this.Created.ToLocalTime() - epoch);
    return span.TotalSeconds;
  }
  set
  {
    DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime();
    this.Created = epoch.AddSeconds(value);
  }
}
</code></pre>

A Unix tick is 1 second (if I remember well), and a .NET tick is 100 nanoseconds.
If you've been encountering problems with nanoseconds, you might want to try using AddTick(10000000 * value).