Random.GetString(ReadOnlySpan<Char>, Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立一個由隨機從中 choices選取的字元填充的字串。
public:
System::String ^ GetString(ReadOnlySpan<char> choices, int length);
public string GetString(ReadOnlySpan<char> choices, int length);
member this.GetString : ReadOnlySpan<char> * int -> string
Public Function GetString (choices As ReadOnlySpan(Of Char), length As Integer) As String
參數
- choices
- ReadOnlySpan<Char>
用來填入字串的字元。
- length
- Int32
回來的弦長。
傳回
一個由隨機選取 choices的項目填充的字串。
例外狀況
choices 空無一人。
length 不是零或正數。