<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5880561654709533946</id><updated>2024-09-01T16:15:33.179-07:00</updated><category term="C#"/><category term="newbie&#39;s"/><category term="trick"/><category term="stupid questions"/><category term="LINQ"/><category term="expressions"/><category term="interview"/><category term=".net"/><category term="performance"/><category term="IQueryable"/><category term="MSVS"/><category term="multithreading"/><category term="scala"/><category term="tools"/><category term="JVM"/><category term="emit"/><category term="functional programming"/><category term="puzzle"/><category term="regex"/><category term="serialization"/><category term="svn"/><category term="thumb-rule"/><category term="totalcmd"/><category term="windbg"/><title type='text'>Waldgeist&#39;s notes</title><subtitle type='html'>Tiny notes from everyday work. Mostly about .NET, C# and some tools I use every day.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>49</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-5506637158007755036</id><published>2021-03-22T04:58:00.003-07:00</published><updated>2021-03-22T04:58:46.476-07:00</updated><title type='text'>Git config includeif</title><summary type="text">&amp;nbsp;Git config &quot;includeif&quot; feature works only in git initialized directories. On plain directories it uses only default .gitconfig file.</summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/5506637158007755036/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2021/03/git-config-includeif.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/5506637158007755036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/5506637158007755036'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2021/03/git-config-includeif.html' title='Git config includeif'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-8804901004228564877</id><published>2020-02-10T01:10:00.002-08:00</published><updated>2020-02-10T01:11:28.839-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".net"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="thumb-rule"/><title type='text'>Relative Uris and leading/trailing backslash</title><summary type="text">
Be very accurate with leading and trailing backslashes in URLs. For instance, I have some app installed on http://some.host/path that provides api via relative uri /api/some/call

There is only one correct combination of Base and Rel Uris:



(4 items)4


Base

Rel

Result


http://some.host/path/

/api/some/call

http://some.host/api/some/call


http://some.host/path/

api/some/call

http://</summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/8804901004228564877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2020/02/relative-uris-and-leadingtrailing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/8804901004228564877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/8804901004228564877'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2020/02/relative-uris-and-leadingtrailing.html' title='Relative Uris and leading/trailing backslash'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-2459854360278296211</id><published>2017-09-06T07:56:00.002-07:00</published><updated>2017-09-06T07:56:48.735-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".net"/><category scheme="http://www.blogger.com/atom/ns#" term="trick"/><title type='text'>UriEncode</title><summary type="text">

There are two static methods in&amp;nbsp;System.Uri:&amp;nbsp;EscapeDataString&amp;nbsp;and&amp;nbsp;EscapeUriString. Use first to escape any string after &#39;?&#39; in uri and second one to escape any string before &#39;?&#39;:




Symbol&amp;nbsp;EscapeUriString&amp;nbsp;EscapeDataString


aaa
bbb
ccc
space%20%20
??%3F
!!%21
@@%40
##%23
$$%24
%%25%25
^%5E%5E
&amp;amp;&amp;amp;%26
**%2A
((%28
))%29
//%2F
\%5C%5C
++%2B
___
---
&amp;lt;%3C%3C
&amp;</summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/2459854360278296211/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2017/09/uriencode.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/2459854360278296211'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/2459854360278296211'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2017/09/uriencode.html' title='UriEncode'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-7857299762575633491</id><published>2017-07-21T01:25:00.002-07:00</published><updated>2017-07-21T01:25:59.291-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".net"/><category scheme="http://www.blogger.com/atom/ns#" term="performance"/><title type='text'>ToArray vs ToList vs ToImmutableArray vs ToImmutableList</title><summary type="text">
ToArray() is the fastest way to materialize IEnumerable on dotnet core:

BenchmarkDotNet=v0.10.8, OS=Mac OS X 10.12
Processor=Intel Core i7-4770HQ CPU 2.20GHz (Haswell), ProcessorCount=8
Frequency=1000000000 Hz, Resolution=1.0000 ns, Timer=UNKNOWN
dotnet cli version=1.0.4
&amp;nbsp; [Host] &amp;nbsp; &amp;nbsp; : .NET Core 4.6.25211.01, 64bit RyuJIT
&amp;nbsp; DefaultJob : .NET Core 4.6.25211.01, 64bit RyuJIT

</summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/7857299762575633491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2017/07/toarray-vs-tolist-vs-toimmutablearray.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/7857299762575633491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/7857299762575633491'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2017/07/toarray-vs-tolist-vs-toimmutablearray.html' title='ToArray vs ToList vs ToImmutableArray vs ToImmutableList'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-6368510999263068690</id><published>2017-06-16T06:10:00.001-07:00</published><updated>2017-06-16T06:59:10.182-07:00</updated><title type='text'>dotnet core + bash</title><summary type="text">
To update all packages in all projects:

find . -name &quot;*.csproj&quot; -exec sh -c &quot;gawk &#39;match(\$0, /PackageReference Include=\&quot;(.*)\&quot; Version/, a){print a[1]}&#39; {} | xargs -L1 dotnet add {} package&quot; \;
To run all tests in all Tests projects:
find . -name &quot;*Tests*.csproj&quot; -execdir dotnet test --no-build {} \;

</summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/6368510999263068690/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2017/06/dotnet-core-bash.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/6368510999263068690'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/6368510999263068690'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2017/06/dotnet-core-bash.html' title='dotnet core + bash'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-3728447090452878746</id><published>2016-06-21T02:32:00.001-07:00</published><updated>2016-06-21T02:32:24.510-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="MSVS"/><category scheme="http://www.blogger.com/atom/ns#" term="trick"/><title type='text'>Nuget or not nuget</title><summary type="text">
To switch all references from static dll to Nuget, use following snippet in Package Manager Console:

Get-Project -All | foreach-object {IF (Get-Content $_.FullName | Select-String &quot;XXX&quot;) {Install-Package XXX -ProjectName $_.FullName}}
</summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/3728447090452878746/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2016/06/nuget-or-not-nuget.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/3728447090452878746'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/3728447090452878746'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2016/06/nuget-or-not-nuget.html' title='Nuget or not nuget'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-2965888184202175117</id><published>2015-03-09T06:54:00.001-07:00</published><updated>2015-03-09T06:54:50.777-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="LINQ"/><category scheme="http://www.blogger.com/atom/ns#" term="trick"/><title type='text'>Group by order</title><summary type="text">
Quite a common case - assume we have a collection of items and we want to iterate over it, but at first by items with some feature, then by items without such feature.

For instance, we have list of integers and want to iterate firstly all even numbers, then all odd numbers.

First approach is to group items by this feature and then iterate over group:


var
ints = new[]{1,2,3,4,5};




var
</summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/2965888184202175117/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2015/03/group-by-order.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/2965888184202175117'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/2965888184202175117'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2015/03/group-by-order.html' title='Group by order'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-8035260699606902397</id><published>2013-11-21T23:11:00.000-08:00</published><updated>2013-11-21T23:11:12.190-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JVM"/><category scheme="http://www.blogger.com/atom/ns#" term="scala"/><title type='text'>Assert T</title><summary type="text">
Here is some trick for getting over type erasure in Scala.


I want to create the following method that will expect an exception of particular type:

def assertT[T &amp;lt;: Throwable ](body: =&amp;gt;Unit) = {
  try {
    body
    assert(false)
  } catch {
    case e : T =&amp;gt; assert(true)
  }
}

But due to type erasure, the case condition ( : T ) will be never checked. Scala compiler will warn you </summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/8035260699606902397/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2013/11/assert-t.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/8035260699606902397'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/8035260699606902397'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2013/11/assert-t.html' title='Assert T'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-5266087059666146656</id><published>2013-05-19T04:38:00.001-07:00</published><updated>2013-05-19T04:38:19.313-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="newbie&#39;s"/><title type='text'>Capital Eye</title><summary type="text">
What will the following line print out?

Console.WriteLine(&quot;i&quot;.ToUpper());

The answer is obvious: &quot;It depends&quot;

