Skip to main content
Added the "Update after the comments" note
Source Link
Flydog57
  • 7.1k
  • 12
  • 11

Take a look at C# get the name of a method that called another one [duplicate]. It was closed with 4 suggested links. The youngest of those is 8 years old. The obvious answers (accepted or highly voted) all point out that the way to do what the OP is asking is to walk up the stack using the facilities in System.Diagnostics.

In the second of those suggested links, the accepted answer (429 votes) includes this note at the end:

UPDATE Two years later since I'm still getting upvotes on this

In .Net 4.5 there is now a much easier way to do this. You can take advantage of the CallerMemberNameAttribute

In a couple of the other questions, there are later answers that point out that CallerMemberNameAttribute is the way to go. But they generally are getting single digit votes - the kind of answers that tend to be ignored.

The question I'm referring to is closed. I added comments pointing out the modern way to do this. How should this be handled?

Update (after reading the comments and the answer)

Perhaps the solution is to add a box (similar to the closed box) that says something like:

A Newer Answer May Suit Your Needs Better

Since this question was asked and answered, the underlying technology has been changed/advanced. Consider these answers as well as those posted below.

In the case of the example I show above, the original answers may be appropriate for some users. For most, I suspect the more modern approach is a better solution. This would need to be presented as an either/or, not as a "deprecated" thing.

Of course, the problem is "how to manage this". Perhaps with rules similar to close voting. I'm not sure.

Take a look at C# get the name of a method that called another one [duplicate]. It was closed with 4 suggested links. The youngest of those is 8 years old. The obvious answers (accepted or highly voted) all point out that the way to do what the OP is asking is to walk up the stack using the facilities in System.Diagnostics.

In the second of those suggested links, the accepted answer (429 votes) includes this note at the end:

UPDATE Two years later since I'm still getting upvotes on this

In .Net 4.5 there is now a much easier way to do this. You can take advantage of the CallerMemberNameAttribute

In a couple of the other questions, there are later answers that point out that CallerMemberNameAttribute is the way to go. But they generally are getting single digit votes - the kind of answers that tend to be ignored.

The question I'm referring to is closed. I added comments pointing out the modern way to do this. How should this be handled?

Take a look at C# get the name of a method that called another one [duplicate]. It was closed with 4 suggested links. The youngest of those is 8 years old. The obvious answers (accepted or highly voted) all point out that the way to do what the OP is asking is to walk up the stack using the facilities in System.Diagnostics.

In the second of those suggested links, the accepted answer (429 votes) includes this note at the end:

UPDATE Two years later since I'm still getting upvotes on this

In .Net 4.5 there is now a much easier way to do this. You can take advantage of the CallerMemberNameAttribute

In a couple of the other questions, there are later answers that point out that CallerMemberNameAttribute is the way to go. But they generally are getting single digit votes - the kind of answers that tend to be ignored.

The question I'm referring to is closed. I added comments pointing out the modern way to do this. How should this be handled?

Update (after reading the comments and the answer)

Perhaps the solution is to add a box (similar to the closed box) that says something like:

A Newer Answer May Suit Your Needs Better

Since this question was asked and answered, the underlying technology has been changed/advanced. Consider these answers as well as those posted below.

In the case of the example I show above, the original answers may be appropriate for some users. For most, I suspect the more modern approach is a better solution. This would need to be presented as an either/or, not as a "deprecated" thing.

Of course, the problem is "how to manage this". Perhaps with rules similar to close voting. I'm not sure.

edited tags
Link
1201ProgramAlarm
  • 32.7k
  • 1
  • 19
  • 32
edited title
Link
Sabito
  • 5k
  • 1
  • 17
  • 40

Speaking of Outdated answers: What doto do with a closed question where all the suggestions are outdated

Became Hot Meta Post
Source Link
Flydog57
  • 7.1k
  • 12
  • 11
Loading