{"id":256948,"date":"2015-05-11T15:26:02","date_gmt":"2015-05-11T11:26:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=256948"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=256948","title":{"rendered":"IEnumerable \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432 C# \u0438 LSP"},"content":{"rendered":"<p>       \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/256605\/\">C#: \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438 LSP<\/a>. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IEnumerable \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u041f\u0440\u0438\u043d\u0446\u0438\u043f_\u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438_\u0411\u0430\u0440\u0431\u0430\u0440\u044b_\u041b\u0438\u0441\u043a\u043e\u0432\">\u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0411\u0430\u0440\u0431\u0430\u0440\u044b \u041b\u0438\u0441\u043a\u043e\u0432<\/a> (LSP), \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f, \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 \u043b\u0438 \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u043a\u043e\u0434, \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 IEnumerable.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>LSP \u0438 IEnumerable \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441<\/h2>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441, \u043d\u0430\u0440\u0443\u0448\u0430\u044e\u0442 \u043b\u0438 \u043a\u043b\u0430\u0441\u0441\u044b-\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0438 IEnumerable LSP \u043f\u0440\u0438\u043d\u0446\u0438\u043f, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u043a\u0430\u043a \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0440\u0443\u0448\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f.<\/p>\n<p>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0442\u044c, \u0447\u0442\u043e LSP \u043d\u0430\u0440\u0443\u0448\u0435\u043d \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u043e \u043e\u0434\u043d\u043e \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439:  <\/p>\n<ul>\n<li>\u041f\u043e\u0434\u043a\u043b\u0430\u0441\u0441 \u043a\u043b\u0430\u0441\u0441\u0430 (\u0438\u043b\u0438, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430) \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0438\u043d\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f<\/li>\n<li>\u041f\u043e\u0434\u043a\u043b\u0430\u0441\u0441 \u043e\u0441\u043b\u0430\u0431\u043b\u044f\u0435\u0442 \u043f\u043e\u0441\u0442\u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f<\/li>\n<li>\u041f\u043e\u0434\u043a\u043b\u0430\u0441\u0441 \u0443\u0441\u0438\u043b\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u0435\u0434\u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f<\/li>\n<\/ul>\n<p>  \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 IEnumerable \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0438 \u043f\u043e\u0441\u0442\u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043d\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u044f\u0432\u043d\u043e \u0438 \u0447\u0430\u0441\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e. \u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b \u0434\u043b\u044f IEnumerable \u0438 IEnumerator \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 <a href=\"https:\/\/github.com\/Microsoft\/CodeContracts\/blob\/180c3ae426fae1c31105fc672eeba57c91f76ed0\/Microsoft.Research\/Contracts\/MsCorlib\/System.Collections.IEnumerator.cs\">\u043d\u0435<\/a> <a href=\"https:\/\/github.com\/Microsoft\/CodeContracts\/blob\/180c3ae426fae1c31105fc672eeba57c91f76ed0\/Microsoft.Research\/Contracts\/MsCorlib\/System.Collections.IEnumerable.cs\">\u043e\u0441\u043e\u0431\u043e<\/a> \u043d\u0430\u043c \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442. \u0414\u0430\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 IEnumerable \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0430\u0442 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0443.<\/p>\n<h2>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 IEnumerable \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430<\/h2>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u043c\u0441\u044f \u0432 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u0441\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u0412\u043e\u0442 \u043a\u043e\u0434 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 IEnumerable&lt;T&gt;, IEnumerator&lt;T&gt; \u0438 IEnumerator. \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IEnumerable \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 IEnumerable&lt;T&gt;.<\/p>\n<pre><code>public interface IEnumerable&lt;out T&gt; : IEnumerable {     IEnumerator&lt;T&gt; GetEnumerator(); }   public interface IEnumerator&lt;out T&gt; : IDisposable, IEnumerator {     T Current { get; } }   public interface IEnumerator {     object Current { get; }     bool MoveNext();     void Reset(); } <\/code><\/pre>\n<p>  \u041e\u043d\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b BCL \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0442 \u0438\u0445 \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c\u043c \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 List&lt;T&gt;.<\/p>\n<pre><code>public class List&lt;T&gt; {     public struct Enumerator : IEnumerator&lt;T&gt;     {         private List&lt;T&gt; list;         private int index;         private T current;           public T Current         {             get { return this.current; }         }           object IEnumerator.Current         {             get             {                 if (this.index == 0 || this.index == this.list._size + 1)                     throw new InvalidOperationException();                 return (object)this.Current;             }         }     } } <\/code><\/pre>\n<p>  \u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e Current \u0441 \u0442\u0438\u043f\u043e\u043c T \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0432\u044b\u0437\u043e\u0432\u0430 MoveNext(), \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e Current \u0441 \u0442\u0438\u043f\u043e\u043c object \u0442\u0440\u0435\u0431\u0443\u0435\u0442:<\/p>\n<pre><code>public void Test() {     List&lt;int&gt;.Enumerator enumerator = new List&lt;int&gt;().GetEnumerator();     int current = enumerator.Current; \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0448\u0430\u0435\u0442 0     object current2 = ((IEnumerator)enumerator).Current; \/\/ \u0411\u0440\u043e\u0441\u0430\u0435\u0442 exception } <\/code><\/pre>\n<p>  \u041c\u0435\u0442\u043e\u0434 Reset() \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443. \u0412 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a List&lt;T&gt;.Enumerator.Reset() \u0434\u043e\u0431\u0440\u043e\u0441\u043e\u0432\u0435\u0441\u0442\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 Enumerator \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0441\u043f\u0438\u0441\u043a\u0430, \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u043d\u0435 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0442 \u0438\u0445 \u0432\u043e\u0432\u0441\u0435, \u0442\u0430\u043a \u0447\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442:<\/p>\n<pre><code>public void Test() {     Test2().Reset(); \/\/ \u0411\u0440\u043e\u0441\u0430\u0435\u0442 NotSupportedException }   private IEnumerator&lt;int&gt; Test2() {     yield return 1; } <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0432 \u0447\u0435\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0431\u044b\u0442\u044c \u0443\u0432\u0435\u0440\u0435\u043d\u044b \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 IEnumerable, \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u043c\u0435\u0442\u043e\u0434 IEnumerable&lt;T&gt;.GetEnumerator() \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u043e\u0439 (non-null) \u043e\u0431\u044a\u0435\u043a\u0442 \u044d\u043d\u0443\u043c\u0435\u0440\u0430\u0442\u043e\u0440\u0430. \u041a\u043b\u0430\u0441\u0441, \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 IEnumerable, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u043f\u0443\u0441\u0442\u044b\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c:<\/p>\n<pre><code>private IEnumerable&lt;int&gt; Test2() {     yield break; } <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u0438 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n<pre><code>private IEnumerable&lt;int&gt; Test2() {     Random random = new Random();     while (true)     {         yield return random.Next();     } } <\/code><\/pre>\n<p>  \u0418 \u044d\u0442\u043e \u043d\u0435 \u0432\u044b\u0434\u0443\u043c\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440. \u041a\u043b\u0430\u0441\u0441 <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/dd267312(v=vs.110).aspx\">BlockingCollection<\/a> \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442 IEnumerator \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043f\u043e\u0442\u043e\u043a \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u043c\u0435\u0442\u043e\u0434\u0435 MoveNext() \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e:<\/p>\n<pre><code>public void Test() {     BlockingCollection&lt;int&gt; collection = new BlockingCollection&lt;int&gt;();     IEnumerator&lt;int&gt; enumerator = collection.GetConsumingEnumerable().GetEnumerator();     bool moveNext = enumerator.MoveNext(); \/\/ The calling thread is blocked } <\/code><\/pre>\n<p>  \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, <b>\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IEnumerable \u043d\u0435 \u0434\u0430\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0439 \u043e \u043d\u0438\u0436\u0435\u043b\u0435\u0436\u0430\u0449\u0435\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043e\u043d \u0434\u0430\u0436\u0435 \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u044d\u0442\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e<\/b>. \u0412\u0441\u0435, \u0447\u0442\u043e \u043e\u043d \u043d\u0430\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u2014 \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0440\u043e\u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e.<\/p>\n<h2>IEnumerable \u0438 LSP<\/h2>\n<p>  \u0418\u0442\u0430\u043a, \u043d\u0430\u0440\u0443\u0448\u0430\u044e\u0442 \u043b\u0438 LSP \u043a\u043b\u0430\u0441\u0441\u044b, \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0435 IEnumerable? \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code>public void Process(IEnumerable&lt;Order&gt; orders) {     foreach (Order order in orders)     {         \/\/ Do something     } } <\/code><\/pre>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u043d\u0438\u0436\u0435\u043b\u0435\u0436\u0430\u0449\u0438\u0439 \u0442\u0438\u043f \u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 orders \u2014 List&lt;Orders&gt;, \u0432\u0441\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435: \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u043f\u0438\u0441\u043a\u0430 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u043e\u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b. \u041d\u043e \u0447\u0442\u043e \u0435\u0441\u043b\u0438 orders \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440, \u0441\u043e\u0437\u0434\u0430\u044e\u0449\u0438\u0439 \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 MoveNext()?<\/p>\n<pre><code>internal class OrderCollection : IEnumerable&lt;Order&gt; {     public IEnumerator&lt;Order&gt; GetEnumerator()     {         while (true)         {             yield return new Order();         }     } } <\/code><\/pre>\n<p>  \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u043c\u0435\u0442\u043e\u0434 Process \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0437\u0430\u0434\u0443\u043c\u0430\u043d\u043e. \u041d\u043e \u0431\u0443\u0434\u0435\u0442 \u043b\u0438 \u044d\u0442\u043e \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043a\u043b\u0430\u0441\u0441 OrderCollection \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 LSP? \u041d\u0435\u0442. OrderCollection \u0441\u043a\u0440\u0443\u043f\u0443\u043b\u0435\u0437\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0443 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 IEnumerable: \u043e\u043d \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0435\u0433\u043e \u043f\u0440\u043e\u0441\u044f\u0442 \u043e\u0431 \u044d\u0442\u043e\u043c.<\/p>\n<p>  \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e <b>\u043c\u0435\u0442\u043e\u0434 Process \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u0433\u043e IEnumerable, \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e, \u0447\u0435\u043c \u044d\u0442\u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u0431\u0435\u0449\u0430\u0435\u0442<\/b>. \u041d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0438, \u0447\u0442\u043e \u043d\u0438\u0436\u0435\u043b\u0435\u0436\u0430\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 orders \u2014 \u043a\u043e\u043d\u0435\u0447\u043d\u0430\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f. \u041a\u0430\u043a \u044f \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u0440\u0430\u043d\u0435\u0435, orders \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0430 BlockingCollection, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043f\u0440\u043e\u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0438\u043f \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043d\u0430 ICollection&lt;T&gt;. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 IEnumerable, ICollection \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e Count, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u043d\u0438\u0436\u0435\u043b\u0435\u0436\u0430\u0449\u0430\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u0430.<\/p>\n<h2>IEnumerable \u0438 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f<\/h2>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 ICollection \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438. ICollection \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0447\u0442\u043e \u0447\u0430\u0441\u0442\u043e \u043d\u0435\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043a\u0430\u043a \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f. \u0414\u043e \u0432\u0435\u0440\u0441\u0438\u0438 .Net 4.5, IEnumerable \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u0438.<\/p>\n<p>  \u0412 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u044d\u0442\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c, \u044d\u0442\u043e \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043f\u043e\u0434\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u0435\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.<\/p>\n<pre><code>public int GetTheTenthElement(IEnumerable&lt;int&gt; collection) {     return collection.Skip(9).Take(1).SingleOrDefault(); } <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u043c\u044b\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 LINQ \u0434\u043b\u044f \u043e\u0431\u0445\u043e\u0434\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 IEnumerable. \u041d\u0435 \u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442, \u043e\u043d \u0438\u043c\u0435\u0435\u0442 \u043e\u0434\u0438\u043d \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0445 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a: \u0432 \u043d\u0435\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 10 \u0440\u0430\u0437, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0442\u043e\u0442 \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443.<\/p>\n<p>  \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c IReadOnlyList:<\/p>\n<pre><code>public int GetTheTenthElement(IReadOnlyList&lt;int&gt; collection) {     if (collection.Count &lt; 10)         return 0;     return collection[9]; } <\/code><\/pre>\n<p>  \u041d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c IEnumerable \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432 \u043c\u0435\u0441\u0442\u0430\u0445, \u0433\u0434\u0435 \u0432\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u0447\u0438\u0441\u043b\u0438\u043c\u043e\u0439 (\u0430 \u0432\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0435 \u044d\u0442\u043e\u0433\u043e \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432). \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b IReadOnlyCollection&lt;T&gt; \u0438 IReadOnlyList&lt;T&gt;, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 .Net 4.5, \u0434\u0435\u043b\u0430\u044e\u0442 \u044d\u0442\u0443 \u0440\u0430\u0431\u043e\u0442\u0443 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435.<\/p>\n<h2>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 IEnumerable \u0438 LSP<\/h2>\n<p>  \u0427\u0442\u043e \u043d\u0430\u0441\u0447\u0435\u0442 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0439 IEnumerable, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0440\u0443\u0448\u0430\u044e\u0442 LSP? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0438\u0436\u0435\u043b\u0435\u0436\u0430\u0449\u0438\u043c \u0442\u0438\u043f\u043e\u043c IEnumerable&lt;T&gt; \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f DbQuery&lt;T&gt;. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code>private IEnumerable&lt;Order&gt; FindByName(string name) {     using (MyContext db = new MyContext())     {         return db.Orders.Where(x =&gt; x.Name == name);     } } <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043a\u043e\u0434\u0435 \u0435\u0441\u0442\u044c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430: \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0411\u0414 \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043e \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0439 \u043a\u043e\u0434 \u043d\u0435 \u043d\u0430\u0447\u043d\u0435\u0442 \u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0435\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e. \u0422.\u043a. \u043a \u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0411\u0414 \u0437\u0430\u043a\u0440\u044b\u0442\u043e, \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e:<\/p>\n<pre><code>public void Process(IEnumerable&lt;Order&gt; orders) {     foreach (Order order in orders) \/\/ Exception: DB connection is closed     {     } } <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0430\u044f \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 LSP, \u0442.\u043a. \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IEnumerable \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u0435\u0434\u0443\u0441\u043b\u043e\u0432\u0438\u0439, \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0445 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0421\u043b\u0435\u0434\u0443\u044f \u044d\u0442\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443, \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c IEnumerable \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0442\u043e\u0433\u043e, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u043a\u043b\u0430\u0441\u0441 DbQuery \u0443\u0441\u0438\u043b\u0438\u043b \u043f\u0440\u0435\u0434\u0443\u0441\u043b\u043e\u0432\u0438\u044f IEnumerable \u0438, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0430\u0440\u0443\u0448\u0438\u043b LSP.<\/p>\n<p>  \u042f \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u043c \u043f\u043b\u043e\u0445\u043e\u0433\u043e \u0434\u0438\u0437\u0430\u0439\u043d\u0430. \u041b\u0435\u043d\u0438\u0432\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u2014 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0411\u0414. \u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0437\u0430 \u043e\u0434\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0411\u0414 \u0438 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u043e\u0431\u0449\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0426\u0435\u043d\u043e\u0439 \u0437\u0434\u0435\u0441\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 LSP \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430.<\/p>\n<p>  \u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438: <a href=\"http:\/\/enterprisecraftsmanship.com\/2015\/01\/29\/ienumerable-interface-in-net-and-lsp\/\">IEnumerable interface in .NET and LSP<\/a>   \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/257667\/\"> http:\/\/habrahabr.ru\/post\/257667\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/256605\/\">C#: \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438 LSP<\/a>. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IEnumerable \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u041f\u0440\u0438\u043d\u0446\u0438\u043f_\u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438_\u0411\u0430\u0440\u0431\u0430\u0440\u044b_\u041b\u0438\u0441\u043a\u043e\u0432\">\u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0411\u0430\u0440\u0431\u0430\u0440\u044b \u041b\u0438\u0441\u043a\u043e\u0432<\/a> (LSP), \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f, \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 \u043b\u0438 \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u043a\u043e\u0434, \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 IEnumerable.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-256948","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/256948","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=256948"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/256948\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=256948"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=256948"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=256948"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}