I have a project in which in the last update I decided to remove some functionality to see if that hinders the experience at all (The reason was to improve memory management and speed which it very much did).
But now I have the old functionality functions just sitting there in the code, they have 0 references so are not required at all to compile or run the application.

I am looking for a way to maybe mark them with an attribute or something of the sort, so they don’t compile and take unnecessary memory and resources, and so I don’t have to delete them or move them to another code-base in case I want to return the functionality the next update or whatever without the need to re-write all those functions.
Is there such a way to do this?

It’s called version control. Version control works better when it is when you revert to an entire version, which will undo other changes that I would’ve wanted to keep or require more advanced configuration and all of those.
I am looking for a simple decorative attribute, one line of code above the function that’ll do what I want.

You could use the Obsolete attribute but as others mentioned, you could just remove it. Being able to view history on various levels is really nice.
I thought about using Obsolete, but MSDN documentation only seems to mention IDE warnings when you use it, not whether it actually compiles or not…
You can wrap them in compiler directives. For example, #if DISABLED_CODE. Unless your build config specifically sets that directive, it won’t compile.
All that being said… yeah, it sounds like you should look into version control.

I have version control with GitHub and all that, it’s just a personal project that I don’t even distribute and I constantly making changes, I wanted something simple for this.

How do you use your suggestion? just #if DISABLED_CODE before the function and #endif after? and if so is that different in any way than just commenting on the function?
Why not just comment them out? If you don’t use them by the next update, delete them.

Just leave them there. Unless there are thousands of them, and they are huge, you won’t see a huge difference in size. You are literally using more “resources” by pulling in other libraries than leaving dead code. Methods compile into tens or hundreds of bytes.
C# devs
null reference exceptions

source