dotnet / dotnet/dotnet-api-docs

XmlWriter.WriteStartElement isn't virtual

Open
#9,576 3 comments 0 reactions 0 assignees View on GitHub
area-System.Xml Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

### Description

The single and 2 parameter versions of WriteStartElement [in the docs state](https://learn.microsoft.com/en-us/dotnet/api/system.xml.xmlwriter.writestartelement?view=net-8.0#system-xml-xmlwriter-writestartelement(system-string)):

> When overridden in a derived class, writes out a start tag with the specified local name.

However, they aren't marked virtual like the 3 parameter version.

Seems like this is an oversight and they should be overridable as well?

### Reproduction Steps

```cs
public class MyXmlWriter : XmlWriter
{
public override void WriteStartElement(string localName) // Error
{
}
}
```

### Expected behavior

Able to override method.

### Actual behavior

CS0506 error.

### Regression?

_No response_

### Known Workarounds

🤷‍♂️

### Configuration

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.