String.ToUpper as well as string.ToLower will use current thread culture, and in most cases it will print &quot;I&quot;, but there is two cultures, where capital &quot;i&quot; is not &quot;I&quot;, but &quot;İ&quot; - Turkish (tr) and&amp;nbsp;Azeri Latin (az-Latn).

So never ever use ToUpper() and ToLower() in internal </summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/5266087059666146656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2013/05/capital-eye.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/5266087059666146656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/5266087059666146656'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2013/05/capital-eye.html' title='Capital Eye'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-69797774765738483</id><published>2013-05-19T04:31:00.001-07:00</published><updated>2013-05-19T04:32:10.287-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="expressions"/><category scheme="http://www.blogger.com/atom/ns#" term="IQueryable"/><category scheme="http://www.blogger.com/atom/ns#" term="LINQ"/><title type='text'>Compiled lambda issue</title><summary type="text">


Never ever return the result of Expression&amp;lt;T&amp;gt;.Compile() method. If your compiled expression throws an exception, you will not get any info about the compiled lambda. For example, I have the NullReferenceException with following stack trace:


System.NullReferenceException: Object reference not set to an instance of an object.
&amp;nbsp; &amp;nbsp;at lambda_method(Closure , BugDto )
&amp;nbsp; &amp;nbsp;</summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/69797774765738483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2013/05/compiled-lambda-issue.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/69797774765738483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/69797774765738483'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2013/05/compiled-lambda-issue.html' title='Compiled lambda issue'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-2067748564326153060</id><published>2012-10-15T03:37:00.000-07:00</published><updated>2012-10-15T03:37:01.056-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="expressions"/><category scheme="http://www.blogger.com/atom/ns#" term="IQueryable"/><category scheme="http://www.blogger.com/atom/ns#" term="LINQ"/><title type='text'>Queryable extensions</title><summary type="text">
It is possible to extend a LINQ vocabulary with some custom methods that will be used later in query providers to build a custom query to outer source. Also, there is a little trick that allows using such extensions in Linq-to-objects expressions.

Here is a standard stub for an IQueryable method:



