I'm having trouble testing a custom object. I've tried many different
approaches. One is shown below.
The XML below shows the state of the object and I'm trying to test for that
state, ie there are NO classes in the Classes collection (Classes) of the
custom object.
The conditional expression returns the error shown below it...
=============== =============== =============== ==========XML returned by
Custom Object
<ArrayOfTeacher s xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema">
<Teacher Id="1" Name="Bob" >
<Classes />
</Teacher>
</ArrayOfTeachers >
=============== =============== =============== ==========Condi tional Expression
if (Profile.Teache rs[0].Classes[0] == null) // fails
=============== =============== =============== ========== Error message
Index was out of range. Must be non-negative and less than the size of the
collection.
Parameter name: index
Source Error:
Line 277: get
Line 278: {
Line 279: return (Class)List[index];
Line 280: }
Line 281: }
Any ideas on how to test for No Classes in the Class collection? I can post
the custom object if that would help.
Thanks,
Paul
approaches. One is shown below.
The XML below shows the state of the object and I'm trying to test for that
state, ie there are NO classes in the Classes collection (Classes) of the
custom object.
The conditional expression returns the error shown below it...
=============== =============== =============== ==========XML returned by
Custom Object
<ArrayOfTeacher s xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema">
<Teacher Id="1" Name="Bob" >
<Classes />
</Teacher>
</ArrayOfTeachers >
=============== =============== =============== ==========Condi tional Expression
if (Profile.Teache rs[0].Classes[0] == null) // fails
=============== =============== =============== ========== Error message
Index was out of range. Must be non-negative and less than the size of the
collection.
Parameter name: index
Source Error:
Line 277: get
Line 278: {
Line 279: return (Class)List[index];
Line 280: }
Line 281: }
Any ideas on how to test for No Classes in the Class collection? I can post
the custom object if that would help.
Thanks,
Paul
Comment