Intellisense on custom types in Iron Python

Posted by Anish Patel on Stack Overflow See other posts from Stack Overflow or by Anish Patel
Published on 2010-05-05T10:11:52Z Indexed on 2010/05/05 16:58 UTC
Read the original article Hit count: 281

Filed under:
|
|
|

Hi everybody,

I'm just starting to play around with IronPython and am having a hard time using it with custom types created in C#. I can get IronPython to load in assemblies from C# classes, but I'm struggling without the help of intellisense. If I have a class in C# as defined below, how can I make it so that IronPython will be able to see the methods/properties that are available in it?

public class Person
{
    public string Name { get; set; }
    public int Age{ get; set; }
    public double Weight{ get; set; }
    public double Height { get; set; }

    public double CalculateBMI()
    {
        return Weight/Math.Pow(Height, 2);
    }
}

In Iron python I'd instance a Person object as follows:

newPerson = Person()
newPerson.Name = 'John'
newPerson.Age = 25
newPerson.Weight = 75
newPerson.Height = 1.70
newPerson.CalculateBMI()

The thing that is annoying me is that I want to be able to say

newPerson = Person()

And then be able to see all the methods and properties associated with the person object whenever I type:

newPerson.

Anyone have any ideas if this can be done?

© Stack Overflow or respective owner

Related posts about ironpython

Related posts about python