InstructionOrEnumerable Class
Definition
Section titled “Definition”A wrapper which represents Instruction or its IEnumerable<T>.
You don’t need to directly interact with this type; implicit type conversions are provided which allow using e.g. ILWeaver’s Insert methods seamlessly while mixing up Instruction and its IEnumerable<T> in parameters marked as params IEnumerable<T> of InstructionOrEnumerable.
public sealed class InstructionOrEnumerable : IEnumerable<Instruction>, IEnumerableInheritance object
Implements IEnumerable<Instruction>, IEnumerable
Remarks
Section titled “Remarks”This is a hacky workaround for the fact that C# does not have discriminated unions (as of C# 14).
Constructors
Section titled “Constructors”InstructionOrEnumerable(IEnumerable<Instruction>)
Section titled “InstructionOrEnumerable(IEnumerable<Instruction>)”A wrapper which represents Instruction or its IEnumerable<T>.
You don’t need to directly interact with this type; implicit type conversions are provided which allow using e.g. ILWeaver’s Insert methods seamlessly while mixing up Instruction and its IEnumerable<T> in parameters marked as params IEnumerable<T> of InstructionOrEnumerable.
public InstructionOrEnumerable(IEnumerable<Instruction> instructions)Parameters
Section titled “Parameters”instructions IEnumerable<Instruction>
Value to wrap as InstructionOrEnumerable.
Remarks
Section titled “Remarks”This is a hacky workaround for the fact that C# does not have discriminated unions (as of C# 14).
InstructionOrEnumerable(Instruction)
Section titled “InstructionOrEnumerable(Instruction)”A wrapper which represents Instruction or its IEnumerable<T>.
You don’t need to directly interact with this type; implicit type conversions are provided which allow using e.g. ILWeaver’s Insert methods seamlessly while mixing up Instruction and its IEnumerable<T> in parameters marked as params IEnumerable<T> of InstructionOrEnumerable.
public InstructionOrEnumerable(Instruction instruction)Parameters
Section titled “Parameters”instruction Instruction
Value to wrap as InstructionOrEnumerable.
Remarks
Section titled “Remarks”This is a hacky workaround for the fact that C# does not have discriminated unions (as of C# 14).
Methods
Section titled “Methods”GetEnumerator()
Section titled “GetEnumerator()”Returns an enumerator that iterates through the collection.
public IEnumerator<Instruction> GetEnumerator()Returns
Section titled “Returns”IEnumerator<Instruction>
An enumerator that can be used to iterate through the collection.