1010// The MIT License (MIT)
1111// Copyright (c) 2016 Grupo ACBr.Net
1212//
13- // Permission is hereby granted, free of charge, to any person obtaining
14- // a copy of this software and associated documentation files (the "Software"),
15- // to deal in the Software without restriction, including without limitation
16- // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17- // and/or sell copies of the Software, and to permit persons to whom the
13+ // Permission is hereby granted, free of charge, to any person obtaining
14+ // a copy of this software and associated documentation files (the "Software"),
15+ // to deal in the Software without restriction, including without limitation
16+ // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17+ // and/or sell copies of the Software, and to permit persons to whom the
1818// Software is furnished to do so, subject to the following conditions:
19- // The above copyright notice and this permission notice shall be
19+ // The above copyright notice and this permission notice shall be
2020// included in all copies or substantial portions of the Software.
21- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22- // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24- // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26- // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22+ // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24+ // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26+ // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2727// DEALINGS IN THE SOFTWARE.
2828// </copyright>
2929// <summary></summary>
3030// ***********************************************************************
3131
3232using System ;
3333using System . Collections . Generic ;
34- using System . Linq ;
35- using ACBr . Net . Core . Generics ;
3634
3735namespace ACBr . Net . DFe . Core . Collection
3836{
39- /// <summary>
40- /// Classe GenericNFeCollection.
41- /// </summary>
42- /// <typeparam name="T"></typeparam>
43- public class DFeCollection < T > : GenericCollection < T > where T : class
44- {
37+ /// <summary>
38+ /// Classe GenericNFeCollection.
39+ /// </summary>
40+ /// <typeparam name="T"></typeparam>
41+ public class DFeCollection < T > : List < T > where T : class
42+ {
4543 #region Constructors
4644
4745 /// <summary>
@@ -56,9 +54,9 @@ public DFeCollection()
5654 /// </summary>
5755 /// <param name="source">The source.</param>
5856 public DFeCollection ( IEnumerable < T > source )
59- {
60- List = source . ToList ( ) ;
61- }
57+ {
58+ AddRange ( source ) ;
59+ }
6260
6361 #endregion Constructors
6462
@@ -69,52 +67,42 @@ public DFeCollection(IEnumerable<T> source)
6967 /// </summary>
7068 /// <returns>T.</returns>
7169 public virtual T AddNew ( )
72- {
73- var item = ( T ) Activator . CreateInstance ( typeof ( T ) , true ) ;
74- List . Add ( item ) ;
75- return item ;
76- }
70+ {
71+ var item = ( T ) Activator . CreateInstance ( typeof ( T ) , true ) ;
72+ base . Add ( item ) ;
73+ return item ;
74+ }
7775
7876 /// <summary>
7977 /// Adds the range.
8078 /// </summary>
8179 /// <param name="item">The item.</param>
82- public virtual void Add ( T item )
80+ public new virtual void Add ( T item )
8381 {
84- List . Add ( item ) ;
82+ base . Add ( item ) ;
8583 }
8684
8785 /// <summary>
8886 /// Adds the range.
8987 /// </summary>
9088 /// <param name="itens">The itens.</param>
91- public virtual void AddRange ( IEnumerable < T > itens )
92- {
93- List . AddRange ( itens ) ;
94- }
89+ public new virtual void AddRange ( IEnumerable < T > itens )
90+ {
91+ base . AddRange ( itens ) ;
92+ }
9593
9694 #endregion Methods
9795
9896 #region Operators
9997
100- /// <summary>
101- /// Performs an implicit conversion from <see cref="List{T}"/> to <see cref="DFeCollection{T}"/>.
102- /// </summary>
103- /// <param name="source">The source.</param>
104- /// <returns>The result of the conversion.</returns>
105- public static implicit operator DFeCollection < T > ( List < T > source )
106- {
107- return new DFeCollection < T > ( source ) ;
108- }
109-
11098 /// <summary>
11199 /// Performs an implicit conversion from <see cref="DFeCollection{T}"/> to <see cref="List{T}"/>.
112100 /// </summary>
113101 /// <param name="source">The source.</param>
114102 /// <returns>The result of the conversion.</returns>
115- public static implicit operator List < T > ( DFeCollection < T > source )
103+ public static implicit operator DFeCollection < T > ( T [ ] source )
116104 {
117- return source . List ;
105+ return new DFeCollection < T > ( source ) ;
118106 }
119107
120108 #endregion Operators
0 commit comments