Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
List formatters = BillingFileManager.GetFormatterByIdWithChilden((Guid)QueueInfo.BillingFileFormatterId);
foreach (BillingFileFormatter formatter in formatters)
{
List LineItemList = new List();
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(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
bobb024310
Comments
Sergey Alexandrovich Kryukov at 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
Rate this: bad
good
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!!!
  Permalink  
Comments
Sergey Alexandrovich Kryukov at 29-Apr-13 18:10pm
   
Not an answer, should be removed.
—SA
Rate this: bad
good
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): 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
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 9,935
1 OriginalGriff 6,987
2 CPallini 5,845
3 George Jonsson 4,015
4 Gihan Liyanage 3,266


Advertise | Privacy | Mobile
Web01 | 2.8.140926.1 | Last Updated 26 Dec 2012
Copyright © CodeProject, 1999-2014
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