{"id":61,"date":"2009-03-03T08:01:59","date_gmt":"2009-03-03T07:01:59","guid":{"rendered":"http:\/\/blog.eweibel.net\/?p=61"},"modified":"2011-08-31T23:56:44","modified_gmt":"2011-08-31T21:56:44","slug":"fall-thru-or-not-to-fall-through","status":"publish","type":"post","link":"https:\/\/blog.eweibel.net\/?p=61","title":{"rendered":"Fall-thru or not to fall through"},"content":{"rendered":"<p>There is a little differences how <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/06tc147t.aspx\">C#<\/a> and Java implement the switch-statement. I discovered it when I want to implement a fall through in C#.<br \/>\nIn Java it is very simple: just leave the break statement at the end of the case block away.<br \/>\nIn C# it doesn&#8217;t work like that. There is no implicit fall through (with one exception: The case blocks have to be empty). You have to implement it explicit by add at the end of the case block a goto statement which refer to the case block which should be called.<br \/>\nThe advantage of the explicit way is, that a classic mistake couldn&#8217;t happened but the disadvantage is that you have to write more code and use the &#8220;old&#8221; keyword goto (and I thought I wouldn&#8217;t see this keyword again&#8230;). I found also an explanation for that behaviour on <a href=\"http:\/\/msdn.microsoft.com\/en-us\/vcsharp\/aa336815.aspx\">msdn<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There is a little differences how C# and Java implement the switch-statement. I discovered it when I want to implement a fall through in C#. In Java it is very simple: just leave the break statement at the end of the case block away. In C# it doesn&#8217;t work like that. There is no implicit fall through (with one exception: The case blocks have to be empty). You have to implement it explicit by add at the end of the&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/blog.eweibel.net\/?p=61\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[13,11],"tags":[12,20],"class_list":["post-61","post","type-post","status-publish","format-standard","hentry","category-net","category-java","tag-c","tag-java"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/plOV9-Z","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":12,"url":"https:\/\/blog.eweibel.net\/?p=12","url_meta":{"origin":61,"position":0},"title":"Explicit interface implementation","author":"Patrick","date":"12. May 2007","format":false,"excerpt":"In C# you have a feature, which java don't have. It's called explicit interface implementation.The main use of this feature is to solve problems when you have to implement for example two interfaces which have both unfortunatly a same method signature: namespace testpw.ExplicitInterfaces{\u00a0\u00a0\u00a0 public interface IA\u00a0\u00a0\u00a0 {\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 void doAction();\u00a0\u00a0\u00a0 }\u00a0\u00a0\u00a0\u2026","rel":"","context":"In &quot;Good practices&quot;","block_context":{"text":"Good practices","link":"https:\/\/blog.eweibel.net\/?cat=5"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":116,"url":"https:\/\/blog.eweibel.net\/?p=116","url_meta":{"origin":61,"position":1},"title":"Techdays 2009 in Bern","author":"Patrick","date":"15. Apr 2009","format":false,"excerpt":"I was last week at the Techdays 2009 in Bern. As expected there weren't a lot of new or interesting things. The most interesting topics were Azure (Cloud computing) and the next VisualStudio 2010. I visited following sessions: ADO.NET Data Services - Creating RESTful Services Overview Visual Studio 10 and\u2026","rel":"","context":"In &quot;.NET&quot;","block_context":{"text":".NET","link":"https:\/\/blog.eweibel.net\/?cat=13"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":160,"url":"https:\/\/blog.eweibel.net\/?p=160","url_meta":{"origin":61,"position":2},"title":"When to use stored procedures","author":"Patrick","date":"13. May 2009","format":false,"excerpt":"Recently I discussed with a colleague when to use stored procedures. As exptected it was quite a religious conversation. A few days later I found the following screencast: The Pros and Cons of Stored Procedures Based on the discussion and the screencast I tried to summarize my Pros and Cons:\u2026","rel":"","context":"In &quot;Good practices&quot;","block_context":{"text":"Good practices","link":"https:\/\/blog.eweibel.net\/?cat=5"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":137,"url":"https:\/\/blog.eweibel.net\/?p=137","url_meta":{"origin":61,"position":3},"title":"Registered the domain alpha-geek.ch","author":"Patrick","date":"8. May 2009","format":false,"excerpt":"I read recently the article of martin fowler about alpha-geek again. Then I checked various links which contains the keyword alpha geek. I was surprised that the domain alpha-geek.ch was free, so I couldn't resist to register it for me. Martin writes about alpha geeks: \"Alpha geeks are typically experimenting\u2026","rel":"","context":"In &quot;Private&quot;","block_context":{"text":"Private","link":"https:\/\/blog.eweibel.net\/?cat=9"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5,"url":"https:\/\/blog.eweibel.net\/?p=5","url_meta":{"origin":61,"position":4},"title":"Programming several conditions in C#","author":"Patrick","date":"28. Apr 2007","format":false,"excerpt":"When you have to programme a piece of code which have several conditions you could do it in the following way: switch(a.name){\u00a0\u00a0\u00a0 case \"smith\":\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 CallHim(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 break;\u00a0\u00a0\u00a0 case \"doyle\":\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SendAMessageToHim();\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 break;\u00a0\u00a0\u00a0 default:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 throw new WriteNotReachableErrorException();} If you couldn't use constants as conditions, you will implement the logic in the following\u2026","rel":"","context":"In &quot;Good practices&quot;","block_context":{"text":"Good practices","link":"https:\/\/blog.eweibel.net\/?cat=5"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":499,"url":"https:\/\/blog.eweibel.net\/?p=499","url_meta":{"origin":61,"position":5},"title":"Favoured podcasts","author":"Patrick","date":"1. Nov 2009","format":false,"excerpt":"I migrated my desktop PC to Windows 7 Professional. I didn\u2019t choose the upgrade path, I install Windows 7 from scratch. So, after installing iTunes I had to register my favoured podcasts again: .Net .Net Rocks! Hanselminutes herding {code} Stackoverflow Polymorphic Podcast Alt.NET podcast Java The Java Posse Software engineering\u2026","rel":"","context":"In &quot;.NET&quot;","block_context":{"text":".NET","link":"https:\/\/blog.eweibel.net\/?cat=13"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=\/wp\/v2\/posts\/61","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=61"}],"version-history":[{"count":10,"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=\/wp\/v2\/posts\/61\/revisions"}],"predecessor-version":[{"id":1100,"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=\/wp\/v2\/posts\/61\/revisions\/1100"}],"wp:attachment":[{"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=61"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=61"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=61"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}