{"id":163,"date":"2016-11-23T20:29:41","date_gmt":"2016-11-23T20:29:41","guid":{"rendered":"https:\/\/ibex.tech\/windows-iot\/?p=163"},"modified":"2022-09-13T14:57:33","modified_gmt":"2022-09-13T13:57:33","slug":"variables-2","status":"publish","type":"post","link":"https:\/\/ibex.tech\/csharp\/uwp-programming-in-c\/memory-uwp-programming-in-c\/variables-2","title":{"rendered":"Variables"},"content":{"rendered":"<p>The structure below shows the various basic types of C#&nbsp;and the types they map to in the .Net framework.<\/p>\n<table cellpadding=\"0\" cellspacing=\"0\">\n<colgroup>\n<col width=\"130\">\n<col width=\"100\">\n<col width=\"198\">\n<col width=\"214\">\n\t<\/colgroup>\n<tbody>\n<tr>\n<td>\n\t\t\t\t<strong>C# Short Name<\/strong><\/td>\n<td>\n\t\t\t\t<strong>.Net Class<\/strong><\/td>\n<td>\n\t\t\t\t<strong>Declaration<\/strong><\/td>\n<td>\n\t\t\t\t<strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tbool<\/td>\n<td>\n\t\t\t\tBoolean<\/td>\n<td>\n\t\t\t\tbool isValid = true;<\/td>\n<td>\n\t\t\t\t\t8 bit true or false<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tsbyte<\/td>\n<td>\n\t\t\t\tSByte<\/td>\n<td>\n\t\t\t\tsbyte b = -1<\/td>\n<td>\n\t\t\t\tsigned 8 bit integer<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tbyte<\/td>\n<td>\n\t\t\t\tByte<\/td>\n<td>\n\t\t\t\tbyte b = 1;<\/td>\n<td>\n\t\t\t\t8 bit unsigned integer<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tchar<\/td>\n<td>\n\t\t\t\tChar<\/td>\n<td>\n\t\t\t\tchar = &#8216;a&#8217;<\/td>\n<td>\n\t\t\t\t16 bit single Unicode character<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tshort<\/td>\n<td>\n\t\t\t\tInt16<\/td>\n<td>\n\t\t\t\tshort s = 123;<\/td>\n<td>\n\t\t\t\t16bit signed integer<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tushort<\/td>\n<td>\n\t\t\t\tUInt16<\/td>\n<td>\n\t\t\t\tushort s = 15;<\/td>\n<td>\n\t\t\t\t16bit unsigned integer<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tint<\/td>\n<td>\n\t\t\t\tInt32<\/td>\n<td>\n\t\t\t\tint i = -1000000;<\/td>\n<td>\n\t\t\t\t32bit signed integer<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tuint<\/td>\n<td>\n\t\t\t\tUInt32<\/td>\n<td>\n\t\t\t\tuint i = 50000;<\/td>\n<td>\n\t\t\t\t32bit unsigned integer<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tlong<\/td>\n<td>\n\t\t\t\tInt64<\/td>\n<td>\n\t\t\t\tlong = 2000;<\/td>\n<td>\n\t\t\t\t64 bit signed integer<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tulong<\/td>\n<td>\n\t\t\t\tUInt64<\/td>\n<td>\n\t\t\t\tulong = 2000;<\/td>\n<td>\n\t\t\t\t64 bit unsigned integer<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tfloat<\/td>\n<td>\n\t\t\t\tSingle<\/td>\n<td>\n\t\t\t\tfloat f = 1.04f;<\/td>\n<td>\n\t\t\t\t4 byte single precision floating point<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tdouble<\/td>\n<td>\n\t\t\t\tDouble<\/td>\n<td>\n\t\t\t\tdouble d = 1.0E-13<\/td>\n<td>\n\t\t\t\t8 byte double precision floating point<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tdecimal<\/td>\n<td>\n\t\t\t\tDecimal<\/td>\n<td>\n\t\t\t\t&nbsp;<\/td>\n<td>\n\t\t\t\t16 byte precise fractional or integral type that can represent decimal numbers with 29 significant digits<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tstring<\/td>\n<td>\n\t\t\t\tString<\/td>\n<td>\n\t\t\t\tstring s = &#8220;abcd&#8221;;<\/td>\n<td>\n\t\t\t\tA sequence of unicode characters<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>\n\tBinary Values<\/h4>\n<p>You can&#8217;t specify a binary value in C# &#8211; specify in hexadecimal instead.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The structure below shows the various basic types of C#&nbsp;and the types they map to in the .Net framework. C# Short Name .Net Class Declaration Description bool Boolean bool isValid = true; 8 bit true or false sbyte SByte sbyte b = -1 signed 8 bit integer byte Byte byte b = 1; 8 bit [&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-163","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\/163","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=163"}],"version-history":[{"count":1,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/163\/revisions"}],"predecessor-version":[{"id":1164,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/163\/revisions\/1164"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/media?parent=163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/categories?post=163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/tags?post=163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}