When to use [Obsolete] or simply delete the code? [closed] - c#

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I am curious when there is a correct time to use the attribute [Obsolete] and the time to just delete the code. Is this something that should be considered in certain patterns like Factory vs Builder? Thanks!

You should use it in situations where there is code that is not under your control that consumes your class and you want to make a public API change and discourage or block future usage of the old API method/property without breaking binary compatability.

Related

C#: Singleton using a Singleton [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I have a curious question here. Is it wise to have a singleton class use or call another singleton class? The project the i'm currently working does this a quite a bit. The good and bad tidbits of this convention would be most helpful.
There is no point about it. Each singelton stands for itself and call the other or not. It's not good or bad.
It depens on your goal, if the singeltons themself are a good decission.

What is the naming convention for AutoResetEvent objects? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
What is the naming convention for AutoResetEvents so that
A programmer intuitively knows that it is an AutoResetEvent
A programmer knows specifically what it is for
Say I have a method to refresh things which can only be called by one thread at a time
I find something like "resfreshThingAutoResetEvent" to be cumbersome, but it is the only way I can think to name it so that it meets the goals above.

Use Cases for DebuggerStepThroughAttribute [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Question is pretty straight forward. Are there any valid use cases for the DebuggerStepThroughAttribute? Valid in the sense that they'd be used in a development environment.
Losing 4 solid hours, only to find this attribute decorated on a class is rather disheartening.
I have used it when developing framework code, when the source code to the framework is in the same solution as the main application.
Basically when done with the framework code, I tag the appropriate classes or methods, so that if I, as an example, step over a method call up in the application code, it will not suddenly dive into tons of framework code before resurfacing in the application code somewhere else.
Makes it easier to debug the application.

Dynamically form generation vs adding new class [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
There are two ways to create a form in c# application:
Add a new class describing form elements and behavior
Generate it all dynamically.
Q : What are the advantages of the second method?
Which can give more performance or reduce memory using and how about scalability?
Static UI should be your first choice. Dynamic UI is an option to consider, but only if you have a compelling reason. If you don't have a concrete reason to look for dynamic UI, and just have a vague feeling that one might be better then the other, then stick to static UI.

Why anonymous classes aren't included in languages such as C# and Dart? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I write a lot of code in Java, and always use anonymous classes. They allows you write concise code without boilerplate.
However, many modern languages, like C# and Dart don't include them. Why they aren't included there? What's so bad about them? Are there any blog post or articles where languages' where authors describe why they excluded them from these languages?

Categories