File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -449,6 +449,27 @@ public static ustring Make (params char [] chars)
449449 return new ByteBufferUString ( chars ) ;
450450 }
451451
452+ /// <summary>
453+ /// Initializes a new instance of the <see cref="T:NStack.ustring"/> class from an array of Runes.
454+ /// </summary>
455+ /// <returns>The make.</returns>
456+ /// <param name="runes">Runes.</param>
457+ public static ustring Make ( IList < Rune > runes )
458+ {
459+ if ( runes == null )
460+ throw new ArgumentNullException ( nameof ( runes ) ) ;
461+ int size = 0 ;
462+ foreach ( var rune in runes ) {
463+ size += Utf8 . RuneLen ( rune ) ;
464+ }
465+ var encoded = new byte [ size ] ;
466+ int offset = 0 ;
467+ foreach ( var rune in runes ) {
468+ offset += Utf8 . EncodeRune ( rune , encoded , offset ) ;
469+ }
470+ return Make ( encoded ) ;
471+ }
472+
452473 /// <summary>
453474 /// Initializes a new instance of the <see cref="T:NStack.ustring"/> class from a block of memory and a size.
454475 /// </summary>
You can’t perform that action at this time.
0 commit comments