internal BaseSessionObject GetV8EnumInstance(Enum enumValue)
{
Type enumType = enumValue.GetType();
object[] attrs = enumType.GetCustomAttributes(typeof (V8TypeCodeAttribute), true);
if (attrs == null || attrs.Length == 0)
{
throw new ArgumentException(string.Format("Тип {0} не имеет соответствующего типа V8", enumType.FullName));
}
V8TypeCodeAttribute v8TypeCodeAttr = (V8TypeCodeAttribute) attrs[0];
string internalStr = "{\"#\"," + v8TypeCodeAttr.Code + "," + Convert.ToInt32(enumValue) + "}";
object ptr = ValueFromStringInternal(internalStr);
return ptr != null ? new EnumObject(this, ptr) : null;
}