-2

我想查询 IcustomerRet 类中对象的名称和类型 示例显示此名称。

IQBStringType AccountNumber

IQBStringType AltContact

IQBStringType AltPhone

IQBAmountType 余额

IAddress 账单地址

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#,谢谢你的回答

4

1 回答 1

0

使用GetType方法调用,它返回真实的类型名称。

例子:

 public interface IData
 {
 }

 public class RealData : IData 
 {
 }

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

输出“RealData”

编辑

如果要获取对象内部属性的名称,请使用反射

C# 反射按名称获取字段或属性

于 2013-07-04T09:50:26.407 回答