BadScript 2
Loading...
Searching...
No Matches
BadReflectedEnumeratorMethod.cs
Go to the documentation of this file.
1using System.Collections;
2using System.Reflection;
3
7
12
17{
22 public BadReflectedEnumeratorMethod(MethodInfo method) : base(method) { }
23
29 private IEnumerable<BadObject> GetEnumerable(object instance)
30 {
31 IEnumerable o = (IEnumerable)instance;
32
33 foreach (object obj in o)
34 {
35 yield return Wrap(obj);
36 }
37 }
38
40 public override BadObject Get(object? instance)
41 {
42 return new BadInteropFunction(
43 "GetEnumerator",
44 _ => new BadInteropEnumerator(GetEnumerable(instance!).GetEnumerator()),
45 false,
47 );
48 }
49}
Implements a simple wrapper for C# IEnumerators to be used in BS2.
Interop Function taking an array of arguments.
IEnumerable< BadObject > GetEnumerable(object instance)
Enumerates an object.
BadReflectedEnumeratorMethod(MethodInfo method)
Creates a new BadReflectedEnumeratorMethod.
static BadObject Wrap(object? o)
Wraps an Object into a BadObject.
The Base Class for all BadScript Objects.
Definition BadObject.cs:14
The Any Prototype, Base type for all types.
static readonly BadAnyPrototype Instance
The Instance of the BadAnyPrototype.
Contains the Interop Function Classes for the BadScript2 Language.
Contains the Member Classes for Reflection Objects.
Contains the Runtime Objects.
Definition BadArray.cs:10