Ben Mills
Ben Mills

Reputation: 28584

Is it bad to create and use custom Deprecated and NeedsWork C# attributes?

I want to mark many of my C# functions as "deprecated" or "needs work". My plan is to create customer attributes that I use to tag the functions. I saw this question which seems to indicate that information only attributes will not effect performance:

Is this use of attributes in .Net (C#) expensive?

My question is whether this is a bad use for attributes. Is there better way to mark code so that I can come back in phase 2 and either eliminate the code or rework it in some way?

P.S. I realize that there is an Obsolete attribute, but it results in far too many compiler warnings. I want to be able to see the "real" compiler warnings.

Upvotes: 0

Views: 162

Answers (2)

Anastasiosyal
Anastasiosyal

Reputation: 6626

This feels like you want to create some sort of Project Management attributes for your classes.

I see project management as different than your code. If a feature is not 'done' right the first time, chances are it will be burried under other priorities and 'good enough' will cut it.

Of course there is always the Task list comments just add // TODO: and you will get it in your task list editor in visual studio if you do need reminders in your code.

I wouldn't go so far as to decorate classes with 'needfixing' attributes. If it's done it's done, if it's not it's not, if you need a reminder a todo should be enough.

Upvotes: 4

Matt T
Matt T

Reputation: 511

I won't say that it's "bad" to mark code that needs work with attributes, but it may be overkill. Have you considered XML comments?

Upvotes: 2

Related Questions