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
public static int ToUnixTime(this DateTime dateTime) | |
{ | |
return (int)(dateTime - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds; | |
} | |
public static DateTime ToDateTime(this Int32 unixTime) | |
{ | |
return new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(unixTime); | |
} |
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; | |
using System.Collections.ObjctModel; | |
using System.Reflection; | |
public static class TypeExtension | |
{ | |
public static ReadOnlyCollection<MemberInfo> GetAllMembers(this Type type, int capacity = 50) | |
{ | |
var temp = new List<MemberInfo>(capacity); | |
for(var t = type; t != null; t = t.BaseType) |