Using alias directive hides system types

The free CAN Software API (Application Programming Interface) for Windows®
Post Reply
User avatar
Kamen
Posts: 11
Joined: Thu 7. Mar 2019, 02:08

Using alias directive hides system types

Post by Kamen » Sat 9. Mar 2019, 03:49

I want to point out that the C# part of the API employs using alias directives to define aliases to support PEAK-specific naming conventions and in the process ends up hiding system types in Intellisense QuickInfo.

For instance, in the PCANBasic.cs file, there is this directive:

Code: Select all

using TPCANBitrateFD = System.String;
In order to use the various aliased constants, it is necessary to add the directive to alias the Peak.Can.Basic namespace to all my code that deals with PCAN, or be forced to fully qualify every single reference. When you do that, every instance of the aliased type is replaced, accordingly:
Untitled.png
Untitled.png (12.61 KiB) Viewed 2590 times
In this case, the "string" type is being replaced by "TPCANBitrateFD". I don't know what other issues may be related to it, but I thought I'd bring this up to your attention. I can't help but think that there is a better way to do that.

Kamen
SAKOR Technologies, Inc.

K.Wolf
Software Development
Software Development
Posts: 141
Joined: Wed 22. Sep 2010, 15:37

Re: Using alias directive hides system types

Post by K.Wolf » Tue 12. Mar 2019, 07:48

Thank you for bringing this to our attention.
Using the aliases of course is not mandatory, and if you do not, no other issues will arise.
It is only a code example. Feel free to improve the source code in any way you want.

Post Reply