views:

222

answers:

1

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?

+2  A: 

If you want to do it from an editor/IDE, IronPython Tools for Visual Studio has that capability (and much more). If you don't have VS 2010 Pro, you can install it into the Integrated Shell.

If you want to do it from the console, I don't believe that it's possible yet.

Jeff Hardy