Я могу пропускать что-то, но разве Вы не могли сделать оператора переключения на типе вместо Строки? Таким образом,
switch(childNode.Type)
{
case Bob:
break;
case Jill:
break;
case Marko:
break;
}
I have the same kind of application that does multiple WMI queries on all different kinds of devices and I experience the same behavior. Using wbemtest is sometimes faster but not necessarily. I also find some queries on the same machine behave differently then other queries on the same machine simply because a different class is queries.
There is a ReturnImmediately property belonging to the EnumerationOptions class which might help you get the results faster if you get them in one batch instead of enumerating them over the network.
EnumerationOptions options = new EnumerationOptions();
options.ReturnImmediately = false;
You can try that and see if it helps. I know this is not what you want to hear but my personal opinion is that there is not much you can do. You need to write code to work arround the issue. The real answer lies somewhere deep burried in the bowls of DCOM, the WMI protocol and the WMI repository.
Проблема связана с одним ящиком? Однажды у меня была такая же проблема со сценарием удаленного взаимодействия. Я исправил это, перестроив стек TCP / IP на устройстве, выполняющем удаленный вызов.
Вы можете попробовать установить поле WITHIN , чтобы увидеть, заставит ли это запрос выполняться раньше. Не могли бы вы опубликовать запрос, который используете? Это может помочь отладить дальнейшие проблемы