.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

How to call a method containing out parameter using reflection?

Posted By: Jean Paul     Posted Date: September 29, 2010    Points:2   Category :C#
I wanted to call the int.TryParse(obj, out int);

using Reflection. How to achieve the out value after calling it?

Author: Murugesan G             
Posted Date: October 06, 2010     Points: 5   
Author: Jean Paul             
Posted Date: October 06, 2010     Points: 5   

Thanks Dude for the answer..

But still it cannot solve the out parameter problem (the article link was for ref parameters)

Jean Paul http://jeanpaulva.com/
Author: Don             
Posted Date: January 11, 2011     Points: 5   

see whether dis will be ok for u..

#region Method Selection

Console.WriteLine("Enter the MethodName");

string n1 = Console.ReadLine();

ListParameters(t, n1);

Console.WriteLine("Enter the No. of arguments");

int no=int.Parse(Console.ReadLine());

MethodInfo mi2 = CStudent.GetMethod(n1);

object[] paramArray = new Object[no];

Console.WriteLine("Enter the Arguments");

for (int i = 0; i < no; i++)
paramArray[i] = int.Parse(Console.ReadLine());


object x = mi2.Invoke(obj, paramArray);

Console.WriteLine("Roll No: {0}", x);


Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend