Sunday, 15 June 2014

c# - correct way to implementing ienumerable<t> without code duplication -


Currently, I applied it like down, but I do not like it because of code duplication in Getanemetr, I repeat How can I remove ...

  public class EodSettlementRequestStubData: IEnumerable & lt; SettlementRequest & gt; {Public Disposal Request Disclaimed Flow; Public Disposal Request Disclaimer; Public settlement; highest unverified flows; Public settlement request unverified retrieval; IEnumerator & LT; SettlementRequest & gt; IEnumerable & lt; SettlementRequest & gt; .GetEnumerator () {yield returns UnapprovedFlows; Yield returns unacceptable; Yield returns unverifiedFlows; Yield returns unverifiedRecovery; } Public IEnumerator GetEnumerator () {yield returns UnapprovedFlows; Yield returns unacceptable; Yield returns unverifiedFlows; Yield returns unverifiedRecovery; }}  

I do have the ability to use both individual, as well as an IEnumerable to some Linux content ...

I have a list could do to avoid code repetition, but I think it should be a better way to handle ...

Just a non-generic version is called a generic version (this is also more common" Spascerit interface version is generic generic IEnu merable instead of generic IEnumerable & lt; T & gt; )

  public class EodSettlementRequestStubData: IEnumerable & lt; SettlementRequest & gt; {public settlement request rejected flow; public settlement request is denied recovery, public Niptarauchctm Astyapitflo; public settlement request unverified recovery; public IEnumerator & lt; SettlementRequest & gt; GetEnumerator () {yield return UnapprovedFlows; yield returns unacceptable retrieve, produce returns Unv ErifiedFlows; yield returns unverifiedRecovery; } IEnumerator IEnumerable.GetEnumerator () {// This "IEnumerator & lt; SettlementRequest & gt; GetEnumerator ()" is calling GetEnumerator (); }}  

No comments:

Post a Comment