void CreateCurrent()
{
Property property = _enumerator.AddReadOnlyProperty("Current", TypeSystemServices.ObjectType);
property.Getter.Modifiers |= TypeMemberModifiers.Virtual;
property.Getter.Body.Add(
new ReturnStatement(
CodeBuilder.CreateReference(_current)));
// If item type is object, we're done
if (_resultItemType == TypeSystemServices.ObjectType) return;
// Since enumerator is generic, this object-typed property should be the
// explicit interface implementation for the non-generic IEnumerator interface
property.ExplicitInfo = new ExplicitMemberInfo();
property.ExplicitInfo.InterfaceType =
(SimpleTypeReference)CodeBuilder.CreateTypeReference(TypeSystemServices.IEnumeratorType);
// ...and now we create a typed property for the generic IEnumerator<> interface
Property typedProperty = _enumerator.AddReadOnlyProperty("Current", _resultItemType);
typedProperty.Getter.Modifiers |= TypeMemberModifiers.Virtual;
typedProperty.Getter.Body.Add(
new ReturnStatement(
CodeBuilder.CreateReference(_current)));
}