Is XmlReader.ReadString deprecated or obsoleted?


I'm wanting to use System.Xml.XmlReader.ReadString(), but I noticed it doesn't show up in Intellisense because the function is decorated with [EditorBrowsable(EditorBrowsableState.Never)]. Despite not being marked as [Obsolete], I assume Microsoft doesn't want me to use it.

I can't find any mention of this on MSDN. What should I be using instead? In ILSpy I see ReadElementContentAsString() and ReadContentAsString(). Is this what I want to use instead? I am using .Net 4.5.

In case it's relevant, this question was prompted by this answer: <a href="https://stackoverflow.com/a/625463/47589" rel="nofollow">https://stackoverflow.com/a/625463/47589</a>


It <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.readstring%28v=vs.110%29.aspx" rel="nofollow">isn't deprecated</a>. I think your reasoning is correct. The framework developers likely marked it as [EditorBrowsable(EditorBrowsableState.Never)] so that it doesn't show up in intellisense, and "nudges" you to use a better alternative, which maybe ReadContentAsString.

According to <a href="http://books.google.com/books?id=_Y0rWd-Q2xkC&pg=PA402&lpg=PA402&dq=ReadContentAsString%20vs%20readstring&source=bl&ots=R8ICV7SKZm&sig=XiF56nIeHGNPnXj85lrbvcO4nZ0&hl=en&sa=X&ei=PGLYUr65Kc_6oATk6YDABA&ved=0CEEQ6AEwBQ#v=onepage&q&f=false" rel="nofollow">C# In a Nutshell</a>.


ReadString and ReadElementString behave like ReadContentAsString and ReadElementContentAsString, except that they throw an Exception if there's more than a <em>single</em> text node within the element. In general, these methods should be avoided, as they throw an exception if an element contains a comment.


Maybe that's why you are seeing ReadContentAsString in the IL, because the framework is internally converting all calls to ReadString to ReadContentAsString and the Framework developers intentionally hid ReadString from the intellisense.

See related : <a href="http://nicksnettravels.builttoroam.com/post/2010/08/08/SystemComponentModelEditorBrowsable-was-written-by-idiots.aspx" rel="nofollow">System.ComponentModel.EditorBrowsable was written by idiots</a>


  • Google Play Console: Package name of your Instant App APKs should be the same as your app's pac
  • How to create a Json object in Asp.net mvc 3 controller?
  • Adding predefined item to a ComboBox with ItemsSource
  • How to find the closest (x, y) position to (x,y) position in another list?
  • Cookies getting ignored in Apache httpclient 4.4
  • DragDrop-Support of PictureBox-Control
  • How does MemberWiseClone create a new object with the cloned properties?
  • Change file creation time on compact framework
  • System.IO.Directory.GetFiles. No definition for GetFiles?
  • Reduce Mono runtime size
  • How to add a “using” statement to the System.Data.Entity namespace [closed]
  • HTML.DropDownListFor class assignment
  • Changing the WPF DatePicker Year/Month header area background color
  • C# Application Relative Paths
  • Change behaviour of Print button in ReportViewer C#
  • Easy Way to Get Averages Based on Names in List
  • How do I know what reference to include to import a specific .NET namespace?
  • Error Installing Windows 10 development tools for Visual Studio 2015 RC on Windows 8.1
  • How to add System.Windows dll to Visual Studio 2010 express?
  • How to set download location via chrome api
  • Tools for understanding HTML layout
  • What is corresponding c++ data type to SQL numeric(18,0) data type?
  • Compress a file with GZipStream while maintaining its meta-data
  • Getting different value with placeholder over CPU/GPU
  • hide missing dates from x-axis ggplot2
  • Enabling DTD support in Sql Server
  • UWP/C# - Issue with AQS and USB Devices
  • Do I need to seed any random number generator before using EVP_PKEY_keygen of OpenSSL?
  • Thread safety of a fluent like class using clone() and non final fields
  • Retrieving value from sql ExecuteScalar()
  • Why ng-show works with ng-repeat but ng-if doesn't? [duplicate]
  • Get object from AWS S3 as a stream
  • Cross-Platform Protobuf Serialization
  • Validaiting emails with Net.Mail MailAddress
  • Do I've to free mysql result after storing it?
  • Acquiring multiple attributes from .xml file in c#
  • How can I remove ASP.NET Designer.cs files?
  • python draw pie shapes with colour filled
  • Is there any way to bind data to data.frame by some index?
  • How can i traverse a binary tree from right to left in java?