Sreedhar
Sreedhar

Reputation: 30045

Usage of Obsolete class

We were using class 'System.Xml.Xsl.XslTransform' in our project and now recently we started using resharper. This throw waring Class 'System.Xml.Xsl.XslTransform' is obsolete: "This class has been deprecated. Please use System.Xml.Xsl.XslCompiledTransform instead. http://go.microsoft.com/fwlink/?linkid=14202"

Is it good to update the code to new class or keep the existing as the system performs well.

Is there any disadvantages with this approach.

Upvotes: 3

Views: 701

Answers (3)

user2341923
user2341923

Reputation: 4727

You can use XslCompiledTransform class instead which is valid in .Net 4.6, e.g.:

var xsltCompiled = new System.Xml.Xsl.XslCompiledTransform(enableDebug:true);
xsltCompiled.Load(stylesheetUri:xsltFile);
xsltCompiled.Transform(inputUri:xmlInputFile,resultsFile:anyOutputFile);

Upvotes: 0

dahlbyk
dahlbyk

Reputation: 77540

Warnings are just that - not an error, but something you should be aware of. If the code performs well enough now, feel free to leave it as is. Just know that the API may disappear in the future so you'll have to deal with it eventually if you upgrade.

Upvotes: 3

Riz
Riz

Reputation: 6982

Is good to update and don't use deprecated classes as it will go away in upcoming versions and you will have no choice but to update your code. So sooner to update is better.

Upvotes: 1

Related Questions