public Structure GetIndex(Structure index) { if (index is ScalarValue) { int i = Convert.ToInt32(index); // allow expressions like (1.0) to be indexes return(new StringValue(internalString[i])); } throw new KOSCastException(index.GetType(), typeof(ScalarValue)); }
public Structure GetIndex(Structure index) { if (index is ScalarValue) { int i = Convert.ToInt32(index); // allow expressions like (1.0) to be indexes return(GetIndex(i)); } // Throw cast exception with ScalarIntValue, instead of just any ScalarValue throw new KOSCastException(index.GetType(), typeof(ScalarIntValue)); }