internal void RemapToGenerator(int version) {
Debug.Assert(_generator == null || _funcInfo.Version != version);
// Try to find the target FunctionInfo for the specified version
FunctionInfo targetFuncInfo = GetFunctionInfo(version);
if (targetFuncInfo == null) {
throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ErrorStrings.InvalidFunctionVersion, version));
}
// Create the new generator
CreateGenerator(targetFuncInfo);
// Run to the first yield point
((IEnumerator)_generator).MoveNext();
}