Convert a ushort[] array to a single ushort in C# -


having ushort array, ushort[] how can convert ushort array [44,55] single joined ushort 4455? array has 2 elements.

ushort[] test = new ushort[2]; test[0] = 44; test[1] = 55; // here want convert ushort[] unique ushort value 4455 usortvalue = ? return usortvalue; 

i expecting .join function string does, it's not possible ushort.

thanks in advance

you can aggregate, predicate being "convert string, concatenate, , parse ushort", sooner or later (sooner!) you're going overflow.

ushort[] test = new ushort[2]; test[0] = 44; test[1] = 55; var result = test.aggregate((p,c)  => ushort.parse((p.tostring() + c.tostring()))); 

live example: http://rextester.com/vkv9570


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -