﻿
{"id":50,"date":"2012-03-08T01:25:31","date_gmt":"2012-03-08T01:25:31","guid":{"rendered":"http:\/\/www.gencayyildiz.com\/blog\/?p=50"},"modified":"2012-05-28T13:07:24","modified_gmt":"2012-05-28T13:07:24","slug":"cta-switch-case-kullanimi","status":"publish","type":"post","link":"https:\/\/www.gencayyildiz.com\/blog\/cta-switch-case-kullanimi\/","title":{"rendered":"C# Switch-Case Kullan\u0131m\u0131"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n<p>Bu yaz\u0131mda da &#8220;Switch Case&#8221; yap\u0131s\u0131ndan bahsedece\u011fim.Switch() parantezin i\u00e7ine yaz\u0131lan ifade,de\u011feri kontrol edilecek olan ifadedir.Case&#8217;den sonra bu ifadenin alabilece\u011fi bir de\u011fer yaz\u0131l\u0131r.E\u011fer ifade bu de\u011fere sahipse &#8220;Case-Break&#8221; aras\u0131 \u00e7al\u0131\u015f\u0131r.Burada &#8220;Case-Break&#8221; aras\u0131\u00a0bir nevi Scope\u00a0aras\u0131na benzer.E\u011fer hi\u00e7 bir ifade hi\u00e7 bir case deki de\u011ferleri uymuyorsa,&#8221;Default-Break&#8221; aras\u0131 \u00e7al\u0131\u015f\u0131r.Default-break komutunuda bir nevi Else&#8217;ye benzetebiliriz.<br \/>\n<!--more--><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nint sayi = 3;\r\nswitch (sayi)\/\/Burada kontrol edilecek de\u011feri giriyoruz.\r\n{\r\ncase 3:\/\/E\u011fer de\u011ferimiz 3 ise Mbox da 3 de\u011ferini yazacakt\u0131r.\r\nMessageBox.Show(&quot;3&quot;);\r\nbreak;\/\/case ve break komutlar\u0131 aras\u0131nda i\u015flem yapt\u0131r\u0131l\u0131r.\r\ncase 4:\r\nMessageBox.Show(&quot;4&quot;);\r\nbreak;\r\ncase 5:\r\nMessageBox.Show(&quot;5&quot;);\r\nbreak;\r\ncase 6:\r\ncase 7:\r\ncase 8:\r\ncase 9:\r\ncase 10:\/*E\u011fer 6,7,8,9,10 de\u011ferlerinden biriyse Mbox a alttaki\r\nde\u011fer yazd\u0131r\u0131l\u0131r.*\/\r\nMessageBox.Show(&quot;6,7,8,9,10&quot;);\r\nbreak;\/\/Pe\u015fpe\u015fe yaz\u0131lan case ler veya anlam\u0131na gelmektedir.\r\ndefault:\r\n\/\/Yukar\u0131dakilerden hi\u00e7biri de\u011filse buradaki komutlar \u00e7al\u0131\u015ft\u0131r\u0131l\u0131r.\r\nbreak;\r\n}\r\n<\/pre>\n<p>Bunlar\u0131n d\u0131\u015f\u0131nda <strong>goto case<\/strong> deyimi ile bir durumda di\u011fer durumlar\u0131n komutlar\u0131n\u0131 \u00e7al\u0131\u015ft\u0131rabiliyoruz. Bu deyimin kullan\u0131m\u0131 ise \u015fu \u015fekilde:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nswitch (sayi)\r\n{\r\ncase 1: sonuc = &quot;10&quot;; break;\r\ncase 2: sonuc = &quot;20&quot;; break;\r\ncase 3: sonuc = &quot;30&quot;; break;\r\ncase 4: goto case 1; \/\/sonuc de\u011feri 10 olacak\r\n}\r\n<\/pre>\n<p>\u0130yi \u00e7al\u0131\u015fmalar&#8230;<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Bu yaz\u0131mda da &#8220;Switch Case&#8221; yap\u0131s\u0131ndan bahsedece\u011fim.Switch() parantezin i\u00e7ine yaz\u0131lan ifade,de\u011feri kontrol edilecek olan ifadedir.Case&#8217;den sonra bu ifadenin alabilece\u011fi bir de\u011fer yaz\u0131l\u0131r.E\u011fer ifade bu de\u011fere sahipse &#8220;Case-Break&#8221; aras\u0131 \u00e7al\u0131\u015f\u0131r.Burada &#8220;Case-Break&#8221; aras\u0131\u00a0bir nevi Scope\u00a0aras\u0131na benzer.E\u011fer&#46;&#46;&#46;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[37,36],"class_list":["post-50","post","type-post","status-publish","format-standard","hentry","category-c-sharp-c","tag-case","tag-switch"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/comments?post=50"}],"version-history":[{"count":0,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/50\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media?parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/categories?post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/tags?post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}