Please forgive me if this is a simple question -- I'm pretty new to C#.
Here's a quick code snippet that tries to take advantage of the ClearQuest API:
ClearQuestOleServer.SessionClass cqSession = new ClearQuestOleServer.SessionClass();
cqSession.UserLogon(login, password, dbName, (int)ClearQuestConstants.SessionType.AD_PRIVATE_SESSION, "");
object cqEntities = cqSession.GetEntityDefNames();
Now, when I run through this in the debugger and watch cqEntities, I can see that it's an array of strings (the "Type" field even claims that it's an "object {object[]}" type, with each item within it an "object {string}" type), but C# won't let me cast cqEntities as a string[], nor will it let me use cqEntities in a foreach (since it's not enumerable). What can I do to get at the stringy contents?
Thanks for any help you can offer!

Kirtan PatelRank #292 · 8.6K reputationPosted Dec 17, 2009, 7:38 AM EST
object[] cqEntities = cqSession.GetEntityDefNames();
OR Try Casting Like below
string[] cqEntities = (string[])cqSession.GetEntityDefNames();
then you can iterate through foreach loop .
if my answer helps you then check "Do you like this answer" check box please it helps me :)
Matt Funke3 reputationPosted Dec 17, 2009, 9:00 AM EST
Thanks for your help!