Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
List<billingfileformatter> formatters = BillingFileManager.GetFormatterByIdWithChilden((Guid)QueueInfo.BillingFileFormatterId);
foreach (BillingFileFormatter formatter in formatters)
{
List<string> LineItemList = new List<string>();
ACH testobject = new ACH();
//string typeName = "Billing.Ach." + formatter.ClassName + ", Billing.Ach, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
string typeName = formatter.ClassName;
Type filetype = Type.GetType(typeName);
IBillingFile billingFile = (IBillingFile)Activator.CreateInstance(filetype);
LineItemList = billingFile.ProcessBillingQueue(QueueInfo, new List<order>(OrdersToProcess.Values.ToList()));
C#




Above is the code that is failing for me, the GetType is coming back null and I dont know why. Any help would be appreciated.
Posted
Comments
Sergey Alexandrovich Kryukov 26-Dec-12 1:15am    
I don't think your observation is correct. You need to execute it under the debugger to see what happens. Check up the string value you pass to Type.GetType and make sure it represents the really existing type. But better — don't do it. This is not a good way to obtain some instance of System.Type.

Also, you need to explain what you want to achieve. Your could does not seem to make any sense at all.

—SA

thank you guys, I had the namespace incorrectly referenced and until I create the other iBillingFile References in the Billing.Ach class library, I just did IBillingFile billingFile = new ACH();. I was trying to make a generic wrapper for all the different types of Objects inside the ACH class library. I really appreciate all the help!!!
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 29-Apr-13 18:10pm    
Not an answer, should be removed.
—SA
Please see my comment to the question. You really need to explain what do you want to achieve.

You are using the static method System.Type.GetType(System.String): http://msdn.microsoft.com/en-us/library/w3f99sx1.aspx[^].

Read this help page. This method really should not give you non-null value. It will be null if the string does not represent any existing type.

I doubt you really need it.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900