Casting and iteration in object of type object

E

eliassal

Hi I have a function in a dll that returns an object which I need to get
somes items as follows

public object[] CreateFacts(RuleSetInfo ruleSetInfo)
{
XmlDocument doc = new XmlDocument();
//Loading the XML from xml file to be tested against rule.
doc.Load(@_xmlDocToBeused);
TypedXmlDocument txd = new TypedXmlDocument(_DocType, doc);

//Preeapre facts object
object[] facts = new object[1];
facts[0] = txd;

return facts;
}


In my app, I neeed to retrieve this 1st item, I am trying the following

object fact = fc.CreateFacts(RSSetInfo);

I need something like that

TypedXmlDocument test = fact[0];
but geting error indicating that "CAN NOT APPLY INDEXING WITH [0] to an
expression of type object

I tried several casting but it is not working

Thanks for your help
 
F

Family Tree Mike

Hi I have a function in a dll that returns an object which I need to get
somes items as follows

public object[] CreateFacts(RuleSetInfo ruleSetInfo)
{
XmlDocument doc = new XmlDocument();
//Loading the XML from xml file to be tested against rule.
doc.Load(@_xmlDocToBeused);
TypedXmlDocument txd = new TypedXmlDocument(_DocType, doc);

//Preeapre facts object
object[] facts = new object[1];
facts[0] = txd;

return facts;
}


In my app, I neeed to retrieve this 1st item, I am trying the following

object fact = fc.CreateFacts(RSSetInfo);

I need something like that

TypedXmlDocument test = fact[0];
but geting error indicating that "CAN NOT APPLY INDEXING WITH [0] to an
expression of type object

I tried several casting but it is not working

Thanks for your help

Try:

object [] fact = fc.CreateFacts(RSSetInfo);
 
E

eliassal

Thanks

Family Tree Mike said:
Hi I have a function in a dll that returns an object which I need to get
somes items as follows

public object[] CreateFacts(RuleSetInfo ruleSetInfo)
{
XmlDocument doc = new XmlDocument();
//Loading the XML from xml file to be tested against rule.
doc.Load(@_xmlDocToBeused);
TypedXmlDocument txd = new TypedXmlDocument(_DocType, doc);

//Preeapre facts object
object[] facts = new object[1];
facts[0] = txd;

return facts;
}


In my app, I neeed to retrieve this 1st item, I am trying the following

object fact = fc.CreateFacts(RSSetInfo);

I need something like that

TypedXmlDocument test = fact[0];
but geting error indicating that "CAN NOT APPLY INDEXING WITH [0] to an
expression of type object

I tried several casting but it is not working

Thanks for your help

Try:

object [] fact = fc.CreateFacts(RSSetInfo);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top