<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.microsoft.co.il/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Ido Flatow&amp;#39;s Blog&lt;h3&gt;Veni Vidi Scripsi&lt;/h3&gt; : C#</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/tags/C_2300_/default.aspx</link><description>Tags: C#</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>ExpressionType.And VS ExpressionType.AndAlso</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2009/08/26/expressiontype-and-vs-expressiontype-andalso.aspx</link><pubDate>Wed, 26 Aug 2009 22:37:27 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:387746</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=387746</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2009/08/26/expressiontype-and-vs-expressiontype-andalso.aspx#comments</comments><description>&lt;div align="left" dir="ltr"&gt; &lt;p align="left"&gt;Today I’ve encountered a strange problem running expressions - I wanted to created an expression tree that looks something like this:&lt;/p&gt;  &lt;p align="left"&gt;(e) =&amp;gt; e.Owner != null &amp;amp;&amp;amp; e.Owner.ID = 4455&lt;/p&gt;  &lt;p align="left"&gt;So I’ve used the Expression.MakeBinary method to create a binary expression and passed it an ExpressionType.And enum, thinking this is the C# “&amp;amp;&amp;amp;” operator.&lt;/p&gt;  &lt;p align="left"&gt;When running the expression on an e instance that had no owner (null), I got an exception. When looking at the created expression it looked something like this:&lt;/p&gt;  &lt;p align="left"&gt;(e) =&amp;gt; e.Owner != null AND e.Owner.ID = 4455&lt;/p&gt;  &lt;p align="left"&gt;At first I didn’t notice any difference (I just thought the ToString() created an easy-to-read string), but after comparing it with the same expression written by hand with a lambda expression, I noticed the difference between the “AND” operator and the “&amp;amp;&amp;amp;” operator.&lt;/p&gt;  &lt;p align="left"&gt;As it turns out, ExpressionType.Add is actually a bit-wise operator (similiar to &amp;amp;) and the enum that matches the &amp;amp;&amp;amp; operator is the ExpressionType.AndAlso (the &amp;amp;&amp;amp; operator is what is called a short-circut evaluator).&lt;/p&gt;  &lt;p align="left"&gt;This is the same with the || (or) operator – the ExpressionType.Or is the bitwise or, whilst the ExpressionType.OrElse is the actual “||” operator.&lt;/p&gt;  &lt;p align="left"&gt;I honestly think that it would have been better if they named this types as ExpressionType.BitwiseAnd and ExpressionType.And – makes more sense, doesn’t it?&lt;/p&gt;  &lt;p align="left"&gt;So be careful the next time you want to use and/or in your expression tree.&lt;/p&gt;  &lt;p align="left"&gt;Further links:&lt;/p&gt;  &lt;p align="left"&gt;&lt;a title="http://en.wikipedia.org/wiki/Short-circuit_evaluation" href="http://en.wikipedia.org/wiki/Short-circuit_evaluation"&gt;http://en.wikipedia.org/wiki/Short-circuit_evaluation&lt;/a&gt;&lt;/p&gt;  &lt;p align="left"&gt;&lt;a title="http://msdn.microsoft.com/en-us/library/bb353520.aspx" href="http://msdn.microsoft.com/en-us/library/bb353520.aspx"&gt;http://msdn.microsoft.com/en-us/library/bb353520.aspx&lt;/a&gt;&lt;/p&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=387746" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/C_2300_+3.0/default.aspx">C# 3.0</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Expression+Tree/default.aspx">Expression Tree</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/DEV/default.aspx">DEV</category></item><item><title>שיתוף קבצי קוד בין פרויקטים</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2008/07/27/126820.aspx</link><pubDate>Sun, 27 Jul 2008 20:13:11 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:126820</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=126820</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2008/07/27/126820.aspx#comments</comments><description>&lt;div dir="rtl" align="right"&gt; &lt;p&gt;לפני שבועיים &lt;a href="http://blogs.microsoft.co.il/blogs/sasha" target="_blank"&gt;סשה&lt;/a&gt; פרסם &lt;a href="http://blogs.microsoft.co.il/blogs/sasha/archive/2008/07/12/sharing-wcf-contracts-as-visual-studio-file-links.aspx" target="_blank"&gt;פוסט&lt;/a&gt; על שיתוף קבצי Contract בין Service ל-Client שלו.&lt;/p&gt; &lt;p&gt;הקונספט הזה העלה לי זכרונות ישנים לגבי פעולה זו וכדאי לשים לב לכמה דברים :&lt;/p&gt; &lt;p&gt;1. שיטה זו של קישור ע&amp;quot;י Link עובדת כל עוד היחס בין המסלולים (Path) נשמר בכל מחשבי הפיתוח - ברוב המקרים זה כך, אך יש לשים לב לכך בשביל שלא יווצרו broken links.&lt;/p&gt; &lt;p&gt;2. פתרון אפשרי אחר, למי שעדין עובד עם ה-VSS הישן של MS הוא לבצע Share של קובץ הקוד בין תיקיות הפרויקטים השונות ובכך לייצר עותק מקושר המנוהל ברמת ה-Source Control ולא ב-Studio. כך אפשר להתגבר על הרלטיוויות.&lt;br /&gt;למי שמשתמש עם TFS ומעוניין באפשרות זו - תמשיכו לחפש. משום מה החליטו ב-MS שתכונה זו של VSS לא תמשיך הלאה ל-TFS והיא קיימת רק בתוספות 3rd Party.&lt;br /&gt;לצערי אני מכיר רק את המוצרים של MS וקצת את Clear Case ששם נראה לי שאפשרות זו לא נתמכת. אם אתם מכירים כלי Source Control אחרים שמאפשרים זאת, אשמח לשמוע.&lt;/p&gt; &lt;p&gt;3. השימוש בקובץ קוד בפרויקט אחר מזה שבו הוא נוצר מעלה בעיה קטנה אחת - ה-Namespace של המחלקות. במצב זו ה-NS של פרויקט א&amp;#39; לפעמים שונה מזה של פרויקט ב&amp;#39; והיינו רוצים שהקוד המשוכפל &amp;quot;יתלבש&amp;quot; על מחלקות Partial שקיימות לנו בפרויקט החדש. הפתרון - שימוש ב-Preprocessor directives של IF. &lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;א. מגדירים IF על ה-Namespace - ראו דוגמה בתמונות בהמשך&lt;/p&gt; &lt;p&gt;ב. בפרויקט א&amp;#39;, הולכים להגדרות הפרויקט ותחת Build-&amp;gt;Conditional compilation symbols מוסיפים את הסימבול המתאים ל-NS של פרויקט א&amp;#39;&lt;/p&gt; &lt;p&gt;ג. בפרויקט ב&amp;#39;, הולכים להגדרות הפרויקט ותחת Build-&amp;gt;Conditional compilation symbols מוסיפים את הסימבול המתאים ל-NS של פרויקט ב&amp;#39;&lt;/p&gt; &lt;p&gt;ככה זה נראה כאשר פותחים את הקובץ מתוך פרויקט A :&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/WindowsLiveWriter/89bdd1980209_14506/image_2.png"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="195" alt="image" src="http://blogs.microsoft.co.il/blogs/idof/WindowsLiveWriter/89bdd1980209_14506/image_thumb.png" width="504" border="0" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;וככה זה נראה כאשר פותחים את הקובץ מתוך פרויקט B :&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/WindowsLiveWriter/89bdd1980209_14506/image_4.png"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="209" alt="image" src="http://blogs.microsoft.co.il/blogs/idof/WindowsLiveWriter/89bdd1980209_14506/image_thumb_1.png" width="504" border="0" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;שימו לב שה-IDE צובע באפור את ה-NS שלא עונה ל-IF, על-מנת לציין שהוא לא רלוונטי - כך אפשר להבחין בעין איזה קוד הוא זה שעומד להתקמפל.&lt;/p&gt; &lt;p&gt;דרך אגב, יכולת זו, כולל התכונה של ההצגה באפור ב-IDE, קיימת גם בגרסת VS 2005&lt;/p&gt;&lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=126820" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/tips+and+tricks/default.aspx">tips and tricks</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/VS+2008+IDE/default.aspx">VS 2008 IDE</category></item></channel></rss>