Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get fast instance number of given controlname
#2
The code is good, and I can't make it better or faster.
The foreach part can be slightly shorter.
 
Code:
Copy      Help
    int i=1;
    foreach (var item in w.ChildAll(cn: ctrlName)) {
        print.it($"item={item}");
        if (c == item)
            break;
        else
            i++;
    }

or
Code:
Copy      Help
    int i = Array.IndexOf(w.ChildAll(cn: ctrlName), c) + 1;


Messages In This Thread
RE: How to get fast instance number of given controlname - by Gintaras - 02-16-2024, 06:33 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)