C# 0 The Complete Reference


Assembly  object. The  Assembly



Download 4,07 Mb.
Pdf ko'rish
bet597/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   593   594   595   596   597   598   599   600   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

Assembly

 object. The 



Assembly

 class does not define a public constructor. Instead, an 



Assembly

 object is obtained 

by calling one of its methods. The one we will use is 

LoadFrom( )

, which loads an assembly 

given its filename. The form we will use is shown here:

static Assembly LoadFrom(string 



fi lename

)

Here, 



filename

 specifies the filename of the assembly.

Once you have obtained an 

Assembly

 object, you can discover the types that it defines 

by calling 

GetTypes( )

 on it. Here is its general form:

Type[ ] GetTypes( )

It returns an array of the types contained in the assembly.

To demonstrate the discovery of types in an assembly, you will need two files. The first 

will contain a set of classes that will be discovered by the second. To begin, create a file 

called

MyClasses.cs

 that contains the following:

// A file that contains three classes. Call this file MyClasses.cs.

using System;

class MyClass {

  int x;


  int y;

  public MyClass(int i) {

    Console.WriteLine("Constructing MyClass(int). ");

    x = y = i;

    Show();

  }


  public MyClass(int i, int j) {

    Console.WriteLine("Constructing MyClass(int, int). ");

    x = i;

    y = j;

www.freepdf-books.com



Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   593   594   595   596   597   598   599   600   ...   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