![]()
static byte[] byt =
{ 0x35, 0x00, 0x36, 0x00, 0x45, 0x00, 0x46, 0x00,
0x65, 0x00, 0x66, 0x00, 0x15, 0xff, 0x16, 0xff
};
|

(char)(byt[i*2]+(byt[i*2+1]<<8))
|
/*★ Byte → Char の表示 前田 稔 ★*/
using System;
class Prog
{
static char[] ch = { '0', '1', '2', 'A', 'B', 'C', 'd', 'e' };
static byte[] byt =
{ 0x35, 0x00, 0x36, 0x00, 0x45, 0x00, 0x46, 0x00,
0x65, 0x00, 0x66, 0x00, 0x15, 0xff, 0x16, 0xff
};
public static void Main()
{
for(int i=0; i<8; i++) Console.WriteLine(ch[i]);
Console.WriteLine(new string(ch));
for(int i=0; i<8; i++) Console.WriteLine((char)(byt[i*2]+(byt[i*2+1]<<8)));
}
}
|
c:\DATA\C#\BAT>csc CharCode.cs Microsoft(R) Visual C# 2005 Compiler version 8.00.50727.9136 for Microsoft(R) Windows(R) 2005 Framework version 2.0.50727 Copyright (C) Microsoft Corporation 2001-2005. All rights reserved. c:\DATA\C#\BAT>CharCode.exe 0 1 2 A B C d e 012ABCde 5 6 E F e f 5 6 |
![]()
![]()