![]() |
#8 |
Молодой, подающий надежды
|
Цитата:
X++: Binary binary1 = new Binary("string1"); Binary binary2 = new Binary("string2"); Binary binaryResult; System.Byte[] byte1; System.Byte[] byte2; System.Byte[] byteResult; int len; System.IO.MemoryStream memoryStream; ; try { memoryStream = binary1.getMemoryStream(); byte1 = memoryStream.ToArray(); memoryStream.Close(); memoryStream = binary2.getMemoryStream(); byte2 = memoryStream.ToArray(); memoryStream.Close(); len = CLRInterop::getAnyTypeForObject(byte1.get_Length()) - 1; len += CLRInterop::getAnyTypeForObject(byte2.get_Length()) - 1; byteResult = new System.Byte[len](); memoryStream = new System.IO.MemoryStream(byteResult); memoryStream.Write(byte1, 0, CLRInterop::getAnyTypeForObject(byte1.get_Length()) - 1); memoryStream.Write(byte2, 0, CLRInterop::getAnyTypeForObject(byte2.get_Length()) - 1); binaryResult = Binary::constructFromMemoryStream(memoryStream); memoryStream.Close(); info(binaryResult.string(0)); } catch (Exception::CLRError) { error(AifUtil::getClrErrorMessage()); } X++: ... byteResult = new System.Byte[len](); System.Buffer::BlockCopy( byte1, 0, byteResult, 0, CLRInterop::getAnyTypeForObject(byte1.get_Length()) - 1); System.Buffer::BlockCopy( byte2, 0, byteResult, CLRInterop::getAnyTypeForObject(byte1.get_Length()) - 1, CLRInterop::getAnyTypeForObject(byte2.get_Length()) - 1); memoryStream = new System.IO.MemoryStream(byteResult); ... Последний раз редактировалось pedrozzz; 16.04.2014 в 23:06. |
|