Main Site Documentation

How to work around ambiguity?


#1

Hi all,

Is there an easy way to set the compiler to use a specific name space for situations when you have abiguity errors?

I am getting the error because there is a GHIElectronics.NETMF.Glide.UI.Button and Microsoft.SPOT.Hardware.Button

I need both of these as I am using functions from each.

Right now I have used the full qualifier but surely there is a better way than this?

Cheers
Dave…


#2

Use class aliases

using GlideButton = GHIElectronics.NETMF.Glide.UI.Button;
using HardwareButton = Microsoft.SPOT.Hardware.Button;

#3

Nice one! Thanks.

I am still fairly new to C# so little tricks like this are still out there to be found.

Cheers, you have just saved from heaps of exra typing.
Dave…


#4

Glad to help