System.UInt16.ToString C# (CSharp) Method

ToString() public method

public ToString ( ) : string
return string
        public override string ToString()
        {
            return int.CreateString(_value, false, false);
        }

Same methods

UInt16::ToString ( string format ) : string

Usage Example

コード例 #1
0
        static void LoadRom(string fileName, UInt16 memoryAddress)
        {
            BinaryReader reader = new BinaryReader(File.Open(fileName, FileMode.Open));
            int pos = 0;
            UInt16 index = memoryAddress;

            int length = (int)reader.BaseStream.Length;
            try
            {
                while (pos < length)
                {
                    byte[] word = reader.ReadBytes(2);
                    if (BitConverter.IsLittleEndian)
                        Array.Reverse(word);

                    UInt16 data = BitConverter.ToUInt16(word, 0);
                    //UInt16 data = reader.ReadUInt16();
                    Console.Write(data.ToString("X") + ":");
                    MasterComponent.Instance.MemoryMap.Write16BitsToAddress(index, data);
                    pos += sizeof(UInt16);
                    index += 1;
                }

                Console.WriteLine("Loaded rom " + fileName + " into 0x" + memoryAddress.ToString("X"));
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error loading rom " + fileName + " into 0x" + memoryAddress.ToString("X"));
                Console.WriteLine(ex);
            }
            reader.Close();
        }
All Usage Examples Of System.UInt16::ToString