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
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>Answer1:
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
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>.<blockquote>
ReadElementString behave like
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
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>