0

When using the Excel interop with C#, it is advised that you never use "two dots" on one object. How do I avoid doing that when trying to use one of the built in enum types such as would happen when I want to change the axis limits of a chart:

Excel.Axis ax = chart.Axes(Excel.XlAxisType.xlValue);

note I have declared

using Excel = Microsoft.Office.Interop.Excel;

So my question is how do I write Excel.XlAxisType.xlValue with out using two dots?

Community
  • 1
  • 1
Dan
  • 45,079
  • 17
  • 88
  • 157
  • 3
    You don't have to worry about that. An enum defined under the library's scope is not the same as the `Worksheets` issue from the question you've linked. I doubt an enum has anything to do with COM objects, but rather is just mapped to appropriate values within the language. – SimpleVar Jun 23 '16 at 16:26
  • I agree with @SimpleVar. You can test this by using the integer equivalent of the enum value in place of the enum. In the case you show, use 2 instead of `Excel.XlAsixType.xlValue` and it should work just the same. – Cindy Meister Jun 23 '16 at 16:32
  • @SimpleVar thanks, I was hoping that would be the case – Dan Jun 24 '16 at 07:18

0 Answers0