{"id":654,"date":"2016-11-24T10:51:27","date_gmt":"2016-11-24T10:51:27","guid":{"rendered":"https:\/\/ibex.tech\/windows-iot\/?p=178"},"modified":"2022-09-13T14:57:53","modified_gmt":"2022-09-13T13:57:53","slug":"static-2","status":"publish","type":"post","link":"https:\/\/ibex.tech\/csharp\/uwp-programming-in-c\/memory-uwp-programming-in-c\/static-2","title":{"rendered":"static"},"content":{"rendered":"<h4>\n\tClass static variables<\/h4>\n<p>A static variable shares the value of it among all instances of the class.<\/p>\n<h4>\n\tstatic Local Variables in C#<\/h4>\n<p>Nope, you can&#8217;t have a static local variable in a method in C#, get over it. &nbsp;Declare them in the class.<\/p>\n<p>The reason &#8211; C# is an Object Oriented programing language, C (which allows static) is a procedural programing language. In C it is logical to have a static variable in a function block. In C# a class is a basic block, so it&#8217;s logical to only have static member in a class. &nbsp;Don&#8217;t liek that explanation, tough its just the way it is! &nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Class static variables A static variable shares the value of it among all instances of the class. static Local Variables in C# Nope, you can&#8217;t have a static local variable in a method in C#, get over it. &nbsp;Declare them in the class. The reason &#8211; C# is an Object Oriented programing language, C (which [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[129],"tags":[],"class_list":["post-654","post","type-post","status-publish","format-standard","hentry","category-memory-uwp-programming-in-c"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/654","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/comments?post=654"}],"version-history":[{"count":1,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/654\/revisions"}],"predecessor-version":[{"id":1165,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/654\/revisions\/1165"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/media?parent=654"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/categories?post=654"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/tags?post=654"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}