File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change 3030using System . Collections . Generic ;
3131using System . Collections . Specialized ;
3232using System . IO ;
33+ using System . Linq ;
3334using System . Text ;
3435using System . Threading ;
3536using WebSocketSharp . Net ;
@@ -283,16 +284,9 @@ public byte[] ToByteArray ()
283284 {
284285 var headerData = Encoding . UTF8 . GetBytes ( MessageHeader ) ;
285286
286- if ( _messageBodyData == null )
287- return headerData ;
288-
289- var buff = new MemoryStream ( ) ;
290-
291- buff . Write ( headerData , 0 , headerData . Length ) ;
292- buff . WriteBytes ( _messageBodyData , 1024 ) ;
293- buff . Close ( ) ;
294-
295- return buff . ToArray ( ) ;
287+ return _messageBodyData != null
288+ ? headerData . Concat ( _messageBodyData ) . ToArray ( )
289+ : headerData ;
296290 }
297291
298292 public override string ToString ( )
You can’t perform that action at this time.
0 commit comments