İngilizce dilinde oku

Aracılığıyla paylaş


XmlException Oluşturucular

Tanım

XmlException sınıfının yeni bir örneğini başlatır.

Aşırı Yüklemeler

XmlException()

XmlException sınıfının yeni bir örneğini başlatır.

XmlException(String)

Belirtilen hata iletisiyle sınıfının yeni bir örneğini XmlException başlatır.

XmlException(SerializationInfo, StreamingContext)
Geçersiz.

ve StreamingContext nesnelerindeki XmlException bilgileri kullanarak sınıfının yeni bir örneğini SerializationInfo başlatır.

XmlException(String, Exception)

XmlException sınıfının yeni bir örneğini başlatır.

XmlException(String, Exception, Int32, Int32)

Belirtilen ileti, iç özel durum, satır numarası ve satır konumu ile sınıfın XmlException yeni bir örneğini başlatır.

XmlException()

Kaynak:
XmlException.cs
Kaynak:
XmlException.cs
Kaynak:
XmlException.cs

XmlException sınıfının yeni bir örneğini başlatır.

C#
public XmlException ();

Açıklamalar

XmlException, XML işleme sırasında sorun oluşursa oluşan xml ile ilgili genel bir hatadır. Aşağıdaki örnek, kişiler> bitiş etiketi yanlış yazıldığından <bir XML özel durumu oluşturur:

C#
using System;
using System.Xml.Linq;

try
{
    XElement contacts = XElement.Parse(
        @"<Contacts>
            <Contact>
                <Name>Jim Wilson</Name>
            </Contact>
          </Contcts>");
    Console.WriteLine(contacts);
}
catch (System.Xml.XmlException e)
{
    Console.WriteLine(e.Message);
}

Şunlara uygulanır

.NET 9 ve diğer sürümler
Ürün Sürümler
.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.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

XmlException(String)

Kaynak:
XmlException.cs
Kaynak:
XmlException.cs
Kaynak:
XmlException.cs

Belirtilen hata iletisiyle sınıfının yeni bir örneğini XmlException başlatır.

C#
public XmlException (string message);
C#
public XmlException (string? message);

Parametreler

message
String

Hata açıklaması.

Şunlara uygulanır

.NET 9 ve diğer sürümler
Ürün Sürümler
.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.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

XmlException(SerializationInfo, StreamingContext)

Kaynak:
XmlException.cs
Kaynak:
XmlException.cs
Kaynak:
XmlException.cs

Dikkat

This API supports obsolete formatter-based serialization. It should not be called or extended by application code.

ve StreamingContext nesnelerindeki XmlException bilgileri kullanarak sınıfının yeni bir örneğini SerializationInfo başlatır.

C#
protected XmlException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
C#
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected XmlException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);

Parametreler

info
SerializationInfo

bir öğesinin SerializationInfo tüm özelliklerini XmlExceptioniçeren nesnesi.

context
StreamingContext

StreamingContext Bağlam bilgilerini içeren nesne.

Öznitelikler

Şunlara uygulanır

.NET 9 ve diğer sürümler
Ürün Sürümler (Kullanım dışı)
.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

XmlException(String, Exception)

Kaynak:
XmlException.cs
Kaynak:
XmlException.cs
Kaynak:
XmlException.cs

XmlException sınıfının yeni bir örneğini başlatır.

C#
public XmlException (string message, Exception innerException);
C#
public XmlException (string? message, Exception? innerException);

Parametreler

message
String

Hata koşulunun açıklaması.

innerException
Exception

Varsa Exception , öğesini fırlatan XmlException. Bu değer olabilir null.

Şunlara uygulanır

.NET 9 ve diğer sürümler
Ürün Sürümler
.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.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

XmlException(String, Exception, Int32, Int32)

Kaynak:
XmlException.cs
Kaynak:
XmlException.cs
Kaynak:
XmlException.cs

Belirtilen ileti, iç özel durum, satır numarası ve satır konumu ile sınıfın XmlException yeni bir örneğini başlatır.

C#
public XmlException (string message, Exception innerException, int lineNumber, int linePosition);
C#
public XmlException (string? message, Exception? innerException, int lineNumber, int linePosition);

Parametreler

message
String

Hata açıklaması.

innerException
Exception

Geçerli özel durumun nedeni olan özel durum. Bu değer olabilir null.

lineNumber
Int32

Hatanın nerede oluştuğunu gösteren satır numarası.

linePosition
Int32

Hatanın oluştuğu yeri gösteren satır konumu.

Şunlara uygulanır

.NET 9 ve diğer sürümler
Ürün Sürümler
.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.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0