This is not supported. You can't access private methods in C# or VB.NET either, so why should Python.NET be able to access them? But one thing to note is that you CAN access protected methods directly in Pyhon.NET (you don't have to make a subclass to use a protected method).

- Feihong

alex omoto <lance23runner@yahoo.com> wrote:
Hi,

I am having trouble using Python.NET in accessing class interface methods that are declared private.  As an example,

Public Interface Iface
    Property Func() As Boolean
End Interface

Public Class Foo
    Implements Iface

    Private Function Func() As Boolean
        Return True
    End Function

    Public ReadOnly Property IFACE() As Iface
        Get
            Return Me
        End Get
    End Property
End Class

Then using Python 2.5 with Python.Net 2.0 alpha 2,  I cannot access the method.  Is this supported?

import clr
import Foo
f = Foo()
f.IFACE              # OK
f.IFACE.Func()    # results in Attribute error


Thanks,
Alex

Never miss a thing. Make Yahoo your homepage. _________________________________________________
Python.NET mailing list - PythonDotNet@python.org
http://mail.python.org/mailman/listinfo/pythondotnet


Looking for last minute shopping deals? Find them fast with Yahoo! Search.