That is turning my words around to make it bad.
>> CType() is faster than TryCast(), while completely ignoring the fact that
>> ignoring the fact that CType() cannot be used without also calling GetType()
>> and Equals() or (more correctly) IsAssignableFrom
And TryCast don't need that, wow, it does then magic things? Come on!
Additionally: I only run CType when I already know from GetType that is can be casted. Your code used TryCast for every ObjectID in the loop while I only use GetType.
But right, let us not waste time as you code is correct, as Gile's code is correct and as my revsed code is correct, but it is not like you want to write and so it has to be wrong.
You are right that my first attemt with twice calling trans.GetObject is not ok. And all after that hangs up on this first mistake.
I wish you never ever make a mistake and you're correction is then ignored as mine are.
At least for everyone: My apologizes, my first attempt needed two times GetObject (in case of it's the searched type) to get the accessable AttributeDefinition.
>> so I'm not going to waste time debating that with you.
Dicuss or debate, I tried to dicuss, yep, I never tried to push that up how it is now.
I always want to learn something, but with that hardness of reaction it is hard.
At least yes, time to stop.
To the story from Jeff,
...please don't forget the option, that one of your XTypes takes the parcel, brings it to the customer and has to bring it back as it's the wrong type
To Jeff's code a short comment,
If "btr" is a BlockTableRecord, then I guess he wanted to check for AttributeDefinition and not AttributeReferences and he works with latebinding, so the assignment from type DbObject to a Type derived from DbObject (AttributeReference in his code) is possible without (any type of) casting.
Interestingly I also wrote AttribtueReferences instead of ...Defintions first
I'm out then as this seems to not make sense any more and also does not include the fun like help anyone in forums should make. Very sorry, - alfred -