2013-07-04 116 views
-2

我想查詢類IcustomerRet中的對象的名稱和類型 示例顯示此名稱。我想查詢類中的對象的名稱和類型IcustomerRet

IQBStringType賬戶號碼

IQBStringType AltContact

IQBStringType AltPhone

IQBAmountType餘額

IAddress BillAddress

IAddressBlock BillAddressBlock

代碼在這裏!

namespace QBFC10Lib 

{ 
[Guid("089A0498-58A7-48AE-B17E-297095B9E311")] 

[TypeLibType(4160)] 

public interface ICustomerRet : IQBBase 

{ 

    [DispId(41)] 

    IQBStringType AccountNumber { get; } 

    [DispId(31)] 

    IQBStringType AltContact { get; } 

    [DispId(27)] 

    IQBStringType AltPhone { get; } 

    [DispId(35)] 

    IQBAmountType Balance { get; } 

    [DispId(19)] 

    IAddress BillAddress { get; } 

    [DispId(20)] 

    IAddressBlock BillAddressBlock { get; } 

    [DispId(13)] 

    IQBStringType CompanyName { get; } 

    [DispId(30)] 

    IQBStringType Contact { get; } 

    [DispId(44)] 

    ICreditCardInfo CreditCardInfo { get; } 

    [DispId(42)] 

    IQBAmountType CreditLimit { get; } 

    [DispId(57)] 

    IQBBaseRef CurrencyRef { get; } 

    [DispId(32)] 

    IQBBaseRef CustomerTypeRef { get; } 

    [DispId(58)] 

    IDataExtRetList DataExtRetList { get; } 

    [DispId(53)] 

    IQBENDeliveryMethodType DeliveryMethod { get; } 

    [DispId(7)] 

    IQBStringType EditSequence { get; } 

    [DispId(29)] 

    IQBStringType Email { get; } 

    [DispId(55)] 

    IQBGUIDType ExternalGUID { get; } 

    [DispId(28)] 

    IQBStringType Fax { get; } 

    [DispId(15)] 

    IQBStringType FirstName { get; } 

    [DispId(9)] 

    IQBStringType FullName { get; } 

    [DispId(10)] 

    IQBBoolType IsActive { get; } 


    [DispId(52)] 

    IQBBoolType IsStatementWithParent { get; } 

    [DispId(38)] 


    IQBBaseRef ItemSalesTaxRef { get; } 

    [DispId(49)] 

    IQBStringType JobDesc { get; } 

    [DispId(48)] 

    IQBDateType JobEndDate { get; } 

    [DispId(47)] 

    IQBDateType JobProjectedEndDate { get; } 

    [DispId(46)] 

    IQBDateType JobStartDate { get; } 

    [DispId(45)] 

    IQBENJobStatusType JobStatus { get; } 

    [DispId(50)] 

    IQBBaseRef JobTypeRef { get; } 

    [DispId(17)] 

    IQBStringType LastName { get; } 

    [DispId(4)] 

    IQBIDType ListID { get; } 

    [DispId(16)] 

    IQBStringType MiddleName { get; } 

    [DispId(25)] 

    IQBStringType Mobile { get; } 

    [DispId(8)] 

    IQBStringType Name { get; } 

    [DispId(51)] 

    IQBStringType Notes { get; } 

    [DispId(26)] 

    IQBStringType Pager { get; } 

    [DispId(11)] 

    IQBBaseRef ParentRef { get; } 

    [DispId(24)] 

    IQBStringType Phone { get; } 

    [DispId(43)] 

    IQBBaseRef PreferredPaymentMethodRef { get; } 

    [DispId(54)] 

    IQBBaseRef PriceLevelRef { get; } 

    [DispId(23)] 

    IQBStringType PrintAs { get; } 

    [DispId(40)] 

    IQBStringType ResaleNumber { get; } 


    [DispId(34)] 

    IQBBaseRef SalesRepRef { get; } 

    [DispId(37)] 

    IQBBaseRef SalesTaxCodeRef { get; } 

    [DispId(39)] 

    IQBENSalesTaxCountryType SalesTaxCountry { get; } 

    [DispId(14)] 

    IQBStringType Salutation { get; } 

    [DispId(21)] 

    IAddress ShipAddress { get; } 

    [DispId(22)] 

    IAddressBlock ShipAddressBlock { get; } 

    [DispId(12)] 

    IQBIntType Sublevel { get; } 

    [DispId(18)] 

    IQBStringType Suffix { get; } 

    [DispId(56)] 

    IQBStringType TaxRegistrationNumber { get; } 

    [DispId(33)] 

    IQBBaseRef TermsRef { get; } 

    [DispId(5)] 

    IQBDateTimeType TimeCreated { get; } 

    [DispId(6)] 

    IQBDateTimeType TimeModified { get; } 

    [DispId(36)] 

    IQBAmountType TotalBalance { get; } 

    [DispId(1)] 

    IObjectType Type { get; } 

} 

} 

我是新的C#,感謝您的回答

回答

0

使用GetType方法調用,它返回真正的類型名稱。

例子:

public interface IData 
{ 
} 

public class RealData : IData 
{ 
} 

IData data = new RealData(); 
Console.WriteLine(data.GetType()); 

輸出 「RealData」

編輯

如果你想獲得對象內部的屬性的名稱,使用反射

C# Reflection get Field or Property by Name

+0

對不起,我想知道這個類中的對象的名字 例子 public interface ClassName {0} {0} {0} Object ObjectName; } –

+0

謝謝ican show name普通屬性 示例public class Name {public string Name1; IQBStringType AccountNumber {get; } } 我可以得到Name1,但我不能顯示AccountNumber –

+0

@ZeromatrixEnginismKmutnb:檢查可訪問性。在反射恢復期間,指定您正在搜索* private *屬性。 – Tigran

相關問題