How to mark a method or class as Obsolete/Deprecated in C#?
Hello everyone. I'm a beginner C# developer writing a library for working with files. I have an old method `SaveToTxt()` that saves data to text format. I wrote a new, more advanced method `SaveToJson()`, and I want other developers to stop using the old one.
But I can't just delete `SaveToTxt()` — someone might already be using my library, and their code would break. I heard that in C# there is some mechanism to mark methods as "deprecated" so that the compiler gives a warning, but the code still works. How do I do this?
Here's an example of my old method:
```csharp
public class FileSaver
{
public void SaveToTxt(string path, string content)
{
// Old logic for saving to .txt
File.WriteAllText(path, content);
}
}
```