Click here to Skip to main content
15,306,032 members
Home / Discussions / C#
   

C#

 
QuestionC# pass variable to console application Pin
classy_dog22-Sep-12 10:48
Memberclassy_dog22-Sep-12 10:48 
AnswerRe: C# pass variable to console application Pin
Wes Aday22-Sep-12 12:42
professionalWes Aday22-Sep-12 12:42 
QuestionHow to Use Array As Value Type Pin
mohammadkaab22-Sep-12 9:11
Membermohammadkaab22-Sep-12 9:11 
AnswerRe: How to Use Array As Value Type Pin
Dave Kreskowiak22-Sep-12 9:19
mveDave Kreskowiak22-Sep-12 9:19 
GeneralRe: How to Use Array As Value Type Pin
mohammadkaab22-Sep-12 10:24
Membermohammadkaab22-Sep-12 10:24 
GeneralRe: How to Use Array As Value Type Pin
Wes Aday22-Sep-12 10:42
professionalWes Aday22-Sep-12 10:42 
GeneralRe: How to Use Array As Value Type Pin
Dave Kreskowiak22-Sep-12 13:15
mveDave Kreskowiak22-Sep-12 13:15 
QuestionCreate Instance or invoke members of a class from a loaded assembly Pin
Danzy8322-Sep-12 1:57
MemberDanzy8322-Sep-12 1:57 
I have classes in an assembly that I have been able to load using Assembly.LoadFrom() method. I now need to call a method in a class from the loaded assembly but I don't know how to do that.

I tried the following:

Assembly asm = Assembly.LoadFrom("LibTry.dll");

if (asm != null)
{
    object obj = asm.CreateInstance("LibTry.Try");
    Type[] types = asm.GetExportedTypes();

    // I now need to invoke a method from the class for further processing.
}


I'm able to create an instance of a class in the assembly and the return value in
'obj' is valid and not null.
By running the debugger, I set a breakpoint at the line

Type[] types = asm.GetExportedTypes();


I hovered the mouse over the return values and I saw the name of the class in the
'obj' and the exported types in 'types'.

The problem now is to make function calls from the class. Is there any way I can create an instance of the exported types using the name of the class rather than 'object' or call and use the public members in the class? Please help and thanks in advance.

modified 22-Sep-12 8:34am.

AnswerRe: Create Instance or invoke members of a class from a loaded assembly Pin
Eddy Vluggen22-Sep-12 2:54
professionalEddy Vluggen22-Sep-12 2:54 
GeneralRe: Create Instance or invoke members of a class from a loaded assembly Pin
Danzy8322-Sep-12 4:18
MemberDanzy8322-Sep-12 4:18 
GeneralRe: Create Instance or invoke members of a class from a loaded assembly Pin
Eddy Vluggen22-Sep-12 5:01
professionalEddy Vluggen22-Sep-12 5:01 
AnswerRe: Create Instance or invoke members of a class from a loaded assembly Pin
jschell22-Sep-12 8:44
Memberjschell22-Sep-12 8:44 
AnswerRe: Create Instance or invoke members of a class from a loaded assembly Pin
BobJanova24-Sep-12 0:52
MemberBobJanova24-Sep-12 0:52 
QuestionC# Application With MS Access Pin
SUBODH.SB21-Sep-12 23:39
MemberSUBODH.SB21-Sep-12 23:39 
AnswerRe: C# Application With MS Access Pin
Eddy Vluggen22-Sep-12 2:56
professionalEddy Vluggen22-Sep-12 2:56 
AnswerRe: C# Application With MS Access Pin
Smart Arab23-Sep-12 10:39
MemberSmart Arab23-Sep-12 10:39 
QuestionC# linq problem Pin
classy_dog21-Sep-12 11:38
Memberclassy_dog21-Sep-12 11:38 
AnswerRe: C# linq problem Pin
Matt T Heffron21-Sep-12 13:18
professionalMatt T Heffron21-Sep-12 13:18 
Questionputting VS projects/solutions in a TFS team project Pin
chuckdawit21-Sep-12 7:58
Memberchuckdawit21-Sep-12 7:58 
AnswerRe: putting VS projects/solutions in a TFS team project Pin
Emmanuel Medina21-Sep-12 11:30
professionalEmmanuel Medina21-Sep-12 11:30 
GeneralRe: putting VS projects/solutions in a TFS team project Pin
chuckdawit21-Sep-12 11:52
Memberchuckdawit21-Sep-12 11:52 
QuestionMonoDroid Pin
mAzeem2221-Sep-12 5:55
MembermAzeem2221-Sep-12 5:55 
AnswerRe: MonoDroid Pin
Emmanuel Medina21-Sep-12 11:34
professionalEmmanuel Medina21-Sep-12 11:34 
GeneralRe: MonoDroid Pin
mAzeem2221-Sep-12 19:57
MembermAzeem2221-Sep-12 19:57 
GeneralRe: MonoDroid Pin
Richard MacCutchan21-Sep-12 21:15
mveRichard MacCutchan21-Sep-12 21:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.