X509Certificate.ToString Метод

Определение

Возвращает строковое представление текущего X509Certificate объекта.

Перегрузки

Имя Описание
ToString()

Возвращает строковое представление текущего X509Certificate объекта.

ToString(Boolean)

Возвращает строковое представление текущего X509Certificate объекта с дополнительными сведениями, если они указаны.

ToString()

Исходный код:
X509Certificate.cs
Исходный код:
X509Certificate.cs
Исходный код:
X509Certificate.cs
Исходный код:
X509Certificate.cs
Исходный код:
X509Certificate.cs

Возвращает строковое представление текущего X509Certificate объекта.

public:
 override System::String ^ ToString();
public override string ToString();
override this.ToString : unit -> string
Public Overrides Function ToString () As String

Возвращаемое значение

Строковое представление текущего X509Certificate объекта.

Примеры

В следующем примере метод используется ToString для отображения значения сертификата в консоли.

using System;
using System.Security.Cryptography.X509Certificates;

public class X509
{
    public static void Main()
    {
        // The path to the certificate.
        string Certificate =  "Certificate.cer";

        // Load the certificate into an X509Certificate object.
        X509Certificate cert = X509Certificate.CreateFromCertFile(Certificate);

        // Get the value.
        string resultsTrue = cert.ToString(true);

        // Display the value to the console.
        Console.WriteLine(resultsTrue);

        // Get the value.
        string resultsFalse = cert.ToString(false);

        // Display the value to the console.
        Console.WriteLine(resultsFalse);
    }
}
Imports System.Security.Cryptography.X509Certificates




Public Class X509
   
   
   Public Shared Sub Main()
      
      ' The path to the certificate.
      Dim Certificate As String = "Certificate.cer"
      
      ' Load the certificate into an X509Certificate object.
      Dim cert As X509Certificate = X509Certificate.CreateFromCertFile(Certificate)
      
      ' Get the value.
      Dim resultsTrue As String = cert.ToString(True)
      
      ' Display the value to the console.
      Console.WriteLine(resultsTrue)
      
      ' Get the value.
      Dim resultsFalse As String = cert.ToString(False)
      
      ' Display the value to the console.
      Console.WriteLine(resultsFalse)
   End Sub  
End Class

Применяется к

ToString(Boolean)

Исходный код:
X509Certificate.cs
Исходный код:
X509Certificate.cs
Исходный код:
X509Certificate.cs
Исходный код:
X509Certificate.cs
Исходный код:
X509Certificate.cs

Возвращает строковое представление текущего X509Certificate объекта с дополнительными сведениями, если они указаны.

public:
 virtual System::String ^ ToString(bool fVerbose);
public virtual string ToString(bool fVerbose);
override this.ToString : bool -> string
Public Overridable Function ToString (fVerbose As Boolean) As String

Параметры

fVerbose
Boolean

true для создания подробной формы представления строки; falseв противном случае .

Возвращаемое значение

Строковое представление текущего X509Certificate объекта.

Примеры

В следующем примере метод используется ToString для отображения значения сертификата в консоли.

using System;
using System.Security.Cryptography.X509Certificates;

public class X509
{
    public static void Main()
    {
        // The path to the certificate.
        string Certificate =  "Certificate.cer";

        // Load the certificate into an X509Certificate object.
        X509Certificate cert = X509Certificate.CreateFromCertFile(Certificate);

        // Get the value.
        string resultsTrue = cert.ToString(true);

        // Display the value to the console.
        Console.WriteLine(resultsTrue);

        // Get the value.
        string resultsFalse = cert.ToString(false);

        // Display the value to the console.
        Console.WriteLine(resultsFalse);
    }
}
Imports System.Security.Cryptography.X509Certificates




Public Class X509
   
   
   Public Shared Sub Main()
      
      ' The path to the certificate.
      Dim Certificate As String = "Certificate.cer"
      
      ' Load the certificate into an X509Certificate object.
      Dim cert As X509Certificate = X509Certificate.CreateFromCertFile(Certificate)
      
      ' Get the value.
      Dim resultsTrue As String = cert.ToString(True)
      
      ' Display the value to the console.
      Console.WriteLine(resultsTrue)
      
      ' Get the value.
      Dim resultsFalse As String = cert.ToString(False)
      
      ' Display the value to the console.
      Console.WriteLine(resultsFalse)
   End Sub  
End Class

Применяется к