Casting and iteration in object of type object

  • Thread starter Thread starter eliassal
  • Start date Start date
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
 
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);
 
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);
 
Back
Top