{"id":207578,"date":"2013-12-26T22:33:02","date_gmt":"2013-12-26T18:33:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=207578"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=207578","title":{"rendered":"<span class=\"post_title\">10 \u043c\u0438\u0444\u043e\u0432 \u043e LINQ<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<h4>\u041c\u0438\u0444 #1<\/h4>\n<p>  <\/p>\n<h4>\u0412\u0441\u0435 LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0441 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 &#8216;var&#8217;. \u041f\u043e \u0441\u0443\u0442\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0446\u0435\u043b\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 &#8216;var&#8217; \u2014 \u043d\u0430\u0447\u0430\u0442\u044c LINQ \u0437\u0430\u043f\u0440\u043e\u0441!<\/h4>\n<p>  \u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <b>var <\/b>\u0438 LINQ \u2014 \u044d\u0442\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438. \u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <b>var <\/b>\u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0442\u0438\u043f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f<b><i>(\u043d\u0435\u044f\u0432\u043d\u0430\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f)<\/i><\/b>. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cs\">var s = &quot;Hello&quot;;  <\/code><\/pre>\n<p>  \u0442\u043e\u0447\u043d\u044b\u0439 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442 \u0434\u043b\u044f:<\/p>\n<pre><code class=\"cs\">string s = &quot;Hello&quot;;  <\/code><\/pre>\n<p>  \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0442\u0438\u043f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <b>s<\/b> \u043a\u0430\u043a <b>string<\/b>.<br \/>  <a name=\"habracut\"><\/a>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"cs\">string[] people = new [] { &quot;Tom&quot;, &quot;Dick&quot;, &quot;Harry&quot; }; var filteredPeople = people.Where (p =&gt; p.Length &gt; 3);  <\/code><\/pre>\n<p>  \u0442\u043e\u0447\u043d\u044b\u0439 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442 \u0434\u043b\u044f:<\/p>\n<pre><code class=\"cs\">string[] people = new [] { &quot;Tom&quot;, &quot;Dick&quot;, &quot;Harry&quot; }; IEnumerable&lt;string&gt; filteredPeople = people.Where (p =&gt; p.Length &gt; 3);  <\/code><\/pre>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0432\u0441\u0451 \u0447\u0435\u0433\u043e \u043c\u044b \u0434\u043e\u0431\u0438\u043b\u0438\u0441\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 <b>var <\/b> \u2014 \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0434\u043b\u044f <b>IEnumerable&lt;string&gt;<\/b>. \u041c\u043d\u043e\u0433\u0438\u0435 \u043b\u044e\u0434\u0438 \u043b\u044e\u0431\u044f\u0442 \u0442\u0430\u043a\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0430 \u043a\u043e\u0440\u043e\u0447\u0435; \u0434\u0440\u0443\u0433\u0438\u0435 \u0436\u0435 \u0441\u0447\u0438\u0442\u0430\u044e\u0442, \u0447\u0442\u043e \u043d\u0435\u044f\u0432\u043d\u0430\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0430 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0434 \u043c\u0435\u043d\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c.<\/p>\n<p>  \u0411\u044b\u0432\u0430\u044e\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u043b\u044f LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 <i>\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e <\/i>\u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <b>var<\/b>. \u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u0432 <a href=\"http:\/\/www.albahari.com\/nutshell\/whatsnewcs30.aspx\">\u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0439 \u0442\u0438\u043f<\/a>:<\/p>\n<pre><code class=\"cs\">string[] people = new [] { &quot;Tom&quot;, &quot;Dick&quot;, &quot;Harry&quot; }; var filteredPeople = people.Select (p =&gt; new { Name = p, p.Length });  <\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0439 \u0442\u0438\u043f \u0432\u043d\u0435 LINQ \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430:<\/p>\n<pre><code class=\"cs\">var person = new { Name = &quot;Foo&quot;, Length = 3 }; <\/code><\/pre>\n<p>  <\/p>\n<h4>\u041c\u0438\u0444 #2<\/h4>\n<p>  <\/p>\n<h4>\u0412\u0441\u0435 LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/h4>\n<p>  \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432: <b>\u043b\u044f\u043c\u0431\u0434\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441<\/b> \u0438 <b>\u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/b>. <\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 <b>\u043b\u044f\u043c\u0431\u0434\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430<\/b>:<\/p>\n<pre><code class=\"cs\">string[] people = new [] { &quot;Tom&quot;, &quot;Dick&quot;, &quot;Harry&quot; }; var filteredPeople = people.Where (p =&gt; p.Length &gt; 3);  <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 \u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 <b>\u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/b>:<\/p>\n<pre><code class=\"cs\">string[] people = new [] { &quot;Tom&quot;, &quot;Dick&quot;, &quot;Harry&quot; }; var filteredPeople = from p in people where p.Length &gt; 3 select p;  <\/code><\/pre>\n<p>  \u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u043b\u044f\u043c\u0431\u0434\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u0441\u0451, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0442\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u043e \u0432 \u043b\u044f\u043c\u0431\u0434\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435. \u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435 \u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u043c\u0438 <i>\u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430<\/i>. (\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 <b>p<\/b>, \u0442\u0430\u043a \u0447\u0442\u043e \u043e\u0431\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u043f\u0440\u043e\u0441\u0442\u043e).<\/p>\n<p>  \u041d\u0435 \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0442\u0430\u043a \u0447\u0442\u043e \u044d\u0442\u0438 \u0434\u0432\u0430 \u0432\u0438\u0434\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u0441\u043a\u043e\u0440\u0435\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043b\u0443\u0447\u0448\u0435\u0435 \u043e\u0442 \u043a\u0430\u0436\u0434\u043e\u0433\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u0442\u044c \u0441\u0442\u0438\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u043e\u0434\u043d\u043e\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0438 (\u0441\u043c. \u043c\u0438\u0444 # 5).<\/p>\n<h4>\u041c\u0438\u0444 #3<\/h4>\n<p>  <\/p>\n<h4>\u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0432\u0441\u0435\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u043e\u0434\u043e\u0431\u0438\u0438 \u044d\u0442\u043e\u0433\u043e: <br \/>  var query = from c in db.Customers select c.<\/h4>\n<p>  \u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/p>\n<pre><code class=\"cs\">from c in db.Customers select c  <\/code><\/pre>\n<p>  \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0432\u043d\u044b\u043c! \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c:<\/p>\n<pre><code class=\"cs\">db.Customers <\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 LINQ to XML \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"cs\">var xe = from e in myXDocument.Descendants (&quot;phone&quot;) select e; <\/code><\/pre>\n<p>  \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u043f\u0440\u043e\u0449\u0435\u043d \u0434\u043e:<\/p>\n<pre><code class=\"cs\">var xe = myXDocument.Descendants (&quot;phone&quot;); <\/code><\/pre>\n<p>  \u0418 \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"cs\">Customer customer = (from c in db.Customers where c.ID == 123 select c)                     .Single(); <\/code><\/pre>\n<p>  \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0434\u043e:<\/p>\n<pre><code class=\"cs\">Customer customer = db.Customers.Single (c =&gt; c.ID == 123); <\/code><\/pre>\n<p>  <\/p>\n<h4>\u041c\u0438\u0444 #4<\/h4>\n<p>  <\/p>\n<h4>\u0427\u0442\u043e\u0431\u044b \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 SQL \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 LINQ, \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c LINQ \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0445\u043e\u0436\u0438\u043c \u043d\u0430 SQL \u0437\u0430\u043f\u0440\u043e\u0441.<\/h4>\n<p>  LINQ \u0438 SQL \u2014 \u0440\u0430\u0437\u043d\u044b\u0435 \u044f\u0437\u044b\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438.<\/p>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0433\u043b\u0430\u0432\u043d\u044b\u043c \u0431\u0430\u0440\u044c\u0435\u0440\u043e\u043c \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f LINQ \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0438\u043d\u0434\u0440\u043e\u043c \u00ab\u0434\u0443\u043c\u0430\u0442\u044c \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0445 SQL\u00bb: \u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 SQL, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430 LINQ. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u0430\u044f \u0431\u043e\u0440\u044c\u0431\u0430 \u0441 API!<\/p>\n<p>  \u041e\u0434\u043d\u0430\u0436\u0434\u044b \u043d\u0430\u0447\u0430\u0432 \u0434\u0443\u043c\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432 <a href=\"http:\/\/www.linqpad.net\/challenge.aspx\">\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0445 LINQ<\/a>, \u0432\u0430\u0448\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0431\u0443\u0434\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043c\u0430\u043b\u043e \u043e\u0431\u0449\u0435\u0433\u043e \u0441 \u0438\u0445 SQL-\u0430\u043d\u0430\u043b\u043e\u0433\u0430\u043c\u0438. \u0412\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0442\u0430\u043a\u0436\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0449\u0435.<\/p>\n<h4>\u041c\u0438\u0444 #5<\/h4>\n<p>  <\/p>\n<h4>\u0414\u043b\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432 LINQ, \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e join.<\/h4>\n<p>  \u042d\u0442\u043e \u043f\u0440\u0430\u0432\u0434\u0430, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\u043c. \u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0435 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e join \u0432\u043e\u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e: \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u043c\u0435\u043d\u0435\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 <b>from<\/b>-\u043e\u0432 \u0438 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e from-\u043e\u0432 \u0438 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u043c\u0438: \u0432\u044b \u0442\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c <i>\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u043e \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0443<\/i> (non-equi-join).<\/p>\n<p>  \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e \u0432 LINQ to SQL \u0438 Entity Framework \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c <i>\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0446\u0438\u0438<\/i>, \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044e\u0449\u0438\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u0432 join-\u0430\u0445! \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u043c\u0435\u043d\u0430 \u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0432\u0441\u0435\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u043d\u0435 \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u0432\u0448\u0438\u0445 \u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u043a\u0443\u043f\u043a\u0438:<\/p>\n<pre><code class=\"cs\">from c in db.Customers where !c.Purchases.Any() select new { c.ID, c.Name }  <\/code><\/pre>\n<p>  \u0418\u043b\u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u043d\u0435 \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u0432\u0448\u0438\u0445 \u043f\u043e\u043a\u0443\u043f\u043a\u0443 \u043d\u0430 \u0441\u0443\u043c\u043c\u0443 \u0441\u0432\u044b\u0448\u0435 $1000:<\/p>\n<pre><code class=\"cs\">from c in db.Customers where !c.Purchases.Any (p =&gt; p.Price &gt; 1000) select new { c.ID, c.Name }  <\/code><\/pre>\n<p>  \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u043c\u044b \u0441\u043c\u0435\u0448\u0430\u043b\u0438 \u043b\u044f\u043c\u0431\u0434\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0438 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0411\u043e\u043b\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0446\u0438\u0438, \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u043f\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f\u043c \u0438 \u0441\u043c\u0435\u0448\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u0441\u043c\u043e\u0442\u0440\u0438 \u043d\u0430 <a href=\"http:\/\/www.linqpad.net\/\">LINQPad<\/a>.<\/p>\n<h4>\u041c\u0438\u0444 #6<\/h4>\n<p>  <\/p>\n<h4>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c SQL \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043b\u043e\u0441\u043a\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u043e LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0442\u0430\u043a\u0436\u0435 \u043f\u043b\u043e\u0441\u043a\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445.<\/h4>\n<p>  \u042d\u0442\u043e \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u0438\u0437 \u041c\u0438\u0444\u0430 #4. \u041e\u0434\u043d\u043e \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 LINQ \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435:  <\/p>\n<ol>\n<li>\u0417\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c <i>\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 <\/i>\u043e\u0431\u044a\u0435\u043a\u0442 \u0447\u0435\u0440\u0435\u0437 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0446\u0438\u0438 (\u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0442\u044c\u0441\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e);<\/li>\n<li>\u041f\u0440\u043e\u0435\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c <i>\u043f\u0440\u044f\u043c\u043e <\/i>\u0432 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/li>\n<\/ol>\n<p>  \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, 1 \u0438 2 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b, \u043e\u0434\u043d\u0430\u043a\u043e 1 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 2. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u043d\u043e\u043c\u0435\u0440\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0432 \u0448\u0442\u0430\u0442\u0435 WA \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0438\u0445 \u043f\u043e\u043a\u0443\u043f\u043a\u0430\u043c\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cs\">from c in db.Customers where c.State == &quot;WA&quot; select new {    c.Name,    c.Purchases    \/\/ An EntitySet (collection) } <\/code><\/pre>\n<p>  \u0418\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435 \u0432 \u0440\u0430\u0431\u043e\u0442\u0435, \u0447\u0435\u043c \u043f\u043b\u043e\u0441\u043a\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442\u044c \u0442\u0430\u043a\u043e\u0433\u043e \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430, \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <i>\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0446\u0438\u0439<\/i>:<\/p>\n<pre><code class=\"cs\">from c in db.Customers where c.State == &quot;WA&quot; select new {    c.Name,    Purchases = db.Purchases.Where (p =&gt; p.CustomerID == c.ID) } <\/code><\/pre>\n<h4>\u041c\u0438\u0444 #7<\/h4>\n<p>  <\/p>\n<h4>\u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0435\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0432 LINQ to SQL \u0432\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 DefaultIfEmpty().<\/h4>\n<p>  \u042d\u0442\u043e \u043f\u0440\u0430\u0432\u0434\u0430, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u0435\u043d <i>\u043f\u043b\u043e\u0441\u043a\u0438\u0439 <\/i>\u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u0438\u043c\u0435\u0440 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043c\u0438\u0444\u0435, \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u043b\u0435\u0432\u043e\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 (left outer join) \u0432 SQL \u0438 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <b>DefaultIfEmpty<\/b>.<\/p>\n<h4>\u041c\u0438\u0444 #8<\/h4>\n<p>  <\/p>\n<h4>\u0417\u0430\u043f\u0440\u043e\u0441\u044b LINQ to SQL \u0438\u043b\u0438 Entity Framework \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0435\u0434\u0438\u043d\u043e\u0435 \u0446\u0435\u043b\u043e\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u0432 \u043e\u0434\u0438\u043d \u0448\u0430\u0433.<\/h4>\n<p>  LINQ \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0442\u043e \u0435\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0435 \u0432\u043e \u0432\u0440\u0435\u043c\u044f <i>\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f<\/i>, \u0430 \u0432\u043e \u0432\u0440\u0435\u043c\u044f <i>\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f<\/i>. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u0448\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432\u043e \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0448\u0430\u0433\u043e\u0432, \u0432\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435, \u0438 \u043e\u043d\u0438 \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0443\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0432\u044b \u043d\u0435 \u043d\u0430\u0447\u043d\u0451\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<p>  \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0438\u043c\u0435\u043d\u0430 \u0432\u0441\u0435\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u0432\u0448\u0438\u0445 \u0434\u0432\u0435 \u043f\u043e\u043a\u0443\u043f\u043a\u0438, \u0447\u044c\u0451 \u0438\u043c\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 &#8216;\u0410&#8217;. \u041c\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u0442\u0440\u0438 \u0448\u0430\u0433\u0430:<\/p>\n<pre><code class=\"cs\">var query = db.Customers.Where (c =&gt; c.Name.StartsWith (&quot;A&quot;)); query = query.Where (c =&gt; c.Purchases.Count() &gt;= 2); var result = query.Select (c =&gt; c.Name);  foreach (string name in result)   \/\/ \u0422\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f!    Console.WriteLine (name); <\/code><\/pre>\n<h4>\u041c\u0438\u0444 #9<\/h4>\n<p>  <\/p>\n<h4>\u041c\u0435\u0442\u043e\u0434 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441, \u0435\u0441\u043b\u0438 \u043e\u043d \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c &#8216;new&#8217;.<\/h4>\n<p>  \u0422\u0440\u044e\u043a \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u0432 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 <b>\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f<\/b>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432:<\/p>\n<pre><code class=\"cs\">public IQueryable&lt;NameDetails&gt; GetCustomerNamesInState (string state) {    return       from c in Customer       where c.State == state       select new NameDetails       {          FirstName = c.FirstName,          LastName = c.LastName       }; } <\/code><\/pre>\n<p>  \u041a\u043b\u0430\u0441\u0441 <b>NameDetails<\/b> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cs\">public class NameDetails {    public string FirstName, LastName; } <\/code><\/pre>\n<p>  <\/p>\n<h4>\u041c\u0438\u0444 #10<br \/>  <\/h4>\n<p>  <\/p>\n<h4>\u041b\u0443\u0447\u0448\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f LINQ to SQL- \u044d\u0442\u043e \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 DataContext \u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043e\u0431\u0449\u0438\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0439 \u0436\u0438\u0437\u043d\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/h4>\n<p>  \u0422\u0430\u043a\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c DataContext \u043d\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435. <\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 DataContext \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043c\u043d\u043e\u0433\u043e \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u0442\u043d\u044b\u043c. <\/p>\n<p>  \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 DataContext \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0434\u0435\u043b\u0430\u044f \u0435\u0433\u043e \u0436\u0438\u0437\u043d\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0439. \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f Entity Framework.<\/p>\n<p>  <b>\u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u044f \u0442\u0430\u043a \u0436\u0435 \u043f\u0435\u0440\u0435\u0432\u0451\u043b LINQ Quiz (\u0442\u0435\u0441\u0442) \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043b <a href=\"http:\/\/timyrguev.blogspot.ru\/2013\/12\/linq-quiz.html\">\u0432 \u0441\u0432\u043e\u0451\u043c \u0431\u043b\u043e\u0433\u0435<\/a>. \u0414\u0443\u043c\u0430\u044e \u0431\u0443\u0434\u0435\u0442 \u0432\u0435\u0441\u044c\u043c\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0414\u0436\u043e \u0410\u043b\u0431\u0430\u0445\u0430\u0440\u0438!<\/b>   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/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\/207578\/\"> http:\/\/habrahabr.ru\/post\/207578\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<h4>\u041c\u0438\u0444 #1<\/h4>\n<p>  <\/p>\n<h4>\u0412\u0441\u0435 LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0441 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 &#8216;var&#8217;. \u041f\u043e \u0441\u0443\u0442\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0446\u0435\u043b\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 &#8216;var&#8217; \u2014 \u043d\u0430\u0447\u0430\u0442\u044c LINQ \u0437\u0430\u043f\u0440\u043e\u0441!<\/h4>\n<p>  \u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <b>var <\/b>\u0438 LINQ \u2014 \u044d\u0442\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438. \u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <b>var <\/b>\u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0442\u0438\u043f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f<b><i>(\u043d\u0435\u044f\u0432\u043d\u0430\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f)<\/i><\/b>. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cs\">var s = &quot;Hello&quot;;  <\/code><\/pre>\n<p>  \u0442\u043e\u0447\u043d\u044b\u0439 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442 \u0434\u043b\u044f:<\/p>\n<pre><code class=\"cs\">string s = &quot;Hello&quot;;  <\/code><\/pre>\n<p>  \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0442\u0438\u043f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <b>s<\/b> \u043a\u0430\u043a <b>string<\/b>.  <\/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-207578","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/207578","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=207578"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/207578\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=207578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=207578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=207578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}