Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a property in .NET Type, which is actually a generic list of objects. When I try access the property using numeric index e.g. 10, this works. However when I iterate through indices using indexer such as i, then I get error "NET::nofield: No public field or property named i exists for the .NET type ..."

How to resolve this?

share|improve this question
    
Could you please share your Mathematica code that is causing the error? –  rhermans Apr 1 at 15:04

1 Answer 1

up vote 0 down vote accepted

I figured it out, I need to use Item indexer, but item index starts from 0, not 1:

If you write a class in C# and give it an indexer, the compiler creates a public property named Item for you. This is a parameterized property, meaning that it takes an argument like a method call. The indexer syntax is just a shorthand for calling the Item property.

See

http://reference.wolfram.com/mathematica/NETLink/tutorial/CallingNETFromMathematica.html#24524

share|improve this answer
1  
It would be great if you could add some simple example code to this answer. It will make it more useful for anyone else facing the same problem who finds this Q&A. –  Simon Woods Apr 1 at 15:56
    
i added more details and direct link –  denfromufa Apr 20 at 4:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.