{"id":650,"date":"2016-11-23T20:32:33","date_gmt":"2016-11-23T20:32:33","guid":{"rendered":"https:\/\/ibex.tech\/windows-iot\/?p=167"},"modified":"2022-09-13T14:58:13","modified_gmt":"2022-09-13T13:58:13","slug":"constants-2","status":"publish","type":"post","link":"https:\/\/ibex.tech\/csharp\/uwp-programming-in-c\/memory-uwp-programming-in-c\/constants-2","title":{"rendered":"Constants"},"content":{"rendered":"<p>You have to use constants within a class. &nbsp;So like this:<\/p>\n<pre><code>\npublic const int MY_NUMBER = 9;\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>You&#8217;d need to put it in a class somewhere, and the usage would be ClassName.MY_NUMBER<\/p>\n<h4>\n\tNumber Defines<\/h4>\n<pre><code>\npublic const int SOFTWARE_VERSION = 42;\nconst int SOFTWARE_VERSION = 42;\n<\/code><\/pre>\n<h4>\n\tString Defines<\/h4>\n<pre><code>\npublic const string MY_THINGS_PATH = \"c:\\\\windows\\\\\";\nconst string MY_THINGS_PATH = \"c:\\\\windows\\\\\";\nprivate const string MY_THINGS_PATH = \"c:\\\\windows\\\\\";\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You have to use constants within a class. &nbsp;So like this: public const int MY_NUMBER = 9; &nbsp; You&#8217;d need to put it in a class somewhere, and the usage would be ClassName.MY_NUMBER Number Defines public const int SOFTWARE_VERSION = 42; const int SOFTWARE_VERSION = 42; String Defines public const string MY_THINGS_PATH = &#8220;c:\\\\windows\\\\&#8221;; const [&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-650","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\/650","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=650"}],"version-history":[{"count":1,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/650\/revisions"}],"predecessor-version":[{"id":1166,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/650\/revisions\/1166"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/media?parent=650"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/categories?post=650"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/tags?post=650"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}