checking that an object exists 2005-04-07 - By Jerry Gamache
Back I have seen that question before. Here is the answer:
Function ObjectExist( in_fullname ) set oCI = CreateObject("XSI.CollectionItem") oCI.value = in_fullname ObjectExist = (StrComp(oCI.value, in_fullname,VBTextCompare) = 0) End Function
-- --Original Message-- -- From: owner-xsi@(protected) [mailto:owner-xsi@(protected)]On Behalf Of Brad Friedman Posted At: Thursday, April 07, 2005 2:33 PM Posted To: xsi Conversation: checking that an object exists Subject: checking that an object exists
Hi,
I got an interesting question from someone, that I wanted to check out with you all.
Given an object's full name, he wants to check if it exists.
So there are two ways to do it.
Via command: GetValue()
Via object model: Dictionary.GetObject()
now here's the question:
Both of these solutions throw an exception if the given object does not exist. While you can catch the exception, I'd think this is a poor way to go about solving the problem. Exceptions should not be used for flow control. They're inherently slow (or so I've been taught time and time again). Is there a better fast way to check if an object exists from its full name that doesn't involve depending on exceptions? I can come up with some ways of doing it that will be inherently slow... but none that are fast.
-brad --- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
--- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
|
|