public static common ( object objs, int n ) : |
||
objs | object | |
n | int | |
return |
public static Type common(object[] objs, int n)
{
if (objs.Length == 0) return Sys.ObjType.toNullable();
bool nullable = false;
Type best = null;
for (int i=0; i<n; ++i)
{
object obj = objs[i];
if (obj == null) { nullable = true; continue; }
Type t = @typeof(obj);
if (best == null) { best = t; continue; }
while (!t.@is(best))
{
best = best.@base();
if (best == null) return nullable ? Sys.ObjType.toNullable() : Sys.ObjType;
}
}
if (best == null) best = Sys.ObjType;
return nullable ? best.toNullable() : best;
}