I'm using enums as column indexes for DataReader columns. The enums are defined in class Config and made available via usings. Example:
public enum CtCol { ct_id, ct_nr, ct_type, ct_version, ct_owner, ct_title }
using static DBF.Config.CtCol;
string title = reader.GetString((int)ct_title);
This works fine, and I'm using the enums regularly to specify the columns.
But when I set a breakpoint and want to see the expression result in the QuickWatch or in the Watch window I get:
error CS0103: The name 'ct_title' does not exist in the current context
When I replace ct_title
with 5
, I get the correct value in the Watch. So the debugger seems not to know the enums.
I'm using Visual Studio Community 2022 with C#.
Now I've found out that it works if I add the full reference reader.GetString((int)Config.CtCol.ct_title)
in the QuickWatch resp. Watch window.
The solution to solve the issue is to add the full reference reader.GetString((int)Config.CtCol.ct_title)
in the QuickWatch resp.