This shows you the differences between two versions of the page.
— |
blog:2025-07-02-001 [2025/07/02 09:59] (current) jethro created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ~~NOTOC~~ | ||
+ | ====== 2025-07-02 C#: BitConverter.ToInt16 ====== | ||
+ | * <sxh c#>using System; | ||
+ | |||
+ | public class HelloWorld | ||
+ | { | ||
+ | public static void Main(string[] args) | ||
+ | { | ||
+ | byte[] gByteAry = new byte[8] {1,2,3,4,5,6,7,8}; | ||
+ | Int16 a, b, c, d; | ||
+ | |||
+ | a = BitConverter.ToInt16(gByteAry, 6); // wordees(0) | ||
+ | b = BitConverter.ToInt16(gByteAry, 4); // wordees(0) | ||
+ | c = BitConverter.ToInt16(gByteAry, 2); // wordees(0) | ||
+ | d = BitConverter.ToInt16(gByteAry, 0); // wordees(0) | ||
+ | |||
+ | Console.WriteLine ("a = " + a.ToString("X4")); | ||
+ | Console.WriteLine ("b = " + b.ToString("X4")); | ||
+ | Console.WriteLine ("c = " + c.ToString("X4")); | ||
+ | Console.WriteLine ("d = " + d.ToString("X4")); | ||
+ | } | ||
+ | }</sxh> | ||
+ | ===== Execution Output ===== | ||
+ | * <sxh>a = 0807 | ||
+ | b = 0605 | ||
+ | c = 0403 | ||
+ | d = 0201</sxh> | ||
+ | ===== TAGS ===== | ||
+ | * | ||
+ | ====== ====== | ||
+ | * {{counter}} person(s) visited this page until now. | ||
+ | * [[:memo:index|Back]] | ||
+ | ====== ====== | ||
+ | <html><!-- | ||
+ | PDF for A4-Portrait: {{pdfjs 50%,450px > xxx.pdf?page-fit}} | ||
+ | PDF for A4-Landscape: {{pdfjs 500px,700px > xxx.pdf?page-fit}} | ||
+ | PDF for iPad Note: {{pdfjs 700px,500px > xxx.pdf?page-fit}} | ||
+ | |||
+ | Youtube: {{youtube>large:XXXXX}} | ||
+ | Code Highlight: <sxh php; first-line: 70; highlight: [89,92]; title: New title attribute in action> | ||
+ | |||
+ | --></html> | ||