Click here to Skip to main content
13,054,779 members (74,763 online)
Rate this:
Please Sign up or sign in to 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=, 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()));

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 25-Dec-12 19:04pm
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.

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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):[^].

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.

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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!!!
Sergey Alexandrovich Kryukov 29-Apr-13 18:10pm
Not an answer, should be removed.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 26 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100