< .Net Framework Class Library 3 | Main | .Net Framework Class Library 5 >


 

 

The .NET Framework Class Library Review 4

 

 

The topics in this part are listed below. The code snippets if any are based on the new C++ .NET syntaxes. The code snippets if any are based on the new C++ .NET syntaxes.

  1. System Interfaces

  2. System Structures

  3. System Delegates

  4. System Enumerations

  5. Basic Types

 

 

System Interfaces

 

An interface is a reference type that defines a contract. Other types implement an interface to guarantee that they support certain operations. The interface specifies the members that must be supplied by classes or other interfaces that implement it. Like classes, interfaces can contain methods, properties, indexers, and events as members.

 

Interface

Description

Symbol

The interface symbol used in VC++

_AppDomain

Exposes the public members of the System.AppDomain class to unmanaged code.

IAppDomainSetup

Represents assembly binding information that can be added to an instance of AppDomain.

IAsyncResult

Represents the status of an asynchronous operation.

ICloneable

Supports cloning, which creates a new instance of a class with the same value as an existing instance.

IComparable

Defines a generalized comparison method that a value type or class implements to create a type-specific comparison method.

IComparable

Defines a generalized comparison method that a value type or class implements to create a type-specific comparison method for ordering instances.

IConvertible

Defines methods that convert the value of the implementing reference or value type to a common language runtime type that has an equivalent value.

ICustomFormatter

Defines a method that supports custom, user-defined formatting of the value of an object.

IDisposable

Defines a method to release allocated unmanaged resources.

IEquatable

Defines a generalized method that a value type or class implements to create a type-specific method for determining equality of instances.

IFormatProvider

Provides a mechanism for retrieving an object to control formatting.

IFormattable

Provides functionality to format the value of an object into a string representation.

IServiceProvider

Defines a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.

 

Table 2

 

System Structures

 

A structure is a user-defined value type. Like a class, structures can contain constructors, constants, fields, methods, properties, indexers, operators, and nested types. Unlike classes, however, structures do not support inheritance.

 

Structure

Description

Symbol

The structure symbol used in VC++ .NET

ArgIterator

Represents a variable-length argument list; that is, the parameters of a function that takes a variable number of arguments.

ArraySegment

Delimits a section of a one-dimensional array.

Boolean

Represents a Boolean value.

Byte

Represents an 8-bit unsigned integer.

Char

Represents a Unicode character.

ConsoleKeyInfo

Describes the console key that was pressed, including the character represented by the console key and the state of the SHIFT, ALT, and CTRL modifier keys.

DateTime

Represents an instant in time, typically expressed as a date and time of day.

Decimal

Represents a decimal number.

Double

Represents a double-precision floating point number.

Enum

Provides the base class for enumerations.

Guid

Represents a globally unique identifier (GUID).

Int16

Represents a 16-bit signed integer.

Int32

Represents a 32-bit signed integer.

Int64

Represents a 64-bit signed integer.

IntPtr

A platform-specific type that is used to represent a pointer or a handle.

ModuleHandle

Represents a runtime handle for a module.

Nullable

Represents an object whose underlying type is a value type that can also be assigned a null reference (Nothing in Visual Basic) like a reference type.

RuntimeArgumentHandle

References a variable-length argument list.

RuntimeFieldHandle

Represents a field using an internal metadata token.

RuntimeMethodHandle

RuntimeMethodHandle is a handle to the internal metadata representation of a method.

RuntimeTypeHandle

Represents a type using an internal metadata token.

SByte

Represents an 8-bit signed integer.

Single

Represents a single-precision floating point number.

TimeSpan

Represents a time interval.

TypedReference

Describes objects that contain both a managed pointer to a location and a runtime representation of the type that may be stored at that location.

UInt16

Represents a 16-bit unsigned integer.

UInt32

Represents a 32-bit unsigned integer.

UInt64

Represents a 64-bit unsigned integer.

UIntPtr

A platform-specific type that is used to represent a pointer or a handle.

Void

Specifies a return value type for a method that does not return a value.

 

Table 3

 

System Delegates

 

A delegate in the .NET Framework is a reference to a function. A delegate is equivalent to a function pointer.

 

Delegate

Description

Symbol

The delegate symbol used in VC++ .NET

Action

Represents the method that performs an action on the specified object.

AppDomainInitializer

Represents the callback method to invoke when the application domain is initialized.

AssemblyLoadEventHandler

Represents the method that handles the AssemblyLoad event of an AppDomain.

AsyncCallback

