16 result[0] = bValue ? 1 : 0;
23 result[0] = (
byte)chValue;
30 std::memcpy(result.
GetData(), &value, 8);
37 std::memcpy(result.
GetData(), &iValue, 2);
44 std::memcpy(result.
GetData(), &iValue, 4);
51 std::memcpy(result.
GetData(), &llValue, 8);
58 std::memcpy(result.
GetData(), &value, 4);
65 std::memcpy(result.
GetData(), &iValue, 2);
72 std::memcpy(result.
GetData(), &iValue, 4);
79 std::memcpy(result.
GetData(), &llValue, 8);
88 return value[iStartIndex] != 0;
96 return (
char)value[iStartIndex];
105 std::memcpy(&result, value.
GetData() + iStartIndex, 8);
115 std::memcpy(&iResult, value.
GetData() + iStartIndex, 2);
125 std::memcpy(&iResult, value.
GetData() + iStartIndex, 4);
135 std::memcpy(&llResult, value.
GetData() + iStartIndex, 8);
145 std::memcpy(&result, value.
GetData() + iStartIndex, 4);
154 unsigned short iResult;
155 std::memcpy(&iResult, value.
GetData() + iStartIndex, 2);
164 unsigned int iResult;
165 std::memcpy(&iResult, value.
GetData() + iStartIndex, 4);
174 unsigned long long llResult;
175 std::memcpy(&llResult, value.
GetData() + iStartIndex, 8);
192 if (iStartIndex < 0 || (iStartIndex >= nArrayLength && nArrayLength > 0))
196 if (iStartIndex + nLength > nArrayLength)
199 if (nLength == 0)
return String(
"");
202 std::stringstream ss;
203 for (
int iIndex = 0; iIndex < nLength; ++iIndex) {
204 if (iIndex > 0) ss <<
"-";
205 ss << std::uppercase << std::hex << std::setw(2) << std::setfill(
'0') << (int)value [iStartIndex + iIndex];
207 return String(ss.str().c_str());
213 std::memcpy(&llResult, &value,
sizeof(
double));
220 std::memcpy(&result, &llValue,
sizeof(
long long));
227 std::memcpy(&iResult, &value,
sizeof(
float));
234 std::memcpy(&result, &iValue,
sizeof(
int));
Defines the exception thrown when a null reference is passed to a method that does not accept it.
Defines the exception thrown when an argument value is outside the acceptable range of values.
Converts base data types to arrays of bytes, and arrays of bytes to base data types.
ArgumentException(const String &sMessage)
Initializes a new instance of the ArgumentException class with a specified error message.
ArgumentNullException(const String &sMessage)
Initializes a new instance of the ArgumentNullException class with a specified error message.
ArgumentOutOfRangeException(const String &sMessage)
Initializes a new instance of the ArgumentOutOfRangeException class with a specified error message.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
int GetLength() const
Gets the total number of elements in all dimensions of the Array.
T * GetData()
Gets a pointer to the contiguous internal element buffer.
static int ToInt32(Array< byte > &arrValue, int iStartIndex)
static const bool IsLittleEndian
Indicates whether this computer architecture is little-endian.
static double ToDouble(Array< byte > &arrValue, int iStartIndex)
static float Int32BitsToSingle(int iValue)
Reinterprets the specified 32-bit signed integer bit pattern as a 32-bit single-precision floating po...
static unsigned short ToUInt16(Array< byte > &arrValue, int iStartIndex)
static unsigned int ToUInt32(Array< byte > &arrValue, int iStartIndex)
static float ToSingle(Array< byte > &arrValue, int iStartIndex)
static String ToString(Array< byte > &arrValue)
Converts the numeric value of each element of a specified array of bytes to its equivalent hexadecima...
static bool ToBoolean(Array< byte > &arrValue, int iStartIndex)
Returns a Boolean value converted from one byte at a specified position in a byte array.
static unsigned long long ToUInt64(Array< byte > &arrValue, int iStartIndex)
static long long DoubleToInt64Bits(double dValue)
Converts the specified 64-bit double-precision floating point number to a 64-bit signed integer bit p...
static int SingleToInt32Bits(float fValue)
Converts the specified 32-bit single-precision floating point number to a 32-bit signed integer bit p...
static short ToInt16(Array< byte > &arrValue, int iStartIndex)
static double Int64BitsToDouble(long long llValue)
Reinterprets the specified 64-bit signed integer bit pattern as a 64-bit double-precision floating po...
static char ToChar(Array< byte > &arrValue, int iStartIndex)
static long long ToInt64(Array< byte > &arrValue, int iStartIndex)
static Array< byte > GetBytes(bool bValue)
Returns the specified Boolean value as a byte array.
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
String()
Initializes a new instance of the String class to an empty string.