int unixTime = (int) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
If you are trying to convert some other DateTime value to POSIX time, make sure that it is first converted to UTC.
int unixTime = (int) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
MyEnum foo = (MyEnum) Enum.Parse(typeof(MyEnum), yourString);
MyEnum foo = (MyEnum) yourInt;