2013-02-05 17 views
1

所以我有一個類,我創建了一個包含所有必要信息(地址,電話,電子郵件等等)的客戶......基本上我想創建其他類,信息,但參考該類每次創建一個新客戶。c#中另一個類的參考方法

這裏是類的一個例子,我要引用:

public class Start_Customer 
{ 
    public CreateRequest _request; 
    public CreateResponse _response; 

    string fax = "(866) 345-3453"; 
    string website = "www.testersRus.com"; 
    bool Manage = true; 
    int PartnerID = 0; 
    string FirstName = ""; 
    string LastName = ""; 
    string Email = ""; 

    public void CreateClient() 
    { 
     _request = new CreateRequest(); 
     _request.CommandComment = ""; 
    } 

    public void Test() 
    { 
     //create a new web service client 
     var sw = new SoapCreateStart(); 

     _response = sw.Customers_Start(new AppHeader(), _request) as CustomerResponse; 

     Console.WriteLine(_response.ToString()); 
    } 

現在在我的新類我試圖使用引用該類做出了新的客戶,然後檢查,看看某些事情就像傳真號碼是正確的,公司是正確的,這樣的事情。

關於如何以正確的方式引用此方法的任何想法,而不是靜態的方法?

到目前爲止,我在想,我會說:

Start_Customer create = Start_Customer(); 
create = CreateClient(); 

這讓我得到的方法,但我不斷收到空的錯誤。請幫助!

+0

你調試過調用CreateClient方法嗎?您沒有發佈可能存在問題的CreateRequest構造函數的代碼。 –

+0

@AaronHawkins,是的構造函數工作,我已成功調試。我創建客戶端的課程正在運行。我只是有一個問題訪問不同類別的信息。 – CSharpDev4Evr

+0

從您提供的代碼中,我看不出有什麼理由不能訪問它。也許有一個潛在的架構問題?什麼是您正在獲得Start_Customer實例失敗的課程?你可以發佈該代碼嗎? –

回答

0

能想出來。我不得不通過說:

create.Create(); 

例如,感謝您的幫助!