C# 0 The Complete Reference


MemberType  is  MemberTypes



Download 4,07 Mb.
Pdf ko'rish
bet582/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   578   579   580   581   582   583   584   585   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

MemberType

 is 


MemberTypes

.

MemberTypes

 is an 

enumeration that defines values that indicate the various member types. Among others, 

these include

MemberTypes.Constructor

MemberTypes.Method

MemberTypes.Field

MemberTypes.Event

MemberTypes.Property

Thus, the type of a member can be determined by checking 

MemberType

. For example, if 



MemberType

 equals 


MemberTypes.Method

, then that member is a method.

www.freepdf-books.com



464

 

P a r t   I :  



T h e   C #   L a n g u a g e

MemberInfo

 includes two abstract methods: 



GetCustomAttributes( )

 and 


IsDefined( )

.

These both relate to attributes. The first obtains a list of the custom attributes associated with 



the invoking object. The second determines if an attribute is defined for the invoking object. 

(Attributes are described later in this chapter.)

To the methods and properties defined by 

MemberInfo

,

Type

 adds a great many of its 

own. For example, here are several commonly used methods defined by 



Type

:

Method



Purpose

ConstructorInfo[ ] GetConstructors( )

Obtains a list of the constructors for the specified type.

EventInfo[ ] GetEvents( )

Obtains a list of events for the specified type.

FieldInfo[ ] GetFields( )

Obtains a list of the fields for the specified type.

Type[ ] GetGenericArguments( )

Obtains a list of the type arguments bound to 

a closed constructed generic type or the type 

parameters if the specified type is a generic type 

definition. For an open constructed type, the list may 

contain both type arguments and type parameters. 

(See Chapter 18 for a discussion of generics.)

MemberInfo[ ] GetMembers( )

Obtains a list of the members for the specified type.

MethodInfo[ ] GetMethods( )

Obtains a list of methods for the specified type.

Proper tyInfo[ ] GetProper ties( )

Obtains a list of proper ties for the specified type.

Here are several commonly used, read-only properties defined by 

Type

:

Property



Purpose

Assembly Assembly

Obtains the assembly for the specified type. 

TypeAttributes Attributes

Obtains the attributes for the specified type.

Type BaseType

Obtains the immediate base type for the specified 

type.


string FullName

Obtains the complete name of the specified type.

bool IsAbstract

Is true if the specified type is abstract.

bool isArray

Is true if the specified type is an array.

bool IsClass

Is true if the specified type is a class.

bool IsEnum

Is true if the specified type is an enumeration.

bool IsGenericParameter

Is true if the specified type is a generic type 

parameter. (See Chapter 18 for a discussion of 

generics.)

bool IsGenericType

Is true if the specified type is a generic type. (See 

Chapter 18 for a discussion of generics.)

string Namespace

Obtains the namespace of the specified type.

www.freepdf-books.com




Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   578   579   580   581   582   583   584   585   ...   1096




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish