{"id":208,"date":"2016-11-24T10:51:48","date_gmt":"2016-11-24T10:51:48","guid":{"rendered":"https:\/\/ibex.tech\/csharp\/?p=208"},"modified":"2022-02-17T06:24:14","modified_gmt":"2022-02-17T06:24:14","slug":"static","status":"publish","type":"post","link":"https:\/\/ibex.tech\/csharp\/c-sharp\/memory\/static","title":{"rendered":"static"},"content":{"rendered":"<h4>\n\tClass static variables<br \/>\n<\/h4>\n<p>\n\tA static variable shares the value of it among all instances of the class.\n<\/p>\n<h4>\n\tstatic Local Variables in C#<br \/>\n<\/h4>\n<p>\n\tNope, you can&#39;t have a static local variable in a method in C#, get over it. &nbsp;Declare them in the class.\n<\/p>\n<p>\n\tThe 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&#39;s logical to only have static member in a class. &nbsp;Don&#39;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&#39;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":[7],"tags":[],"class_list":["post-208","post","type-post","status-publish","format-standard","hentry","category-memory"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/208","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=208"}],"version-history":[{"count":1,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/208\/revisions"}],"predecessor-version":[{"id":209,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/208\/revisions\/209"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/media?parent=208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/categories?post=208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/tags?post=208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}