References the callback method to be called when the asynchronous operation is completed.

Comparison

Represents the method that compares two objects of the same type.

ConsoleCancelEventHandler

Represents the method that will handle the CancelKeyPress event of a System::Console.

Converter

Represents a method that converts an object from one type to another type.

CrossAppDomainDelegate

Used by DoCallBack for cross-application domain calls.

EventHandler

Represents the method that will handle an event that has no event data.

EventHandler

Represents the method that will handle an event. The generic type argument specifies the type of the event data generated by the event. This class cannot be inherited.

Predicate

Represents the method that defines a set of criteria and determines whether the specified object meets those criteria.

ResolveEventHandler

Represents the method that handles the TypeResolve, ResourceResolve, and AssemblyResolve events of an AppDomain.

UnhandledExceptionEventHandler

Represents the method that will handle the event raised by an exception that is not handled by the application domain.

 

Table 4

 

System Enumerations

 

An enum (enumeration) is a list of named constants.

 

Enumeration

Description

Symbol

The enumeration symbol used in VC++ .NET

ActivationContext.ContextForm

Indicates the context for a manifest-activated application.

AppDomainManagerInitializationOptions

Specifies the action that a custom application domain manager takes when initializing a new domain.

AttributeTargets

Specifies the application elements on which it is valid to apply an attribute.

Base64FormattingOptions

Specifies whether relevant System::Convert::ToBase64CharArray and System::Convert::ToBase64String methods insert line breaks in their output.

ConsoleColor

Specifies constants that define foreground and background colors for the console.

ConsoleKey

Specifies the standard keys on a console.

ConsoleModifiers

Represents the SHIFT, ALT, and CTRL modifier keys on a keyboard.

ConsoleSpecialKey

Specifies combinations of modifier and console keys that can interrupt the current process.

DateTimeKind

Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC.

DayOfWeek

Specifies the day of the week.

Environment.SpecialFolder

Specifies enumerated constants used to retrieve directory paths to system special folders.

EnvironmentVariableTarget

Specifies the location where an environment variable is stored or retrieved in a set or get operation.

GenericUriParserOptions

Specifies options for a UriParser.

LoaderOptimization

An enumeration used with the LoaderOptimizationAttribute class to specify loader optimizations for an executable.

MidpointRounding

Specifies how mathematical rounding methods should process a number that is midway between two numbers.

PlatformID

Identifies the operating system, or platform, supported by an assembly.

StringComparison

Specifies the culture, case, and sort rules to be used by certain overloads of the String::Compare and String::Equals methods.

StringSplitOptions

Specifies whether applicable System::String::Split method overloads include or omit empty substrings from the return value.

TypeCode

Specifies the type of an object.

UriComponents

Specifies the parts of a Uri.

UriFormat

Controls how URI information is escaped.

UriHostNameType

Defines host name types for the Uri::CheckHostName method.

UriKind

Defines the kinds of Uris for the Uri::IsWellFormedUriString and several System::Uri methods.

UriPartial

Defines the parts of a URI for the Uri::GetLeftPart method.

 

Table 5

 

Basic Types

 

System implements all the basic types defined by the CTS, and you can find these listed in the following table.

 

 

 

 

 

 

 

Value Type

Description

Managed C++ Equivalent Type

Byte

An 8-bit unsigned integer

char

SByte

An 8-bit signed integer

signed char

Int16

A 16-bit signed integer

short

Int32

A 32-bit signed integer

int or long

Int64

A 64-bit signed integer

__int64

UInt16

A 16-bit unsigned integer

unsigned short

UInt32

A 32-bit unsigned integer

unsigned int or unsigned long

UInt64

A 64-bit unsigned integer

unsigned __int64

Single

A single-precision 32-bit floating-point number

float

Double

A double-precision 64-bit floating-point number

double

Boolean

A Boolean value

bool

Char

A 16-bit Unicode character

wchar_t

Decimal

A 96-bit decimal value

Decimal

IntPtr

A signed integer whose size depends on the platform

No built-in type

UIntPtr

An unsigned integer whose size depends on the platform

No built-in type

 

Table 6

 

Note that several of the types, namely the unsigned integer types and SByte, aren’t CLS-compliant, so be wary of using them when you’re writing code that’s going to be used from other .NET languages. All .NET languages map these types onto native types, so managed C++ maps int onto System::Int32, but you can also use the types directly if you want.

 

Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7 | Part 8

 


 

< .Net Framework Class Library 3 | Main | .Net Framework Class Library 5 >