private object TryGetStaticField(Type type, string fieldName, out bool exist)
{
var field = type.GetField(fieldName);
if (field == null)
{
exist = false;
return null;
}
exist = true;
return MarshallToBike(field.IsLiteral
? field.GetValue(null) // can't use code-gen to access constant
: field.Get());
}