Reputation: 21
In a lot of autogenerated code in Java, the common practice is to preface the name of variables that could potentially clash with user variables with a dollar sign. By convention, manually written code doesn't use dollar signs. However, in C# that character isn't valid in identifiers. Is there a standard practice for naming generated identifiers? I'm currently prefixing them with a double-underscore, which I believe is often used in C.
Sometimes you want to generate a superclass with certain functionality, and allow the subclass to wrap it up in a neat package. That's when this would apply.
Upvotes: 2
Views: 536
Reputation: 258208
I'm not sure what the standard convention is in this case, but since C# accepts Unicode characters in identifers, you could just pick a few arbitrary Unicode characters to virtually guarantee that no names will clash.
What are the odds of any variable starting with ꉜꈅ⣎, for instance?
Upvotes: 2