How to import class outside namespace? #1699
Answered
by
cross-hello
cross-hello
asked this question in
Q&A
Environment
Details
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Linq;
using System.Collections.Generic;
public class t
{
public void p()
{
Console.WriteLine("Welcome come to here");
}
}How could I import t class? |
Answered by
cross-hello
Mar 11, 2022
Replies: 2 comments 1 reply
|
Ok, thanks God. I got out the solution: >>> import clr
>>> clr.AddReference(r'bin/Debug/ClassLibrary1')
>>>dir(clr)
['AddReference', 'ClassLibrary1', 'ClrLoader', 'FindAssembly', 'GetClrType', 'ListAssemblies', 'Microsoft', 'Python', 'System', '__class__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '__version__', '_add_pending_namespaces', '_available_namespaces', '_extras', '_load_clr_module', 'clrmethod', 'clrproperty', 'getPreload', 'loader', 'setPreload', 't']Now you could see that t is listed inside clr element. So you could reference t in global namespace as this: |
1 reply
Answer selected by
cross-hello
|
Thanks God.
May 25, 2022 19:42:31 Ross ***@***.***>:
… Just wanted to say thanks for posting the answer to your question. This was not something I would ever have thought to try.
—
Reply to this email directly, view it on GitHub[#1699 (reply in thread)], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AKGBAYFOLKGRHZDWT6TIOA3VLYG2NANCNFSM5QOYXN7A].
You are receiving this because you authored the thread. [data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAArSURBVHic7cEBDQAAAMKg909tDjegAAAAAAAAAAAAAAAAAAAAAAAAAAA+DFFIAAEctgHwAAAAAElFTkSuQmCC###24x24:true###][Tracking image][https://github.com/notifications/beacon/AKGBAYGSIHX6MMXMTJHCMJTVLYG2NA5CNFSM5QOYXN7KYY3PNVWWK3TUL52HS4DFWFCGS43DOVZXG2LPNZBW63LNMVXHJKTDN5WW2ZLOORPWSZGOAAVQKWA.gif]Message ID: ***@***.***>
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok, thanks God. I got out the solution:
Now you could see that t is listed inside clr element. So you could reference t in global namespace as this:
clr.tThat is all. Thank you.