{"id":33,"date":"2016-02-10T16:30:20","date_gmt":"2016-02-10T16:30:20","guid":{"rendered":"https:\/\/ibex.tech\/csharp\/?p=33"},"modified":"2022-05-18T12:58:27","modified_gmt":"2022-05-18T11:58:27","slug":"strings-general","status":"publish","type":"post","link":"https:\/\/ibex.tech\/csharp\/c-sharp\/strings\/strings-general","title":{"rendered":".Strings General"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">string or String<\/h4>\n\n\n\n<p>string is an alias in C# for System.String.<br>So technically there is no difference (it&#8217;s like int and System.Int32).<\/p>\n\n\n\n<p>Best practice:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Use string any time you&#8217;re referring to an object.<\/li><li>Use String if you need to refer specifically to the class.<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Multi Line Strings<\/h4>\n\n\n\n<p>Use the &#8216;@&#8217; character before the string to create a verbatim string literal:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tString sTemp = @\"This\n\t\t\t\t\t\tstring is on\n\t\t\t\t\t\tmultiple lines\";<\/code><\/pre>\n\n\n\n<p>Notes:<\/p>\n\n\n\n<p>You can have the string be on multiple lines<br>You don&#8217;t need to escape characters other than &#8221; (which you do by using &#8220;&#8221; 2 x double quotes), so no need for &#8221; C:\\\\some_directory&#8221;<br>You can&#8217;t have comments within it<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Convert Value To String<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\tint Value;\n\tValue = 100;\n\tmytextbox.text = Value.ToString();<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>string or String string is an alias in C# for System.String.So technically there is no difference (it&#8217;s like int and System.Int32). Best practice: Use string any time you&#8217;re referring to an object. Use String if you need to refer specifically to the class. Multi Line Strings Use the &#8216;@&#8217; character before the string to create [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-33","post","type-post","status-publish","format-standard","hentry","category-strings"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/33","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=33"}],"version-history":[{"count":6,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/33\/revisions"}],"predecessor-version":[{"id":558,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/33\/revisions\/558"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/media?parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/categories?post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/tags?post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}