Read data with parameter case insensitive API Mikrotik tik4net

604 Views Asked by At

I have a problem with the Mikrotik API in C#. I locate a logged user on hot spot with this code:

connection.LoadSingleOrDefault<HotspotActive>(connection.CreateParameter("user", *MyUserName*));

It works on a case-sensitive basis. How can I make the code case-insensitive?

1

There are 1 best solutions below

0
On

Case=sensitivity is the same as with pure Mikrotik API (there is no option to workaround it). In this case (expected limited number of hotspot active users) you can load all users and filter them via a LINQ expression in C#.

connection.LoadAll<HotspotActive>()
            .SingleOrDefault(ha => string.Equals(ha.UserName, "*MyUserName*", StringComparison.CurrentCultureIgnoreCase));