public static IQueryable&amp;lt;Tuple&amp;lt;int, TKey&amp;gt;&amp;gt; CountBy&amp;lt;TSource, TKey&amp;gt;(this </summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/2067748564326153060/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2012/10/queryable-extensions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/2067748564326153060'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/2067748564326153060'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2012/10/queryable-extensions.html' title='Queryable extensions'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-1956831846423807147</id><published>2012-09-21T13:38:00.000-07:00</published><updated>2012-09-21T13:38:30.452-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="functional programming"/><category scheme="http://www.blogger.com/atom/ns#" term="newbie&#39;s"/><category scheme="http://www.blogger.com/atom/ns#" term="scala"/><title type='text'>Pearls of scala I -  By-name parameters</title><summary type="text">
In C# there is no way to define short-circuit evaluated &#39;and&#39; function (for example).

The naive implementation like following is not good enough.

bool And(bool a, bool b){
&amp;nbsp; if (a)
&amp;nbsp; &amp;nbsp;&amp;nbsp;return b;
&amp;nbsp; else&amp;nbsp;
&amp;nbsp; &amp;nbsp; return false;
}

Let define an identity function:


bool Id(bool value){
&amp;nbsp; Console.WriteLine(value);
&amp;nbsp; return value;
}


And let&#39;s compare </summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/1956831846423807147/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2012/09/pearls-of-scala-i-by-name-parameters.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/1956831846423807147'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/1956831846423807147'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2012/09/pearls-of-scala-i-by-name-parameters.html' title='Pearls of scala I -  By-name parameters'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-6314738312013308356</id><published>2012-05-30T01:02:00.000-07:00</published><updated>2012-05-30T02:53:11.677-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="newbie&#39;s"/><category scheme="http://www.blogger.com/atom/ns#" term="stupid questions"/><title type='text'>MakeGenericType</title><summary type="text">
When does the following line of code could fail with &quot;The number of generic arguments provided doesn&#39;t equal the arity of the generic 
type definition&quot;?



var&amp;nbsp;t&amp;nbsp;=&amp;nbsp;typeof&amp;nbsp;(SomeGenericClass&amp;lt;,,&amp;gt;).MakeGenericType&amp;nbsp;(typeof&amp;nbsp;(int),&amp;nbsp;typeof&amp;nbsp;(int),&amp;nbsp;typeof&amp;nbsp;(int));



Where&amp;nbsp;SomeGenericClass&amp;nbsp;is defined as:




public&amp;nbsp;class&amp;nbsp;</summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/6314738312013308356/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2012/05/makegenerictype.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/6314738312013308356'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/6314738312013308356'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2012/05/makegenerictype.html' title='MakeGenericType'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-6827500928023535431</id><published>2012-05-24T01:22:00.000-07:00</published><updated>2012-05-24T01:22:08.633-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="interview"/><category scheme="http://www.blogger.com/atom/ns#" term="newbie&#39;s"/><category scheme="http://www.blogger.com/atom/ns#" term="puzzle"/><title type='text'>Reverse</title><summary type="text">
Three tiny puzzles:

Given the following interface:
interface&amp;nbsp;INode

{

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INode&amp;nbsp;Next&amp;nbsp;{&amp;nbsp;get;&amp;nbsp;set;&amp;nbsp;}

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; object&amp;nbsp;Data&amp;nbsp;{&amp;nbsp;get;&amp;nbsp;}

}

and a reference to root&amp;nbsp;INode&amp;nbsp;root&amp;nbsp;reverse a one-linked list. Do not use any additional collections, as arrays, </summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/6827500928023535431/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2012/05/reverse.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/6827500928023535431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/6827500928023535431'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2012/05/reverse.html' title='Reverse'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-6368662279689129999</id><published>2012-05-17T08:05:00.000-07:00</published><updated>2012-05-17T23:40:16.298-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="expressions"/><category scheme="http://www.blogger.com/atom/ns#" term="LINQ"/><title type='text'>Mix of Queryable and Enumerable</title><summary type="text">
Some&amp;nbsp;useful observation from Expressions world.

Let&#39;s imagine we have the following class:


public&amp;nbsp;class&amp;nbsp;Foo
{
 public&amp;nbsp;int[]&amp;nbsp;Items&amp;nbsp;{&amp;nbsp;get;&amp;nbsp;set;&amp;nbsp;}
}



And we use it in some IQueryable request in a following manner:

var&amp;nbsp;queryable&amp;nbsp;=&amp;nbsp;new[]&amp;nbsp;{&amp;nbsp;new&amp;nbsp;Foo&amp;nbsp;{Items&amp;nbsp;=&amp;nbsp;new[]&amp;nbsp;{&amp;nbsp;1,&amp;nbsp;2,&amp;nbsp;3&amp;nbsp;}}&amp;nbsp;}</summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/6368662279689129999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2012/05/mix-of-queryable-and-enumerable.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/6368662279689129999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/6368662279689129999'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2012/05/mix-of-queryable-and-enumerable.html' title='Mix of Queryable and Enumerable'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-3262696765535822526</id><published>2012-05-08T05:42:00.000-07:00</published><updated>2012-05-08T05:42:51.248-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="regex"/><category scheme="http://www.blogger.com/atom/ns#" term="trick"/><title type='text'>Two cool regex features</title><summary type="text">



Unicode Character Properties
\p{spec}

where&amp;nbsp;spec&amp;nbsp;- various specs definitions like:


L - letter
Ll - lowercase letter
P - punctuation
Cyrillic -&amp;nbsp;Cyrillic&amp;nbsp;letter
InSpecials: U+FFF0..U+FFFF

... and&amp;nbsp;much more.



Character Class Subtraction

Example:

[a-z-[aeiuo]]

A single letter is not a vowel.

Could be combined with&amp;nbsp;Unicode&amp;nbsp;character properties:&amp;nbsp;

</summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/3262696765535822526/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2012/05/two-cool-regex-features.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/3262696765535822526'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/3262696765535822526'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2012/05/two-cool-regex-features.html' title='Two cool regex features'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-1850332510531490495</id><published>2012-05-05T02:48:00.001-07:00</published><updated>2012-05-05T02:48:40.360-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="trick"/><title type='text'>Delegate sum</title><summary type="text">
Funny trick via&amp;nbsp;http://confluence.jetbrains.net/display/ReSharper/Delegate+subtraction+has+unpredictable+semantics



Action&amp;nbsp;a&amp;nbsp;=&amp;nbsp;()&amp;nbsp;=&amp;gt;&amp;nbsp;Console.Write(&quot;A&quot;);

Action&amp;nbsp;b&amp;nbsp;=&amp;nbsp;()&amp;nbsp;=&amp;gt;&amp;nbsp;Console.Write(&quot;B&quot;);

Action&amp;nbsp;c&amp;nbsp;=&amp;nbsp;()&amp;nbsp;=&amp;gt;&amp;nbsp;Console.Write(&quot;C&quot;);

Action&amp;nbsp;s&amp;nbsp;=&amp;nbsp;a&amp;nbsp;+&amp;nbsp;b&amp;nbsp;+&amp;nbsp;c&amp;nbsp;+&amp;nbsp;</summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/1850332510531490495/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2012/05/delegate-sum.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/1850332510531490495'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/1850332510531490495'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2012/05/delegate-sum.html' title='Delegate sum'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-285641377129822394</id><published>2012-04-26T08:45:00.004-07:00</published><updated>2012-05-01T02:33:03.817-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="trick"/><title type='text'>Private const</title><summary type="text">
Some odd attribute defining behavior.

Let&#39;s define a class with some constants:

class Foo




{
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;const&amp;nbsp;string&amp;nbsp;String&amp;nbsp;=&amp;nbsp;&quot;some string&quot;;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;protected&amp;nbsp;const&amp;nbsp;Type&amp;nbsp;Type&amp;nbsp;=&amp;nbsp;null;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;private const int Int =
42;

}



It&#39;s strange but you can access these constants in</summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/285641377129822394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2012/04/private-const.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/285641377129822394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/285641377129822394'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2012/04/private-const.html' title='Private const'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-2575498124773367401</id><published>2012-04-26T02:46:00.001-07:00</published><updated>2012-04-26T02:46:44.499-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MSVS"/><category scheme="http://www.blogger.com/atom/ns#" term="tools"/><title type='text'>MyMacro</title><summary type="text">
How to fix&amp;nbsp;Visual Studio Macros IDE crashing from here:



2.1.7 On computers on which Visual Studio 2008 or SQL Server 2008 is installed and Visual Studio 2010 has been uninstalled and then reinstalled, using the Visual Studio Macros IDE may cause Visual Studio to crash

Uninstalling Visual Studio 2010 also removes the Visual Studio Macro Tools package. If the computer also has Visual </summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/2575498124773367401/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2012/04/mymacro.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/2575498124773367401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/2575498124773367401'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2012/04/mymacro.html' title='MyMacro'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-7652306612850212765</id><published>2012-04-25T02:59:00.003-07:00</published><updated>2012-04-25T02:59:55.446-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="performance"/><category scheme="http://www.blogger.com/atom/ns#" term="trick"/><title type='text'>Tail recursion</title><summary type="text">

Some odd&amp;nbsp;behavior&amp;nbsp;to keep in mind.

The following code is expected to fail with StackOverflowException:



class Program

{

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; static void Main(string[]
args)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Tail();

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }



&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;</summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/7652306612850212765/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2012/04/tail-recursion.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/7652306612850212765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/7652306612850212765'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2012/04/tail-recursion.html' title='Tail recursion'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-8720079199136026284</id><published>2012-04-09T05:36:00.001-07:00</published><updated>2012-04-19T06:09:06.734-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="expressions"/><category scheme="http://www.blogger.com/atom/ns#" term="stupid questions"/><title type='text'>Lazy tree</title><summary type="text">
Some stupid task about Expression trees.

Write down a&amp;nbsp;simplest&amp;nbsp;expression tree visitor (inherited from System.Linq.Expressions.ExpressionVisitor) that will have a static method:


public static IEnumerable&amp;lt;Expression&amp;gt;
All(Expression
node)



This method should return lazy enumeration of all expression in a an expression tree represented by node. By &quot;lazy&quot; I mean that a tree </summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/8720079199136026284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2012/04/lazy-tree.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/8720079199136026284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/8720079199136026284'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2012/04/lazy-tree.html' title='Lazy tree'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-2254606771410127967</id><published>2011-10-27T03:10:00.000-07:00</published><updated>2011-10-27T03:10:23.877-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="newbie&#39;s"/><category scheme="http://www.blogger.com/atom/ns#" term="serialization"/><title type='text'>Serialization lost</title><summary type="text">
Just a side note.

When an object is been deserialized by IFormatter, no constructors are called*! So if you have any fields marked as [NonSerialized] that are initilized in constructors or inline, they would not be initialized at all!

Consider the following example:

[Serializable]
public&amp;nbsp;class&amp;nbsp;Test
{
 public&amp;nbsp;Test()
 {
  Console.WriteLine(&quot;Inside&amp;nbsp;ctor&quot;);
 }

 [NonSerialized</summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/2254606771410127967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2011/10/serialization-lost.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/2254606771410127967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/2254606771410127967'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2011/10/serialization-lost.html' title='Serialization lost'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-5950101282875209473</id><published>2011-10-26T12:49:00.000-07:00</published><updated>2011-10-26T12:49:17.412-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="trick"/><title type='text'>Initialization trick</title><summary type="text">
You all now the cool syntax sugar for object initialization in C#:

var item = new Item { Age = 5 };



Also there are sugar for collection initialization:

var items = new List&amp;lt;Item&amp;gt; { new Item { Age = 5 } };


And, of course, we could mix these two cases:



class ItemContainer
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; public List&amp;lt;Item&amp;gt; Items{get;set;}
} 

// ...

var itemContainer = new ItemContainer </summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/5950101282875209473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2011/10/initialization-trick.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/5950101282875209473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/5950101282875209473'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2011/10/initialization-trick.html' title='Initialization trick'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-4448829288874096442</id><published>2011-09-28T05:01:00.000-07:00</published><updated>2011-10-26T12:06:35.177-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="LINQ"/><category scheme="http://www.blogger.com/atom/ns#" term="stupid questions"/><title type='text'>Only one</title><summary type="text">


Just another LINQ puzzle.

Let&#39;s assume that we have sequence of objects of type Item:

class Item
{
   public int Age{get;set;}
}


How could you return all objects from the sequence that have Age value maximized (in a single LINQ query and single enumeration of the sequence)? 

If the question was about returning the first object, the answer is straightforward:

return </summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/4448829288874096442/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2011/09/only-one.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/4448829288874096442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/4448829288874096442'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2011/09/only-one.html' title='Only one'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5880561654709533946.post-7765890662448775946</id><published>2011-09-20T07:02:00.000-07:00</published><updated>2011-09-20T07:02:44.684-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="tools"/><title type='text'>Sexy sections</title><summary type="text">
Configuration Section Designer is as awesome as simple. For example, here is scheme of our Visual Build board:


</summary><link rel='replies' type='application/atom+xml' href='http://der-waldgeist.blogspot.com/feeds/7765890662448775946/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://der-waldgeist.blogspot.com/2011/09/sexy-sections.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/7765890662448775946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5880561654709533946/posts/default/7765890662448775946'/><link rel='alternate' type='text/html' href='http://der-waldgeist.blogspot.com/2011/09/sexy-sections.html' title='Sexy sections'/><author><name>Alex Fomin</name><uri>http://www.blogger.com/profile/02054479652706775847</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61iMh_R4kITmBR9FxyS5grGZqdy8eIAjV2-gxg-tumdZ2tGQtzG1ReH9VCZMjbjJhOl8ECrbZKFefpFd45TDpFvnNBXLtXP_8HIPdrWSMzkaetCesIeWQ6lK1x4ZUfGg/s113/IMAGE_001.jpg'/></author><thr:total>0</thr:total><georss:featurename>Minsk, Belarus</georss:featurename><georss:point>53.904338156274704 27.4658203125</georss:point><georss:box>51.5890806562747 22.4121093125 56.219595656274706 32.5195313125</georss:box></entry></feed>