This is an automated email from the ASF dual-hosted git repository.

critas pushed a commit to branch wx_fix_error
in repository https://gitbox.apache.org/repos/asf/iotdb-client-csharp.git

commit ec048f87b4f00c651a945d43e3001dbc220998a5
Author: CritasWang <[email protected]>
AuthorDate: Wed Jan 7 16:58:54 2026 +0800

    ByteBuffer: replace LINQ reversals with Array.Reverse for compatibility
---
 src/Apache.IoTDB/DataStructure/ByteBuffer.cs | 59 +++++++++++++++++++++-------
 1 file changed, 44 insertions(+), 15 deletions(-)

diff --git a/src/Apache.IoTDB/DataStructure/ByteBuffer.cs 
b/src/Apache.IoTDB/DataStructure/ByteBuffer.cs
index a66a7ac..471f651 100644
--- a/src/Apache.IoTDB/DataStructure/ByteBuffer.cs
+++ b/src/Apache.IoTDB/DataStructure/ByteBuffer.cs
@@ -18,7 +18,6 @@
  */
 
 using System;
-using System.Linq;
 using System.Text;
 
 namespace Apache.IoTDB.DataStructure
@@ -70,9 +69,12 @@ namespace Apache.IoTDB.DataStructure
         public int GetInt()
         {
             var intBuff = _buffer[_readPos..(_readPos + 4)];
-            if (_isLittleEndian) intBuff = intBuff.Reverse().ToArray();
+            if (_isLittleEndian)
+            {
+                Array.Reverse(intBuff);
+            }
 #if NET461_OR_GREATER || NETSTANDARD2_0
-            var intValue = BitConverter.ToInt32(intBuff,0);
+            var intValue = BitConverter.ToInt32(intBuff, 0);
 #else
             var intValue = BitConverter.ToInt32(intBuff);
 #endif
@@ -85,9 +87,12 @@ namespace Apache.IoTDB.DataStructure
         {
             var longBuff = _buffer[_readPos..(_readPos + 8)];
 
-            if (_isLittleEndian) longBuff = longBuff.Reverse().ToArray();
+            if (_isLittleEndian)
+            {
+                Array.Reverse(longBuff);
+            }
 #if NET461_OR_GREATER || NETSTANDARD2_0
-            var longValue = BitConverter.ToInt64(longBuff,0);
+            var longValue = BitConverter.ToInt64(longBuff, 0);
 #else
             var longValue = BitConverter.ToInt64(longBuff);
 #endif
@@ -100,9 +105,12 @@ namespace Apache.IoTDB.DataStructure
         {
             var floatBuff = _buffer[_readPos..(_readPos + 4)];
 
-            if (_isLittleEndian) floatBuff = floatBuff.Reverse().ToArray();
+            if (_isLittleEndian)
+            {
+                Array.Reverse(floatBuff);
+            }
 #if NET461_OR_GREATER || NETSTANDARD2_0
-            var floatValue = BitConverter.ToSingle(floatBuff,0);
+            var floatValue = BitConverter.ToSingle(floatBuff, 0);
 #else
             var floatValue = BitConverter.ToSingle(floatBuff);
 #endif
@@ -114,9 +122,12 @@ namespace Apache.IoTDB.DataStructure
         {
             var doubleBuff = _buffer[_readPos..(_readPos + 8)];
 
-            if (_isLittleEndian) doubleBuff = doubleBuff.Reverse().ToArray();
+            if (_isLittleEndian)
+            {
+                Array.Reverse(doubleBuff);
+            }
 #if NET461_OR_GREATER || NETSTANDARD2_0
-            var doubleValue = BitConverter.ToDouble(doubleBuff,0);
+            var doubleValue = BitConverter.ToDouble(doubleBuff, 0);
 #else
             var doubleValue = BitConverter.ToDouble(doubleBuff);
 #endif
@@ -173,7 +184,10 @@ namespace Apache.IoTDB.DataStructure
         {
             var boolBuffer = BitConverter.GetBytes(value);
 
-            if (_isLittleEndian) boolBuffer = boolBuffer.Reverse().ToArray();
+            if (_isLittleEndian)
+            {
+                Array.Reverse(boolBuffer);
+            }
 
             ExtendBuffer(boolBuffer.Length);
             boolBuffer.CopyTo(_buffer, _writePos);
@@ -184,7 +198,10 @@ namespace Apache.IoTDB.DataStructure
         {
             var intBuff = BitConverter.GetBytes(value);
 
-            if (_isLittleEndian) intBuff = intBuff.Reverse().ToArray();
+            if (_isLittleEndian)
+            {
+                Array.Reverse(intBuff);
+            }
 
             ExtendBuffer(intBuff.Length);
             intBuff.CopyTo(_buffer, _writePos);
@@ -195,7 +212,10 @@ namespace Apache.IoTDB.DataStructure
         {
             var longBuff = BitConverter.GetBytes(value);
 
-            if (_isLittleEndian) longBuff = longBuff.Reverse().ToArray();
+            if (_isLittleEndian)
+            {
+                Array.Reverse(longBuff);
+            }
 
             ExtendBuffer(longBuff.Length);
             longBuff.CopyTo(_buffer, _writePos);
@@ -206,7 +226,10 @@ namespace Apache.IoTDB.DataStructure
         {
             var floatBuff = BitConverter.GetBytes(value);
 
-            if (_isLittleEndian) floatBuff = floatBuff.Reverse().ToArray();
+            if (_isLittleEndian)
+            {
+                Array.Reverse(floatBuff);
+            }
 
             ExtendBuffer(floatBuff.Length);
             floatBuff.CopyTo(_buffer, _writePos);
@@ -217,7 +240,10 @@ namespace Apache.IoTDB.DataStructure
         {
             var doubleBuff = BitConverter.GetBytes(value);
 
-            if (_isLittleEndian) doubleBuff = doubleBuff.Reverse().ToArray();
+            if (_isLittleEndian)
+            {
+                Array.Reverse(doubleBuff);
+            }
 
             ExtendBuffer(doubleBuff.Length);
             doubleBuff.CopyTo(_buffer, _writePos);
@@ -248,7 +274,10 @@ namespace Apache.IoTDB.DataStructure
         {
             var charBuf = BitConverter.GetBytes(value);
 
-            if (_isLittleEndian) charBuf = charBuf.Reverse().ToArray();
+            if (_isLittleEndian)
+            {
+                Array.Reverse(charBuf);
+            }
 
             ExtendBuffer(charBuf.Length);
             charBuf.CopyTo(_buffer, _writePos);

Reply via email to