RandomNumberGenerator.Create 方法

定義

建立密碼編譯亂數產生器之實作的執行個體。

多載

Create()

建立預設之密碼編譯亂數產生器實作的執行個體,此產生器可以用來產生隨機資料。

Create(String)
已淘汰.

建立指定之密碼編譯亂數產生器實作的執行個體。

Create()

來源:
RandomNumberGenerator.cs
來源:
RandomNumberGenerator.cs
來源:
RandomNumberGenerator.cs

建立預設之密碼編譯亂數產生器實作的執行個體,此產生器可以用來產生隨機資料。

C#
public static System.Security.Cryptography.RandomNumberGenerator Create();

傳回

密碼編譯亂數產生器的新執行個體。

另請參閱

適用於

.NET 9 及其他版本
產品 版本
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1

Create(String)

來源:
RandomNumberGenerator.cs
來源:
RandomNumberGenerator.cs
來源:
RandomNumberGenerator.cs

警告

Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.

建立指定之密碼編譯亂數產生器實作的執行個體。

C#
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static System.Security.Cryptography.RandomNumberGenerator? Create(string rngName);
C#
[System.Obsolete("Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.", DiagnosticId="SYSLIB0045", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Security.Cryptography.RandomNumberGenerator? Create(string rngName);
C#
public static System.Security.Cryptography.RandomNumberGenerator Create(string rngName);

參數

rngName
String

要使用的亂數產生器實作的名稱。

傳回

密碼編譯亂數產生器的新執行個體。

屬性

另請參閱

適用於

.NET 9 及其他版本
產品 版本 (已淘汰)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6 (7, 8, 9)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1