1+ // ***********************************************************************
2+ // Assembly : RzR.Shared.Extensions.DomainCommonExtensions
3+ // Author : RzR
4+ // Created On : 2026-01-28 22:01
5+ //
6+ // Last Modified By : RzR
7+ // Last Modified On : 2026-02-11 20:07
8+ // ***********************************************************************
9+ // <copyright file="ObservableEnumeratorExtensions.cs" company="RzR SOFT & TECH">
10+ // Copyright © RzR. All rights reserved.
11+ // </copyright>
12+ //
13+ // <summary>
14+ // </summary>
15+ // ***********************************************************************
16+
17+ #region U S A G E S
18+
19+ using System ;
20+ using System . Collections . Generic ;
21+ using DomainCommonExtensions . Collections ;
22+ using DomainCommonExtensions . Utilities . Ensure ;
23+
24+ #endregion
25+
26+ namespace DomainCommonExtensions . ArraysExtensions
27+ {
28+ /// -------------------------------------------------------------------------------------------------
29+ /// <summary>
30+ /// An observable enumerator extensions.
31+ /// </summary>
32+ /// =================================================================================================
33+ public static class ObservableEnumeratorExtensions
34+ {
35+ /// -------------------------------------------------------------------------------------------------
36+ /// <summary>
37+ /// An IEnumerable<T> extension method that convert to observable.
38+ /// </summary>
39+ /// <exception cref="ArgumentNullException">
40+ /// Thrown when one or more required arguments are null.
41+ /// </exception>
42+ /// <typeparam name="T">Generic type parameter.</typeparam>
43+ /// <param name="source">The source to act on.</param>
44+ /// <returns>
45+ /// An ObservableEnumerator<T>
46+ /// </returns>
47+ /// =================================================================================================
48+ public static ObservableEnumerator < T > WithObservable < T > (
49+ this IEnumerable < T > source )
50+ {
51+ DomainEnsure . IsNotNull ( source , nameof ( source ) ) ;
52+
53+ return new ObservableEnumerator < T > ( source ) ;
54+ }
55+
56+ /// -------------------------------------------------------------------------------------------------
57+ /// <summary>
58+ /// An IEnumerable<T> extension method that convert to observable.
59+ /// </summary>
60+ /// <exception cref="ArgumentNullException">
61+ /// Thrown when one or more required arguments are null.
62+ /// </exception>
63+ /// <typeparam name="T">Generic type parameter.</typeparam>
64+ /// <param name="enumerator">The enumerator to act on.</param>
65+ /// <returns>
66+ /// An ObservableEnumerator<T>
67+ /// </returns>
68+ /// =================================================================================================
69+ public static ObservableEnumerator < T > WithObservable < T > (
70+ this IEnumerator < T > enumerator )
71+ {
72+ DomainEnsure . IsNotNull ( enumerator , nameof ( enumerator ) ) ;
73+
74+ return new ObservableEnumerator < T > ( enumerator ) ;
75+ }
76+ }
77+ }
0 commit comments