[IronPython] DocString for properties

Steve Baer steve at mcneel.com
Thu Mar 4 04:34:29 CET 2010


That works great! Thanks Dino.
-Steve

--------------------------------------------------
From: "Dino Viehland" <dinov at microsoft.com>
Sent: Wednesday, March 03, 2010 7:27 PM
To: "Discussion of IronPython" <users at lists.ironpython.com>
Subject: Re: [IronPython] DocString for properties

> Steve wote:
>> Hi guys,
>> I've been struggling with getting at the documentation string for a
>> static
>> property defined in one of my C# classes from IronPython.
>>
>> Say my C# class had a public static property that returned an int.
>> public class MyClass
>> {
>>   ///<summary>My property summary</summary>
>>   public static int MyProperty{ get{return 1;} }
>> }
>>
>> If I use the following python script to call help, I get help
>> information on
>> the int data type (I can understand why this is happening).
>>
>> help( MyLib.MyClass.MyProperty )
>
> You'll need to go into the type's dictionary and pull out the actual
> descriptor object and access the __doc__ attribute from there.  For
> example:
>
>>>> import System
>>>> print System.Environment.__dict__['CurrentDirectory'].__doc__
>
>                    Gets or sets the fully qualified path of the current 
> working
> directory.
>
>
> Get: CurrentDirectory() -> str
> Set: CurrentDirectory() = value
>
>>>>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> 




More information about the Ironpython-users mailing list