I am using an assembly that has an class like:
[SerializableAttribute] public class MetaDataDataCollection : CollectionBase
I have an instance of this class (retrieved via another method) but I cannot seem to call the Count method on this class or the List method (I just need the contents of this class). Any pointers on how I can get the information stored in the CollectionBase?
The CollectionBase List method is documented here: http://msdn.microsoft.com/en-us/library/system.collections.collectionbase.list.aspx It returns an IList.
function _WriteEventMetadataTree(eventMetadata, depth)
for(i = 1; i lte ArrayLen(eventMetadata); i = i + 1)
metadata = eventMetadata[i];
for(j = 1; j lte depth; j = j + 1)
metadataChildren = metadata.Get_Children(); // <-- This method returns a MetaDataDataCollection object
_WriteEventMetadataTree(metadataChildren.Get_List(), depth + 2);
<cfset a = WriteEventMetadataTree(eventMetadata) />
The Get_List method was not found.
Either there are no methods with the specified method name and argument types or the Get_List method is overloaded with argument types that ColdFusion cannot decipher reliably. ColdFusion found 0 methods that match the provided arguments. If this is a Java object and you verified that the method exists, use the javacast function to reduce ambiguity.
The error occurred in C:\inetpub\wwwroot\test.cfm: line 195
Called from C:\inetpub\wwwroot\test.cfm: line 175
Called from C:\inetpub\wwwroot\test.cfm: line 200
194 : metadataChildren = metadata.Get_Children();
195 : _WriteEventMetadataTree(metadataChildren.Get_List(), depth + 2);
196 : }
197 : }
It do not see a call to CollectionBase.Count in the code. The error seems to be coming from CollectionBase.List. The API says that property is "protected". So you cannot access it. Try using Get_Count() instead.
For whatever reason I was trying to call metadata.Get_Count() instead of metadataChildren.GetCount() when I tested it earlier. Thanks for the help!
Ahh, glad you figured it out!