Skip to Main Content
Microsoft® .NET Compact Framework Kick Start
book

Microsoft® .NET Compact Framework Kick Start

by Erik Rubin, Ronnie Yates
August 2003
Beginner to intermediate content levelBeginner to intermediate
600 pages
12h 57m
English
Sams
Content preview from Microsoft® .NET Compact Framework Kick Start

Creating Type Instances by Using ConstructorInfo

Once you have a System.Type object instance, you can use it to create an instance of the type it represents. This can be done by querying for a ConstructorInfo object. The ConstructorInfo class is used to discover the attributes of a constructor, and it provides access to constructor metadata. Most importantly, a ConstructorInfo instance can be used to invoke a type's constructor.

Before we start invoking constructors, let's discuss how you can get a hold of one of these powerful objects. The Type class provides two methods for retrieving ConstructorInfos: GetConstructors and GetConstructor.

Using the GetConstructors Method

The GetConstructors method comes in two flavors. The easiest flavor to ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Microsoft® .NET Compact Framework (Core Reference)

Microsoft® .NET Compact Framework (Core Reference)

Andy Wigley, Stephen Wheelwright, Robert Burbidge, Rory MacLoed, Mark Sutton
Professional C# 5.0 and .NET 4.5.1

Professional C# 5.0 and .NET 4.5.1

Christian Nagel, Jay Glynn, Morgan Skinner

Publisher Resources

ISBN: 0672325705Purchase book