Prev | Current Page 421 | Next

Guy Fouch?©, Trey Nash

"Accelerated VB 2008"

However, you must provide it with the necessary means to be able to convert to and from
Double, as well as to multiply and add constituent types. This Complex(Of T) structure is by no
means meant to be a reference for complex number representation. Rather, it is a contrived
example meant to illustrate many of the concerns you must deal with in order to create effective
generic types. You??™ll see some of these techniques in practice as you deal with the generic
containers that exist in the Framework Class Library.
Creating Constructed Types Dynamically
Given the dynamic nature of the CLR and the fact that you can actually generate classes and
code at run time, it is only natural to consider the possibility of constructing closed types from
generics at run time. Until now, the examples in this book have dealt with creating closed
types at compile time.
CHAPTER 12 n GENERICS 268
This functionality stems from a natural extension of the metadata specification to accommodate
generics. The type System.Type is the cornerstone of functionality whenever you need
to work with types dynamically within the CLR, and it has been extended to deal with generics
as well. Some of the new methods on System.Type are self-explanatory by name and include
GetGenericArguments(), GetGenericParameterConstraints(), and GetGenericTypeDefinition().


Pages:
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
pustaki szklane House Extension Kąty Rybackie noclegi kasyno Kołobrzeg