Rhino.ScriptRuntime.ToStringIdOrIndex C# (CSharp) Method

ToStringIdOrIndex() static private method

If toString(id) is a decimal presentation of int32 value, then id is index.
If toString(id) is a decimal presentation of int32 value, then id is index. In this case return null and make the index available as ScriptRuntime.lastIndexResult(cx). Otherwise return toString(id).
static private ToStringIdOrIndex ( Context cx, object id ) : string
cx Context
id object
return string
		internal static string ToStringIdOrIndex(Context cx, object id)
		{
			if (id is Number)
			{
				double d = System.Convert.ToDouble(((Number)id));
				int index = (int)d;
				if (index == d)
				{
					StoreIndexResult(cx, index);
					return null;
				}
				return ToString(id);
			}
			else
			{
				string s;
				if (id is string)
				{
					s = (string)id;
				}
				else
				{
					s = ToString(id);
				}
				long indexTest = IndexFromString(s);
				if (indexTest >= 0)
				{
					StoreIndexResult(cx, (int)indexTest);
					return null;
				}
				return s;
			}
		}
ScriptRuntime