{"id":195,"date":"2016-04-13T09:09:12","date_gmt":"2016-04-13T09:09:12","guid":{"rendered":"https:\/\/ibex.tech\/csharp\/?p=195"},"modified":"2022-02-17T06:24:14","modified_gmt":"2022-02-17T06:24:14","slug":"cast","status":"publish","type":"post","link":"https:\/\/ibex.tech\/csharp\/c-sharp\/memory\/cast","title":{"rendered":"Cast"},"content":{"rendered":"<p>\n\t&nbsp;\n<\/p>\n<h4>\n\t&quot;Cannot implicitly convert type &#39;int&#39; to&nbsp;&#39;byte&#39;. &nbsp;An&nbsp;explicit conversion exists (are you missing a cast)&quot;&nbsp;error<br \/>\n<\/h4>\n<p>\n\tThis will generat the error:\n<\/p>\n<pre>\r\n<code>\r\n\tTxData[ByteIndex++] = (byte)TagIdCharacter[0] | 0x80;\t\r\n<\/code><\/pre>\n<p>\n\tIts because the result of the IOR operation does not result in a byte, so you need to&nbsp;use&nbsp;parenthesis:\n<\/p>\n<pre>\r\n<code>\r\n\tTxData[ByteIndex++] = (byte)(TagIdCharacter[0] | 0x80);\t\r\n<\/code><\/pre>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\t&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; &quot;Cannot implicitly convert type &#39;int&#39; to&nbsp;&#39;byte&#39;. &nbsp;An&nbsp;explicit conversion exists (are you missing a cast)&quot;&nbsp;error This will generat the error: TxData[ByteIndex++] = (byte)TagIdCharacter[0] | 0x80; Its because the result of the IOR operation does not result in a byte, so you need to&nbsp;use&nbsp;parenthesis: TxData[ByteIndex++] = (byte)(TagIdCharacter[0] | 0x80); &nbsp; &nbsp; &nbsp;<\/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-195","post","type-post","status-publish","format-standard","hentry","category-memory"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/195","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=195"}],"version-history":[{"count":2,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/195\/revisions"}],"predecessor-version":[{"id":197,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/195\/revisions\/197"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/media?parent=195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/categories?post=195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/tags?post=195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}