CorLib

CorLib

VB.EXT: CorLib 3.0 Version: 3.0.0 (VB.EXT Core Class Library 3.0)
Copyright Kelly Ethridge

VB.EXT Core Class Library

CorLib

Classes:

ApplicationException | Defines the base class for predefined exceptions in the user program.
ArgumentException | The exception that is thrown when one of the arguments provided to a method is not valid.
ArgumentNullException | The exception that is thrown when a null reference is passed to a method that does not accept it as a valid argument.
ArgumentOutOfRangeException | The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method.
ArithmeticException | This exception is used when a mathematical error has occurred.
ArrayList | A list that dynamically increases in size to hold a number of items.
ArrayListStatic | Represents the static methods of the ArrayList class.
ArrayTypeMismatchException | Represents an exception caused by two arrays not being compatible.
ASCIIEncoding | Provides a set of methods used to encode and decode chars to and from bytes in ASCII format.
AsymmetricAlgorithm | Provides a common interface to be implemented by all Asymmetrical algorithm classes.
AsyncCallback | Used as a means for asynchronous operations to notify when a procedure is finished.
BigInteger | Represents an unlimited size signed integer value.
BigIntegerStatic | Provides methods used to manipulate BigInteger objects.
BinaryReader | Provides a set of methods to read typed information from a Stream.
BinaryResourceEncoder | This will accept a byte array to be encoded into a .RES file.
BinaryWriter | Provides methods to write typed information to a stream.
BitArray | Manages a compact array of bit values. Each bit represents a boolean, where True = 1, and False = 0.
BitArrayStatic | Provides creation methods from various types of arrays.
BitConverter | Converts base data types to an array of bytes, and an array of bytes to base data types.
BitMapResourceDecoder | Decodes bitmap byte data from a byte array and produces a StdPicture. Usually the byte array comes from a .RES file file.
BitMapResourceEncoder | This encodes a multiple StdPicture bitmaps into individual arrays of bytes.
Buffer | This class provides methods for copying manipulating arrays as byte arrays.
Calendar | Represents various systems of time in which the beginning, length, and divisions of a year are defined.
CalendarStatic | Provides static methods for the Calendar class.
CaseInsensitiveComparer | Provides a comparer that is case-insensitive when comparing strings.
CaseInsensitiveComparerStatic | Provides access to default culture-sensitive CaseInsensitiveComparer objects.
Char | Provides methods for inspecting and manipulating Unicode characters.
CharEnumerator | Used to enumerate the characters in a string from start to end.
Comparer | Compares two values for equivalence, where string comparisons are case-sensitive.
ComparerStatic | Provides static functions to access the default comparer.
Console | Provides a mechanism for handling input and output for either a screen or Stream.
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.
Constructors | Functions used to create fully inititalized objects.
Conversion | Provides methods to convert to specified data-types.
Convert | Provides methods used to encode and decode byte arrays to and from base-64 encoded characters.
CorArray | Provides methods for creating, manipulating, searching, and sorting arrays.
CorDateTime | Represents a point in time.
CorDateTimeStatic | Represents methods to create CorDateTime objects from various data sources.
CorMath | Provides extended math functionality.
CorString | Provides static functions to format and manipulate string values.
CryptoAPIHash | Wraps the CryptoAPI hash functions to be used in the HashAlgorithmBase callback methods.
CryptoAPITransform | Utilizes the Windows CryptoAPI cryptography services to perform data transformations.
CryptoConfig | Accesses the cryptography configuration information.
CryptographicException | An exception that represents an error occuring during some form of cryptographic operation.
CryptoStream | Provides a streaming mechanism for ciphering data.
CspKeyContainerInfo | Represents information about a Crypto Service Providers Key Container.
CspParameters | Contains parameter values that can be passed on to cryptography providers.
CultureInfo | Represents information about a culture, such as number and date formatting.
CultureInfoStatic | Provides a set of static methods retrieve CultureInfo objects.
CursorResourceDecoder | Decodes cursor byte data from a .RES formatted byte array.
CursorResourceEncoder | Encodes a StdPicture Cursor to byte data used in .RES files.
CursorResourceGroupDecoder | Decodes a CursorGroup resource.
CursorResourceGroupEncoder | Encodes a PictureResourceGroup object to a .RES byte array.
DateTimeFormatInfo | Provides a repository of formatting information to be used in formatting CorDateTime and Date values to match that of a specific locale.
DateTimeFormatInfoStatic | Provides static methods to retrieve various DateTimeFormatInfo objects.
DayLightTime | Represents the start and end times for a daylight saving period, and the difference between daylight saving time and standard time.
Decoder | Provides an interface to be used in converting blocks of bytes into unicode characters.
DecoderExceptionFallback | Provides a failure-handling mechanism, called a fallback, for an encoded input byte sequence that cannot be converted to an input character. The fallback throws an exception instead of decoding the input byte sequence.
DecoderExceptionFallbackBuffer | Throws DecoderFallbackException when an encoded input byte sequence cannot be converted to a decoded output character.
DecoderFallback | Provides a failure-handling mechanism, called a fallback, for an encoded input byte sequence that cannot be converted to an output character.
DecoderFallbackBuffer | Provides a buffer that allows a fallback handler to return an alternate string to a decoder when it cannot decode an input byte sequence.
DecoderFallbackException | The exception that is thrown when a decoder fallback operation fails.
DecoderFallbackStatic | Gets an object that outputs a substitute string in place of an input byte sequence that cannot be decoded.
DecoderReplacementFallback | Provides a failure-handling mechanism, called a fallback, for an encoded input byte sequence that cannot be converted to an output character. The fallback emits a user-specified replacement string instead of a decoded input byte sequence.
DecoderReplacementFallbackBuffer | Represents a substitute output string that is emitted when the original input byte sequence cannot be decoded. This class cannot be inherited.
DES | Represents a base interface that all DES algorithms should implement.
DESCryptoServiceProvider | Defines a wrapper class around a DES cryptographic service provider.
DESStatic | Provides static methods relating to the DES crypto service provider.
DictionaryEntry | A DictionaryEntry is used to contain a key/value pair. This enables collections to keep the two values together throughout an operation.
Directory | Provides a set of static methods for manipulating and retrieving directory information.
DirectoryInfo | Represents a directory to modify and retrieve information about.
DirectoryNotFoundException | An exception that is thrown when a specified directory was not found.
DivideByZeroException | The exception that is thrown when there is an attempt to divide an integral or decimal value by zero.
DriveInfo | Provides methods to access information about a drive.
DriveInfoStatic | Provides static methods for manipulating DriveInfo objects.
DriveNotFoundException | The exception that is thrown when trying to access a drive or share that is not available.
DSA | Represents a base interface all DSA (Digital Signature Algorithm) implementations must implement.
DSACryptoServiceProvider | Provides a wrapper to access a DSA crypto service provider.
DSAParameters | Represents the DSA key parameters.
Encoder | Provides an interface for encoding unicode characters into bytes.
EncoderExceptionFallback | Returns an encoder fallback buffer that throws an exception if it cannot convert a character sequence to a byte sequence.
EncoderExceptionFallbackBuffer | Throws EncoderFallbackException when an input character cannot be converted to an encoded output byte sequence.
EncoderFallback | Provides a failure-handling mechanism, called a fallback, for an input character that cannot be converted to an encoded output byte sequence.
EncoderFallbackBuffer | Provides a buffer that allows a fallback handler to return an alternate string to an encoder when it cannot encode an input character.
EncoderFallbackException | The exception that is thrown when an encoder fallback operation fails. This class cannot be inherited.
EncoderFallbackStatic | Provides a failure-handling mechanism, called a fallback, for an input character that cannot be converted to an encoded output byte sequence.
EncoderReplacementFallback | Provides a failure handling mechanism, called a fallback, for an input character that cannot be converted to an output byte sequence. The fallback uses a user-specified replacement string instead of the original input character.
EncoderReplacementFallbackBuffer | Represents a substitute input string that is used when the original input character cannot be encoded. This class cannot be inherited.
Encoding | Provides an interface for a provider to encode and decode unicode characters to and from bytes. Also contains information on the ability to use the encoded characters in certain situations without integerity loss.
EncodingInfo | Contains information about a specific encoding.
EncodingStatic | Provides static methods used to retrieve existing encodings and convert between encodings.
EndOfStreamException | An exception that is thrown when an attempt to read passed the end of a stream occurs.
EnumeratorBase | Used to manage an enumeration index into a set of items.
Environment | The Environment class provides functions for retrieving information about the local machine
EqualityComparerStatic | Provides static methods to support IEqualityComparer interface.
EventArgs | Represents the base class for classes that contain event data, and provides a value to use for events that do not include event data.
EventArgsStatic | Represents an event with no data.
Exception | This is the base class from which all exception derive their interface.
ExceptionBase | This is a helper class to easily manage an exception type class.
ExceptionMethods | Defines public exception management functions Throw and Catch.
ExternalException | Returns a key/value collection used to contain user-defined specific information about the exception.
File | Provides static methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of FileStream objects.
FileInfo | Provides methods for manipulating, setting and retrieving information for the specified file.
FileNotFoundException | An exception thrown when a specified file was not found.
FileStream | Represents a file as a Stream.
FileSystemInfo | The FileSystemInfo interface is used to access both FileInfo and DirectoryInfo objects using the same code. This allows for similar properties and methods to be used on both files and directories with a single routine.
FormatException | The exception that is thrown when the format of an argument does not meet the parameter specifications of the invoked method.
FromBase64Transform | Transforms data from base-64 to plain text.
GregorianCalendar | Provides methods for manipulating dates using the Gregorian calendar mathematics.
GregorianCalendarStatic | Provides static methods for the GregorianCalendar class.
Guid | Represents a globally unique identifier (GUID).
GuidStatic | Provides static methods used to create and manipulate Guid objects.
HashAlgorithm | Represents a common interface implemented by all hashing algorithms.
HashAlgorithmBase | Provides a base implementation for implementing hash algorithms.
Hashtable | Represents a collection of key/value pairs that are organized based on the hash code of the key.
HebrewCalendar | Provides methods for manipulating Hebrew (Jewish) dates.
HebrewCalendarStatic | Provides static methods for the HebrewCalendar class.
HijriCalendar | Provides methods for manipulating Hijri dates.
HijriCalendarStatic | Provides static methods to support the Hijri calendar.
HMAC | Provides a common Hash-based Message Authentication Code (HMAC) interface to be implemented by all HMAC classes.
HMACBase | Provides the base functionality to perfrom Hash Message Authentication Code operations.
HMACMD5 | Represents an MD5 implementation of an HMAC algorithm.
HMACRIPEMD160 | Represents a RIPEMD160 hash impelemntation of the HMAC algorithm.
HMACSHA1 | Represents an SHA-1 implementation of the HMAC algorithm.
HMACSHA256 | Represents an SHA-256 implementation of the HMAC algorithm.
HMACSHA384 | Represents an SHA-384 implementation of the HMAC algorithm.
HMACSHA512 | Represents an SHA-512 implementation of the HMAC algorithm.
HMACStatic | Provides static methods associated to the HMAC class.
IAsyncResult |
ICloneable | Supports cloning, which creates a new instance of a class with the same value as an existing instance.
ICollection | Provides an interface to access size and enumeration capabilities of collections.
IComparable | Defines a generalized type-specific comparison method that a value type or class implements to order or sort its instances.
IComparer | Exposes a method that compares two values.
IconResourceDecoder | Decodes an icon from a .RES formatted byte array.
IconResourceEncoder | Encodes the StdPicture icon.
IconResourceGroupDecoder | Decodes an IconGroup resource.
IconResourceGroupEncoder | Encodes a PictureResourceGroup object to a .RES byte array.
ICryptoTransform | A common interface implemented by all crypto transform classes.
ICspAsymmetricAlgorithm | Provices methods to allow access to Key container information and Crypto API blob import/export ability for Asymmetric algorithmes.
ICustomFormatter | The ICustomFormatter interface is used to allow user-defined classes to be the formatting service for values.
IDictionary | This provides a standard interface to be impelments by key-value list collection.
IDictionaryEnumerator | An interface used to enumerate a dictionary style collections (Hashtable.)
IEnumerable | An interface that can be used to get an enumerator for an object.
IEnumerator | Supports a simple iteration over a collection.
IEqualityComparer | Defines methods to support the comparison of values for equality.
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.
IHashAlgorithm | Provides an interface all hash algorithm callbacks must implement.
IList | An interface that provides methods for accessing and manipulating values at specified indexes within a list.
IndexOutOfRangeException | The exception that is thrown when an attempt is made to access an element of an array with an index that is outside the bounds of the array.
IniFile | Provides methods for manipulating an INI initialization file.
IniResourceWriter | Creates an entire section at once in an INI file.
Int64Static | Provides methods for manipulating a 64-bit signed integer.
InvalidCastException | The exception that is thrown for invalid casting or explicit conversion.
InvalidOperationException | The exception that is thrown when a method call is invalid for the objects current state.
IObject | This is the base interface to allow objects to be utilized throughout most of VBCorLib.
IOException | This exception is thrown when an I/O error occurs.
IResourceDecoder | Provides an interface to allow a ResourceReader to decode resource types found within a .RES file.
IResourceEncoder | Provides an interface for classes to be used to encode data into byte arrays used by the ResourceWriter.
IResourceReader | Provides a standard interface for resource readers
IResourceWriter | Provides an interface for resource writers.
IVersionable | This interface is used to inspect classes that have changed, like a collection class.
JapaneseCalendar | Provides functions for manipulating Japanese dates.
JulianCalendar | Provides methods to manipulate Julian dates.
JulianCalendarStatic | Provides static methods for the JulianCalendar class.
KeyedHashAlgorithm | Provides a common interface to be implementated by all keyed hash implentations.
KeySizes | Represents a set of key sizes.
KoreanCalendar | Provides functions to manipulate Korean dates.
KoreanCalendarStatic | Provides static methods for the KoreanCalendar class.
MACTripleDES | Represents a TripleDES implementation of an HMAC algorithm.
MACTripleDESStatic | Provides static methods associated with the MACTripleDES class.
MD5 | Represents a base interface to be implemented by all MD5 hash algorithms.
MD5CryptoServiceProvider | Provides MD5 hashing services through the CryptoAPI interface.
MD5Static | Represents the abstract class from which all implementations of the MD5 hash algorithm inherit.
MemoryMappedFile | Represents a simple file-to-memory mapping.
MemoryMappedFileStatic | Represents a simple file-to-memory mapping.
MemoryMappedViewAccessor | Represents a randomly accessed view of a memory-mapped file.
MemoryMappedViewStream | Represents a view of a memory-mapped file as a sequentially accessed stream.
MemoryStream | Provides an in-memory stream of data that can be read/written and modified using Stream methods.
NotSupportedException | The exception that is thrown when an invoked method is not supported.
NumberFormatInfo | Provides numeric formatting information.
NumberFormatInfoStatic | Provides methods to retrieve the various types of NumberFormatInfo objects.
ObjectBase | This class represent a proxy as a base class for those classes that implement IObject. It is intended to give default behavior for the three main methods of the Object class in .NET. The base class is accessed using the MyBase global static property. This class is not intended to be used by code other than in the methods of the IObject interface implementations.
ObjectDisposedException | This exception is thrown when an operation is attempted on a disposed object.
ObjectStatic | Provides default implementations of the IObject interface.
OperatingSystem | Provides information about the currently running operating system.
OutOfMemoryException | This the exception thrown when a memory error occurs.
OverflowException | This exception is thrown when a mathimatical operation causes a value outside the valid range of values for the destination object.
Path | Performs operations on String instances that contain file or directory path information.
PathTooLongException | An exception that is caused by a path being longer than Windows can handle.
PictureResourceGroup | This class represents a group of Icons or Cursors.
PictureResourceInfo | Represents a picture resource that is part of a group of pictures.
PlatformNotSupportedException | This exception is thrown when an operation is to be performed, but the current operating system does not support the action.
PublicFunctions | Provides some helper functions.
Queue | Represents a first-in, first-out collection of values.
Random | Provides a sequence of pseudo-random generated numbers.
RandomNumberGenerator | A common interface to be implemented by random number generators.
RandomNumberGeneratorStatic | Provides static methods associated with the RandomNumberGenerator class.
RankException | The exception that is thrown when an array with the wrong number of dimensions is passed to a method.
RC2 | Represents a standard interface implemented by all RC2 crypto service providers.
RC2CryptoServiceProvider | Provides cryptography services using the RC2 symmetric algorithm.
RC2Static | Provides static methods associated with the RC2 algorithm.
Registry | Supplies the base Registrykeys that access values and subkeys in the registry.
RegistryKey | Represents a key level node inside the Windows Registry.
RegistryKeyStatic | Provides static methods for the RegistryKey class.
ResourceKey | This class represents a Resource key by containing the 3 primary identifiers for a Windows resource.
ResourceManager | Provides convenient access to culture-specific resources at runtime.
ResourceManagerStatic | Provides static methods for the ResourceManager object.
ResourceReader | Provides a means to iterate through the resources in a .RES file.
ResourceSet | Stores all the resources localized for one particular culture, ignoring all other cultures.
ResourceWriter | Writes encoded resources out to a .RES file.
Rfc2898DeriveBytes | Implements password-based key derivation functionality, PBKDF2, by using a pseudo-random number generator based on HMACSHA1.
Rijndael | Provides a standard interface implemented by all Rijndael cryptographic service providers.
RijndaelManaged | Represents an implementation of the Rijndael symmetric block cipher algorithm
RijndaelManagedTransform | Performs cryptographic operations on data using the Rijndael algorithm.
RijndaelStatic | Provides static methods associated with the Rijndael class.
RIPEMD160 | Provides a common interface to be implemented by all RIPEMD160 implementations.
RIPEMD160Managed | Represents an implementation of the RIPEMD160 hashing algorithm.
RNGCryptoServiceProvider | Provides random number generation that is a bit more random than the regular Visual Basic method by using a Cryptographic Service Provider.
RSA | Represents the base interface from which all RSA class implementations must implement.
RSACryptoServiceProvider | Provides RSA encryption services using the Windows Crypto API methods.
RSACryptoServiceProviderStatic |
RSAParameters | Represents the Key information for an RSA implementation.
RSAStatic | Represents methods associated with the RSA class.
SafeFileHandle | Represents a wrapper class for a file handle.
SafeHandle | Represents a wrapper class for operating system handles. This class must be implemented.
SafeMemoryMappedFileHandle | Provides a safe handle that represents a memory-mapped file for sequential access.
SecurityElement | Provides simple XML text management capabilities.
SecurityElementStatic | Provides static functions associated to the SecurityElement class.
SerializationException | This exception is thrown when an error occurs reading or writing a propertybag and a value cannot be serialized.
SHA1 | Represents a standard interface for SHA-1 class implementations.
SHA1CryptoServiceProvider | Provides services to compute the SHA-1 hash values of data.
SHA1Managed | Provides services to compute the SHA-1 hash value.
SHA1Static | Provides methods specific to the SHA-1 class.
SHA256 | Represents a standard interface for SHA-256 class implementations.
SHA256Managed | Provides services to compute the SHA-256 hash value.
SHA256Static | Provides methods associated with the SHA-256 class.
SHA384 | Represents a standard interface for SHA-384 class implementations.
SHA384Managed | Provides services to compute the SHA-384 hash value.
SHA384Static | Provides methods associated with the SHA-384 class.
SHA512 | Represents a standard interface for SHA-512 class implementations.
SHA512Managed | Provides services to compute the SHA-512 hash value.
SHA512Static | Provides methods associated with the SHA-512 class.
SortedList | Provides a means to maintain a list of sorted items based on an associated key.
Stack | Represents a simple last-in-first-out (LIFO) non-generic collection of items.
StaticClasses | Provides direct access to static class methods.
StopWatch | Provides a timing mechanism using QueryPerformanceCounter if available, otherwise the system time is used.
StopWatchStatic | Provides methods that are related to the StopWatch class.
Stream | Provides a set of standard methods for using a Stream object.
StreamReader | Reads characters from a byte array in a particular encoding.
StreamStatic | Provides static methods for the Stream class.
StreamWriter | Writes characters to a byte stream using the specific encoding.
StringBuilder | Allows easy manipulation, concatenation and removal of strings and characters.
StringComparer | Represents string comparison operations based on a specific case and culture-based or ordinal comparison rules.
StringComparerStatic | Provides a set of StringComparer objects implementing different string comparison rules.
StringReader | Provides methods to read portions of a string.
StringResourceDecoder | Decodes a resource String table containing up to 16 strings.
StringResourceEncoder | Encodes strings into string tables.
StringWriter | Provides a set of functions for writing to a string.
SymmetricAlgorithm | Provides a standard interface for utilizing symmetric algorithms.
SymmetricAlgorithmBase | Provides a common base of functionality for SymmetricAlgorithm derived classes.
SystemException | Defines the base class for predefined exceptions in the VBCorLib library.
TaiwanCalendar | Provides functions for manipulating Taiwanese dates.
TextReader | Provides an interface to read text characters from a stream.
TextReaderStatic | Provides static methods and properties for the TextReader class.
TextWriter | Provides an interface used to write text characters to a stream.
ThaiBuddhistCalendar | Provides methods for manipulating ThaiBuddhist dates.
ThaiBuddhistCalendarStatic | Provides static methods of the ThaiBuddhistCalendar class.
Thread | Creates and controls a thread, sets its priority, and gets its status.
ThreadStatic | Gets the currently running thread.
Ticker | Provides a recurring timer event.
TimeSpan | This class represents an amount of time.
TimeSpanStatic | Provides severs static functions to help in creating TimeSpan objects.
TimeZone | Represents a time zone.
TimeZoneStatic | Represents static methods for the TimeZone class.
ToBase64Transform | A class used to transform byte data to Base 64 data.
TripleDES | Represents the interface for Triple Data Encryption Standard classes to implement.
TripleDESCryptoServiceProvider | Provides cryptographic services using the TripleDES cryptographic service provider.
TripleDESStatic | Provides static methods used with the Triple Data Encryption Standard algorithm.
UnauthorizedAccessException | This exception is thrown when an operation attempted to access a secured value or location without proper authorization.
UnicodeEncoding | A set of functions used to convert UTF-16 Unicode characters to and from byte arrays.
UTF32Encoding | Represents a UTF-32 encoding of Unicode characters.
UTF7Encoding | Represents a UTF-7 encoding of Unicode characters.
UTF8Encoding | A set of functions to be used to convert character arrays to and from byte arrays.
Version | Represents a version number in the format Major.Minor[.Build[.Revision]].
VersionStatic | Provides static methods to help create Version objects.
WaitHandle |
WinResourceReader | A class that reads resources out of EXE and DLL files.
XmlSyntaxException | Represents an exception caused by invalid XML syntax.
Build on Sunday, October 11, 2020 by VBDOX


ApplicationException

ApplicationException

Defines the base class for predefined exceptions in the user program.

Implements:

Exception
IObject

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

Remarks

This class is used to help differenciate between exceptions raised by VBCorLib and the executing application. Instead of directly instantiating an ApplicationException object, a new class should be derived from ApplicationExceptionBase to easily specify the exception type.

ApplicationException uses the HResult COR_E_APPLICATION, which is &H80131600.

See Also

Project CorLib Overview

Class ApplicationException Overview

Constructors

ExceptionMethods

Exception


ApplicationException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class ApplicationException Overview


ApplicationException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class ApplicationException Overview


ApplicationException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class ApplicationException Overview


ApplicationException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class ApplicationException Overview


ApplicationException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class ApplicationException Overview


ApplicationException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class ApplicationException Overview


ApplicationException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class ApplicationException Overview


ApplicationException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class ApplicationException Overview


ApplicationException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class ApplicationException Overview

Exception


ApplicationException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class ApplicationException Overview


ApplicationException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class ApplicationException Overview


ApplicationException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewArgumentException.

Read Only.

See Also

Project CorLib Overview

Class ApplicationException Overview


ApplicationException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class ApplicationException Overview


ApplicationException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class ApplicationException Overview


ApplicationException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class ApplicationException Overview


ArgumentException

ArgumentException

The exception that is thrown when one of the arguments provided to a method is not valid.

Implements:

Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
ParamName (get) | Returns the parameter name that caused the exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

Remarks

ArgumentException is thrown when a method is invoked and at least one of the passed arguments does not meet the parameter specification of the called method. When throwing an ArgumentException a meaningful error message describing the invalid argument, the name of the argument, as well as the expected range of values for the argument should be defined.

New exception classes derived from ArgumentException can be created starting with the ArgumentExceptionBase template class and modifying it accordingly.

ArgumentException uses the HResult COR_E_ARGUMENT, which is &H5.

See Also

Project CorLib Overview

Class ArgumentException Overview

Constructors

ExceptionMethods

Exception

ArgumentNullException

ArgumentOutOfRangeException


ArgumentException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Read Only.

See Also

Project CorLib Overview

Class ArgumentException Overview


ArgumentException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class ArgumentException Overview


ArgumentException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class ArgumentException Overview


ArgumentException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class ArgumentException Overview


ArgumentException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class ArgumentException Overview


ArgumentException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class ArgumentException Overview


ArgumentException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class ArgumentException Overview


ArgumentException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class ArgumentException Overview


ArgumentException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class ArgumentException Overview

Exception


ArgumentException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class ArgumentException Overview


ArgumentException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class ArgumentException Overview


ArgumentException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewArgumentException.

Read Only.

See Also

Project CorLib Overview

Class ArgumentException Overview


ArgumentException: ParamName (get)

ParamName

Returns the parameter name that caused the exception.

 Public Property Get ParamName ( ) As String

Return Values

String - The name of the parameter that caused the exception.

Remarks

Every ArgumentException should contain the name of the parameter that caused the exception.

Read Only.

See Also

Project CorLib Overview

Class ArgumentException Overview

Exception


ArgumentException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class ArgumentException Overview


ArgumentException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class ArgumentException Overview


ArgumentException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class ArgumentException Overview


ArgumentException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class ArgumentException Overview


ArgumentNullException

ArgumentNullException

The exception that is thrown when a null reference is passed to a method that does not accept it as a valid argument.

Implements:

ArgumentException
Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
ParamName (get) | Returns the parameter name that caused the exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

Remarks

ArgumentNullException is thrown in cases where an object reference is Nothing and is required, or an Array is unitialized and is required.

ArgumentNullException works the same as ArgumentException and provides no additional functionality. This exception is used to distinguish Null reference exceptions from other argument exceptions.

ArgumentNullException uses the HResult E_POINTER, which is &H5B.

See Also

Project CorLib Overview

Class ArgumentNullException Overview

Constructors

ExceptionMethods

Exception

ArgumentException

SystemException


ArgumentNullException: ArgumentException

ArgumentException

 Implements ArgumentException

Return Values

ArgumentException -

See Also

Project CorLib Overview

Class ArgumentNullException Overview


ArgumentNullException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Read Only.

See Also

Project CorLib Overview

Class ArgumentNullException Overview


ArgumentNullException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class ArgumentNullException Overview


ArgumentNullException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class ArgumentNullException Overview


ArgumentNullException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class ArgumentNullException Overview


ArgumentNullException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class ArgumentNullException Overview


ArgumentNullException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class ArgumentNullException Overview


ArgumentNullException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class ArgumentNullException Overview


ArgumentNullException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class ArgumentNullException Overview


ArgumentNullException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class ArgumentNullException Overview

Exception


ArgumentNullException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class ArgumentNullException Overview


ArgumentNullException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class ArgumentNullException Overview


ArgumentNullException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewArgumentNullException.

Read Only.

See Also

Project CorLib Overview

Class ArgumentNullException Overview


ArgumentNullException: ParamName (get)

ParamName

Returns the parameter name that caused the exception.

 Public Property Get ParamName ( ) As String

Return Values

String - The name of the parameter that caused the exception.

Remarks

Every ArgumentNullException should contain the name of the parameter that caused the exception.

Read Only.

See Also

Project CorLib Overview

Class ArgumentNullException Overview

Exception


ArgumentNullException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class ArgumentNullException Overview


ArgumentNullException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class ArgumentNullException Overview


ArgumentNullException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class ArgumentNullException Overview


ArgumentNullException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class ArgumentNullException Overview


ArgumentOutOfRangeException

ArgumentOutOfRangeException

The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method.

Implements:

ArgumentException
Exception
IObject
SystemException

Public:

Types:

Name | Description
InvocationMethod |

Properties:

Name | Description
ActualValue (get) | Returns the actual value that caused the exception to be thrown.
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
ParamName (get) | Returns the parameter name that caused the exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

Remarks

ArgumentOutOfRangeException is thrown when an argument is not Null and is outside of the allowable range of values.

An ArgumentOutOfRangeException works the same as an ArgumentException. It is used to distinguish between other argument exceptions and those that are out of a valid range.

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview

Constructors

ExceptionMethods

Exception

ArgumentException

SystemException


ArgumentOutOfRangeException: ActualValue (get)

ActualValue

Returns the actual value that caused the exception to be thrown.

 Public Property Get ActualValue ( ) As Variant

Return Values

Variant - A value of the parameter that caused the exception.

Read Only.

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview


ArgumentOutOfRangeException: ArgumentException

ArgumentException

 Implements ArgumentException

Return Values

ArgumentException -

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview


ArgumentOutOfRangeException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Read Only.

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview


ArgumentOutOfRangeException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview


ArgumentOutOfRangeException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview


ArgumentOutOfRangeException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview


ArgumentOutOfRangeException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview


ArgumentOutOfRangeException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview


ArgumentOutOfRangeException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview


ArgumentOutOfRangeException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview


ArgumentOutOfRangeException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview

Exception


ArgumentOutOfRangeException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview


ArgumentOutOfRangeException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview


ArgumentOutOfRangeException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewArgumentNullException.

Read Only.

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview


ArgumentOutOfRangeException: ParamName (get)

ParamName

Returns the parameter name that caused the exception.

 Public Property Get ParamName ( ) As String

Return Values

String - The name of the parameter that caused the exception.

Remarks

Every ArgumentNullException should contain the name of the parameter that caused the exception.

Read Only.

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview

Exception


ArgumentOutOfRangeException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview


ArgumentOutOfRangeException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview


ArgumentOutOfRangeException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview


ArgumentOutOfRangeException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class ArgumentOutOfRangeException Overview


ArithmeticException

ArithmeticException

This exception is used when a mathematical error has occurred.

Implements:

Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

Remarks

This exception is generally thrown by VBCorLib during mathematical operations, or value conversions from one datatype to another datatype. Such exceptions could be a Divide-By-Zero error or Overflow error.

See Also

Project CorLib Overview

Class ArithmeticException Overview

Constructors

ExceptionMethods

Exception


ArithmeticException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class ArithmeticException Overview


ArithmeticException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class ArithmeticException Overview


ArithmeticException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class ArithmeticException Overview


ArithmeticException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class ArithmeticException Overview


ArithmeticException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class ArithmeticException Overview


ArithmeticException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class ArithmeticException Overview


ArithmeticException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class ArithmeticException Overview


ArithmeticException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class ArithmeticException Overview


ArithmeticException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class ArithmeticException Overview

Exception


ArithmeticException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class ArithmeticException Overview


ArithmeticException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class ArithmeticException Overview


ArithmeticException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewArgumentException.

Read Only.

See Also

Project CorLib Overview

Class ArithmeticException Overview


ArithmeticException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class ArithmeticException Overview


ArithmeticException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class ArithmeticException Overview


ArithmeticException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class ArithmeticException Overview


ArithmeticException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class ArithmeticException Overview


ArrayList

ArrayList

A list that dynamically increases in size to hold a number of items.

Implements:

ICloneable
ICollection
IEnumerable
IList
IObject
IVersionable

Public:

Properties:

Name | Description
Capacity (get) | Gets the number of elements that the ArrayList can contain.
Capacity (let) | Sets the number of elements that the ArrayList can contain.
Count (get) | Returns the number of items in the list.
IsFixedSize (get) | Returns if the list is fixed-size.
IsReadOnly (get) | Returns if the list is read-only.
Item (let) | Sets the element at the specified index.
Item (set) | Sets the element at the specified index.

Methods:

Name | Description
Add | Adds a new item to the end of the list.
AddRange | Adds the items from a collection to the list.
BinarySearch | Searches the entire sorted ArrayList for an element using the specified comparer and returns the zero-based index of the element.
BinarySearchEx | Searches the entire sorted ArrayList for an element using the specified comparer and returns the zero-based index of the element.
Clear | Clears the list of all values.
Clone | Returns an ArrayList object containing a copy of the array in the original ArrayList.
Contains | Determines if the list contains a specific value.
CopyTo | Copies all of the items to an array.
CopyToEx | Copies a range of elements to an Array.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetEnumerator | Returns an enumerator for an ArrayList.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetRange | Returns an ArrayList object that is a windowed view into the original ArrayList.
IndexOf | Returns the index of the first occurrence of the value in the list.
Insert | Inserts a value into the list at the specified index.
InsertRange | Inserts a collection of items into the list.
LastIndexOf | Returns the index of the last occurrence of a value in the list.
Remove | Removes a value from the list.
RemoveAt | Removes a value from the list at a specified index.
RemoveRange | Remove a set of items from the list.
Reverse | Reverses the list of items in the list.
SetRange | Sets the items in the list to a collection of items.
Sort | Sorts the items in the entire ArrayList or range of elements in ArrayList.
ToArray | Returns an array of the items in the list.
ToString | Returns a string representation of this object instance.
TrimToSize | Sets the capacity to the number of items in the list.

Remarks

This class contains an internal array of Variants. As new items are added to the list, the capacity will increase as necessary.

The capacity of the list is the current number of elements in the internal array.

To lower the capacity to save memory, use the TrimToSize method, or set Capacity directly.

The default capacity is 16.

Elements in this collection can be accessed using an integer index. Indexes in this collection are zero-based.

Examples

Public Sub Main()
    Dim List As New ArrayList

    List.Add "Hello"
    List.Add "World"
    List.Add "!"

    Debug.Print "List"
    Debug.Print CorString.Format("    Count:    {0}", List.Count)
    Debug.Print CorString.Format("    Capacity: {0}", List.Capacity)
    Debug.Print "      Values:"
    PrintValues List
End Sub

Private Sub PrintValues(ByVal List As IEnumerable)
    Dim Value As Variant

    For Each Value In List
        Debug.Print "  " & Value;
    Next
End Sub

' This code produces the following:
'
' List
'     Count:    3
'     Capacity: 16
'     Values:  Hello  World  !

See Also

Project CorLib Overview

Class ArrayList Overview

Constructors

ArrayListStatic


ArrayList: Add

Add

Adds a new item to the end of the list.

 Public Function Add(
      ByRef Value As Variant ) As Long

Parameters

Value
[ByRef] Variant. The item to be added to the list.

Return Values

Long - The index at which the item was added.

Remarks

As items are added, the capacity is increased as necessary. The items are appended to the end of the list and maintain the order they were added, provided no other method is used to change the order, such as Insert or Remove.

Exceptions

Exception | Condition
NotSupportedException | The ArrayList is read-only -or- The ArrayList is fixed-size.

Examples

In the following example, several items are added to an ArrayList object and then iterated over, displaying the items in the list.

Private Sub Main()
    Dim List As New ArrayList

    ' add several elements to the ArrayList
    List.Add "Humpty"
    List.Add "Dumpty"
    List.Add "sat"
    List.Add "on"
    List.Add "a"
    List.Add "wall."

    ' Display the contents of the ArrayList
    PrintValues List
End Sub

Private Sub PrintValues(ByVal Source As IEnumerable)
    Dim Value As Variant

    ' Iterate over the list
    For Each Value In Source
        ' Write each value onto the same line
        Debug.Print Value; " ";
    Next
End Sub

' This example produces the following output.
'
'    Humpty Dumpty sat on a wall.

See Also

Project CorLib Overview

Class ArrayList Overview

AddRange

Insert

Count


ArrayList: AddRange

AddRange

Adds the items from a collection to the list.

 Public Sub AddRange(
      ByRef Source As Variant )

Parameters

Source
[ByRef] Variant. The collection of items to add.

Remarks

The collection can be a VBA.Collection, ICollection object, or an Array.

The elements are added to the end of the list in the same order as a For..Each loop produces.

If the number of elements to be added is more than the available capacity in the ArrayList, then the capacity is increased to accommodate the collection of elements.

Exceptions

Exception Type | Condition
ArgumentNullException | c is an uninitialized array. -or- c is Nothing.
NotSupportedException | The ArrayList is read-only -or- The ArrayList is fixed size.
InvalidCastException | c is not a VBA.Collection, ICollection object, or an Array.

Examples

The following example demonstrates using the AddRange method to add a collection of items.

Private Sub Main()
    Dim List As New ArrayList
    Dim Words() As String

    Words = NewStrings("The", "fox", "jumps", "over", "the", "dog")

    List.AddRange Words

    PrintValues List
End Sub

Private Sub PrintValues(ByVal Source As IEnumerable)
    Dim Value As Variant

    Console.WriteValue vbTab

    For Each Value In Source
        Debug.Print CorString.Format("{0} ", Value);
    Next Value
End Sub

' This example produces the following output.
'
'    The fox jumps over the dog

See Also

Project CorLib Overview

Class ArrayList Overview

ICollection

Capacity

Count

Add

InsertRange

SetRange

RemoveRange


ArrayList: BinarySearch

BinarySearch

Searches the entire sorted ArrayList for an element using the specified comparer and returns the zero-based index of the element.

 Public Function BinarySearch(
      ByRef Value As Variant,
      Optional ByVal Comparer As IComparer ) As Long

Parameters

Value
[ByRef] Variant. The value to search for. The value can be Null or Empty.
Comparer
[ByVal] Optional. IComparer. A comparer object to use when comparing values.
-or-
Nothing to use the default comparer.

Return Values

Long - The index at which the value was found, or a negative value indicating the value was not found.

Remarks

The search assumes the ArrayList is sorted.

The default comparison method requires the values to be of the same intrinsic Visual Basic datatype. A vbLong will fail to compare against a vbInteger, for instance. Objects must implement the IComparable interface or an exception will be thrown.

The comparison behaviour can be overridden by supplying a custom IComparer compatible object.

If the return value is negative, then the value was not found in the list. To determine where the value should have been found, negate (Not) the return value.

Exceptions

Exception | Condition
ArgumentException | Comparer is Nothing and neither Value nor the elements in the list support the IComparable interface.
InvalidOperationException | Comparer is Nothing and Value is not the same type as the elements in the ArrayList.

Examples

The following code demonstrates how to search for a value in an ArrayList using BinarySearch.

Private Sub Main()
    Dim List As New ArrayList
    Dim i As Integer

    For i = 1 To 5
        List.Add i * 2
    Next i

    ' Display the current values in the list
    Debug.Print "The ArrayList contains:"
    PrintValues List

    ' Find a non-existing value
    FindValue List, 7

    ' Find an existing value
    FindValue List, 4
End Sub

Private Sub PrintValues(ByVal en As IEnumerable)
    Dim v As Variant

    Debug.Print vbTab;

    For Each v In en
        Debug.Print CorString.Format("{0} ", v);
    Next v

    Debug.Print
End Sub

Private Sub FindValue(ByVal List As ArrayList, ByVal value As Variant)
    Dim Index As Long

    Index = List.BinarySearch(value)

    If Index < 0 Then
        Debug.Print CorString.Format("The value ({0}) was not found in the list. The next largest value was found at index {1}.", value, Not Index)
    Else
        Debug.Print CorString.Format("the value ({0}) was found at index {1}.", value, Index)
    End If
End Sub

' This code produces the following output.
'
' The ArrayList contains:
'     2 4 6 8 10
' The value (7) was not found in the list. the next largest value was found at index 3.
' The value (4) was found at index 1.

See Also

Project CorLib Overview

Class ArrayList Overview

IComparer

IComparable


ArrayList: BinarySearchEx

BinarySearchEx

Searches the entire sorted ArrayList for an element using the specified comparer and returns the zero-based index of the element.

 Public Function BinarySearchEx(
      ByVal Index As Long,
      ByVal Count As Long,
      ByRef Value As Variant,
      Optional ByVal Comparer As IComparer ) As Long

Parameters

Index
[ByVal] Long. The zero-based index to begin the search.
Count
[ByVal] Long. The number of elements to search in from the Index.
Value
[ByRef] Variant. The value to search for. The value can be Null or Empty.
Comparer
[ByVal] Optional. IComparer. A comparer object to use when comparing values.
-or-
Nothing to use the default comparer.

Return Values

Long - The index at which the value was found, or a negative value indicating the value was not found.

Remarks

The search assumes the ArrayList is sorted.

The default comparison method requires the values to be of the same intrinsic Visual Basic datatype. A vbLong will fail to compare against a vbInteger, for instance. Objects must implement the IComparable interface or an exception will be thrown.

The comparison behaviour can be overridden by supplying a custom IComparer compatible object.

If the return value is negative, then the value was not found in the list. To determine where the value should have been found, negate (Not) the return value.

Exceptions

Exception | Condition
ArgumentException | Index and Count do not denote a valid range in the ArrayList. -or- Comparer is Nothing and neither Value nor the elements of ArrayList implement the IComparer interface.
InvalidOperationException | Comparer is Nothing and Value is not of the same type as the elements of the ArrayList.
ArgumentOutOfRangeException | Index is less than zero. -or- Count is less than zero.

See Also

Project CorLib Overview

Class ArrayList Overview

IComparer

IComparable


ArrayList: Capacity (get)

Capacity

Gets the number of elements that the ArrayList can contain.

 Public Property Get Capacity ( ) As Long

Return Values

Long - The number of elements allocated internally.

Remarks

Capacity is the number of elements that the ArrayList can store. Count is the number of elements that are actually in the ArrayList.

Capacity is always greater than or equal to Count. If Count exceeds Capacity while adding elements, the capacity is automatically increased by reallocating the internal array before copying the old elements and adding the new elements.

The capacity can be decreased by calling TrimToSize or by setting the Capacity property explicitly. When the value of Capacity is set explicitly, the internal array is also reallocated to accommodate the specified capacity.

If the capacity is set to zero, then it is set to the default capacity of 16.

Read/Write.

See Also

Project CorLib Overview

Class ArrayList Overview

Count


ArrayList: Capacity (let)

Capacity

Sets the number of elements that the ArrayList can contain.

 Public Property Let Capacity(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The number of elements to set the array to.

Remarks

Capacity is the number of elements that the ArrayList can store. Count is the number of elements that are actually in the ArrayList.

Capacity is always greater than or equal to Count. If Count exceeds Capacity while adding elements, the capacity is automatically increased by reallocating the internal array before copying the old elements and adding the new elements.

The capacity can be decreased by calling TrimToSize or by setting the Capacity property explicitly. When the value of Capacity is set explicitly, the internal array is also reallocated to accommodate the specified capacity.

If the capacity is set to zero, then it is set to the default capacity of 16.

Read/Write.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Capacity is set to a value less than Count.
OutOfMemoryException | There is not enough memory available on the system.

See Also

Project CorLib Overview

Class ArrayList Overview

Count


ArrayList: Clear

Clear

Clears the list of all values.

 Public Sub Clear ( )

Remarks

Count is set to zero, and references to other objects from elements of the collection are also released.

Capacity remains unchanged. To reset the capacity of the ArrayList, call TrimToSize or set the Capacity property directly. Trimming an empty ArrayList sets the capacity of the ArrayList to the default capacity.

This method is an O(n) operation, where n is Count.

Exceptions

Exception | Condition
NotSupportedException | The ArrayList is read-only. -or- The ArrayList is fixed size.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: Clone

Clone

Returns an ArrayList object containing a copy of the array in the original ArrayList.

 Public Function Clone ( ) As ArrayList

Return Values

ArrayList - A copy of the original object.

Remarks

When the list of elements is cloned, elements that are reference types are not cloned. The cloned list will contain reference pointers to the same objects as the original list has.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: Contains

Contains

Determines if the list contains a specific value.

 Public Function Contains(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to search for.

Return Values

Boolean - True if Value is found in the list; False otherwise.

Remarks

This method performs a linear search of all elements in the list comparing each element with the value being searched for. If the value is an object, then if it implements the IObject interface the Equals method is used to test equality, otherwise the Is operator is used to compare two objects.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: CopyTo

CopyTo

Copies all of the items to an array.

 Public Sub CopyTo(
      ByRef Arr As Variant,
      Optional ByRef ArrayIndex As Variant )

Parameters

Arr
[ByRef] Variant. The array to copy the items to.
ArrayIndex
[ByRef] Optional. Variant. The index to start copying items to in the destination array.

Remarks

The destination array must be large enough to hold all of the items. If an ArrayIndex is specified, then the destination array must be large enough to hold all of the items from that index on.

Exceptions

Exception | Condition
ArgumentNullException | The Arr is uninitialized.
ArgumentException | Arr is multidimension. -or- The number of elements in the ArrayList is greater than the destination Arr can contain.
InvalidCastException | Elements in the ArrayList cannot be converted to a compatible type of the destination Arr.

Examples

This example shows how to copy elements from an ArrayList into an existing array, replacing any elements in the destination array.

Private Sub Main()
    Dim Words As New ArrayList
    Dim Story() As String

    ' Create our initial story in a regular String array.
    Story = NewStrings("Humpty", "Dumpty", "sat", "on", "a", "wall.")

    ' Display the current story.
    Debug.Print "The initial story is:"
    PrintValues Story

    ' Create a new story in an ArrayList.
    Words.Add "Peter"
    Words.Add "Rabbit"
    Words.Add "slept"
    Words.Add "under"
    Words.Add "a"
    Words.Add "tree."

    ' Copies the third word to same word location in the array.
    Words.CopyToEx 2, Story, 2, 1

    ' Display the new story.
    Debug.Print "The story with 'sat' substituted by 'slept' is:"
    PrintValues Story

    ' Copies the first two elements to the first
    ' two elements in the array.
    Words.CopyToEx 0, Story, 0, 2

    ' Display the story with the new name.
    Debug.Print "The story with the name changed is:"
    PrintValues Story

    ' Increase the size of the story array.
    ReDim Preserve Story(0 To 11)

    ' Append the words to the end of the current story.
    Words.CopyTo Story, 6

    ' Display the final story.
    Debug.Print "The final story is:"
    PrintValues Story
End Sub

Private Sub PrintValues(ByRef s() As String)
    Dim i As Long

    Debug.Print vbTab;

    For i = LBound(s) To UBound(s)
        Debug.Print CorString.Format("{0} ", s(i));
    Next i

    Debug.Print
End Sub

' This code produces the following output.
'
' The initial story is:
'     Humpty Dumpty sat on a wall.
' The story with 'sat' substituted by 'slept' is:
'     Humpty Dumpty slept on a wall.
' The story with the name changed is:
'     Peter Rabbit slept on a wall.
' The final story is:
'     Peter Rabbit slept on a wall. Peter Rabbit slept under a tree.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: CopyToEx

CopyToEx

Copies a range of elements to an Array.

 Public Sub CopyToEx(
      ByVal Index As Long,
      ByRef Arr As Variant,
      ByVal ArrayIndex As Long,
      ByVal Count As Long )

Parameters

Index
[ByVal] Long. The zero-based index in the list to start copying from.
Arr
[ByRef] Variant. The array to copy the items to.
ArrayIndex
[ByVal] Long. The index in the destination array to start copying items to.
Count
[ByVal] Long. The number of items to copy.

Remarks

The destination array must be large enough to hold the number of elements being copied.

Exceptions

Exception | Condition
ArgumentNullException | The Arr is uninitialized.
ArgumentOutOfRangeException | Index is less than zero. -or- ArrayIndex is less than zero. -or- Count is less than zero.
ArgumentException | Arr is multidimension. -or- Index is equal to or greater than Count of the source ArrayList. -or- The number of elements from Index to the end of the source ArrayList is greater than the available space from ArrayIndex to the end of the destination Arr.
InvalidCastException | Elements in the ArrayList cannot be converted to a compatible type of the destination Arr.

Examples

This example shows how to copy elements from an ArrayList into an existing array, replacing any elements in the destination array.

Private Sub Main()
    Dim Words As New ArrayList
    Dim Story() As String

    ' Create our initial story in a regular String array.
    Story = NewStrings("Humpty", "Dumpty", "sat", "on", "a", "wall.")

    ' Display the current story.
    Debug.Print "The initial story is:"
    PrintValues Story

    ' Create a new story in an ArrayList.
    Words.Add "Peter"
    Words.Add "Rabbit"
    Words.Add "slept"
    Words.Add "under"
    Words.Add "a"
    Words.Add "tree."

    ' Copies the third word to same word location in the array.
    Words.CopyToEx 2, Story, 2, 1

    ' Display the new story.
    Debug.Print "The story with 'sat' substituted by 'slept' is:"
    PrintValues Story

    ' Copies the first two elements to the first
    ' two elements in the array.
    Words.CopyToEx 0, Story, 0, 2

    ' Display the story with the new name.
    Debug.Print "The story with the name changed is:"
    PrintValues Story

    ' Increase the size of the story array.
    ReDim Preserve Story(0 To 11)

    ' Append the words to the end of the current story.
    Words.CopyTo Story, 6

    ' Display the final story.
    Debug.Print "The final story is:"
    PrintValues Story
End Sub

Private Sub PrintValues(ByRef s() As String)
    Dim i As Long

    Debug.Print vbTab;

    For i = LBound(s) To UBound(s)
        Debug.Print CorString.Format("{0} ", s(i));
    Next i

    Debug.Print
End Sub

' This code produces the following output.
'
' The initial story is:
'     Humpty Dumpty sat on a wall.
' The story with 'sat' substituted by 'slept' is:
'     Humpty Dumpty slept on a wall.
' The story with the name changed is:
'     Peter Rabbit slept on a wall.
' The final story is:
'     Peter Rabbit slept on a wall. Peter Rabbit slept under a tree.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: Count (get)

Count

Returns the number of items in the list.

 Public Property Get Count ( ) As Long

Return Values

Long - The number of items in the list.

Read Only.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test equality on.

Return Values

Boolean - True if Value and this instance are the same instance; False otherwise.

See Also

Project CorLib Overview

Class ArrayList Overview

IObject


ArrayList: GetEnumerator

GetEnumerator

Returns an enumerator for an ArrayList.

 Public Function GetEnumerator(
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As IEnumerator

Parameters

Index
[ByRef] Optional. Variant. The zero-based index in the list to being enumeration.
Count
[ByRef] Optional. Variant. The number of items in the list to enumerate over.

Return Values

IEnumerator - An ArrayList enumerator

Remarks

This enumerator can be used in For..Each loops. To access the optional parameters, the GetEnumerator must be called instead of simply passing the object to the For..Each. This allows for a portion of the list to be enumerated.

Examples

This example shows several methods of enumerating over an ArrayList object.

Private Sub Main()
    Dim List As New ArrayList

    List.Add "The"
    List.Add "quick"
    List.Add "brown"
    List.Add "fox"

    ' Display the words using the standard For..Each method.
    Debug.Print "Using For..Each"
    IterateUsingForEach List

    ' Display the words using the enumerator manually.
    Debug.Print "Using an Enumerator"
    IterateUsingEnumerator List

    ' Display a subset of the list using For..Each.
    Debug.Print "Itertate Subset"
    IterateSubset List, 1, 2
End Sub

Private Sub IterateUsingForEach(ByVal List As ArrayList)
    Dim Word As Variant

    For Each Word In List
        Debug.Print vbTab & Word;
    Next Word

    Debug.Print
End Sub

Private Sub IterateUsingEnumerator(ByVal List As ArrayList)
    Dim En As IEnumerator

    Set En = List.GetEnumerator

    Do While En.MoveNext
        Debug.Print vbTab & En.Current;
    Loop

    Debug.Print
End Sub

Private Sub IterateSubset(ByVal List As ArrayList, ByVal StartIndex As Long, ByVal Count As Long)
    Dim Word As Variant
    Dim En As IEnumerator

    Set En = List.GetEnumerator(StartIndex, Count)

    Do While En.MoveNext
        Debug.Print CorString.Format("{0}word is '{1}'", vbTab, En.Current)
    Loop
End Sub

' The following output is produced by this code.
'
'    Using For..Each
'        The    quick    brown    fox
'    Using an Enumerator
'        The    quick    brown    fox
'    Itertate Subset
'        word is 'quick'
'        word is 'brown'

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class ArrayList Overview

IObject


ArrayList: GetRange

GetRange

Returns an ArrayList object that is a windowed view into the original ArrayList.

 Public Function GetRange(
      ByVal Index As Long,
      ByVal Count As Long ) As ArrayList

Parameters

Index
[ByVal] Long. The zero-based index in the original list to start the new view.
Count
[ByVal] Long. The number of elements in the original list to show in the view.

Return Values

ArrayList - An ArrayList that represents a subset view of the original list.

Remarks

This windowed view is the only way to then modify the original ArrayList. If the original list is modified some other way, then an exception is thrown the next time the ranged view is accessed.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: ICollection

ICollection

 Implements ICollection

Return Values

ICollection -

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: IEnumerable

IEnumerable

 Implements IEnumerable

Return Values

IEnumerable -

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: IList

IList

 Implements IList

Return Values

IList -

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: IndexOf

IndexOf

Returns the index of the first occurrence of the value in the list.

 Public Function IndexOf(
      ByRef Value As Variant,
      Optional ByRef StartIndex As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Value
[ByRef] Variant. The value to search the list for.
StartIndex
[ByRef] Optional. Variant. The zero-based index to begin the search in the list.
Count
[ByRef] Optional. Variant. The number of items in the list to search.

Return Values

Long - The index of the first occurrence of value, or -1 if the value was not found.

Remarks

This method determines equality by calling Object.Equals.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: Insert

Insert

Inserts a value into the list at the specified index.

 Public Sub Insert(
      ByVal Index As Long,
      ByRef Value As Variant )

Parameters

Index
[ByVal] Long. The zero-based index in which the value is to be inserted.
Value
[ByRef] Variant. The value to be inserted into the list.

Remarks

When a value is inserted, all items starting at the insertion point are moved out by one space. If Capacity is reached, the list will be expanded.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: InsertRange

InsertRange

Inserts a collection of items into the list.

 Public Sub InsertRange(
      ByVal Index As Long,
      ByRef Source As Variant )

Parameters

Index
[ByVal] Long. The zero-based index at which the items will be inserted.
Source
[ByRef] Variant. The collection of items to be inserted into the list.

Remarks

When the items are inserted, the items starting at Index will be moved out a number of spaces equal to the number of items to be inserted. If Capacity is reached, the list will be expanded.

The collection can be a VBA.Collection,ICollection object, or an Array.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: IsFixedSize (get)

IsFixedSize

Returns if the list is fixed-size.

 Public Property Get IsFixedSize ( ) As Boolean

Return Values

Boolean - True if the list is fixed-size; otherwise False

Remarks

All operations on the list can be executed as long as the number of items dont change, this includes the capacity of the underlying array.

Read Only.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: IsReadOnly (get)

IsReadOnly

Returns if the list is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - True if the list is read-only; otherwise False

Remarks

All operations on the list can be executed as long as the number of items dont change, and the items aren't changed in the list.

Read Only.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: Item (let)

Item

Sets the element at the specified index.

 Public Property Let Item(
      ByVal Index As Long,
      ByRef Value As Variant )

Parameters

Index
[ByVal] Long. The zero-based index in the list to set the value.
Value
[ByRef] Variant. The value to set in the list.

Remarks

ArrayList accepts allows duplicate elements.

This property provides the ability to access a specific element in the collection by using the following syntax: MyCollection(index).

ArrayList implements Item as the default property.

Retrieving the value of this property is an O(1) operation; setting the property is also an O(1) operation.

Read/Write.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Index is less than zero. -or- Index is equal to or greater than Count.

Examples

The example demonstrates how to directly set a value in an ArrayList.

Private Sub Main()
    Dim List As New ArrayList
    Dim Item As Variant

    List.AddRange Array("My", "name", "is", "Earl")

    Debug.Print "Original list contents."
    PrintValues List
    Debug.Print

    List(2) = "isn't"

    Debug.Print "Updated list contents."
    PrintValues List
End Sub

Private Sub PrintValues(ByVal List As IEnumerable)
    Dim Value As Variant

    For Each Value In List
        Debug.Print Value & " ";
    Next

    Debug.Print
End Sub

' The example produces the following output.
'    Original list contents.
'    My Name Is Earl
'
'    Updated list contents.
'    My name isn't Earl

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: Item (set)

Item

Sets the element at the specified index.

 Public Property Set Item(
      ByVal Index As Long,
      ByRef Value As Variant )

Parameters

Index
[ByVal] Long. The zero-based index in the list to set the value.
Value
[ByRef] Variant. The value to set in the list.

Remarks

ArrayList accepts allows duplicate elements.

This property provides the ability to access a specific element in the collection by using the following syntax: MyCollection(index).

ArrayList implements Item as the default property.

Retrieving the value of this property is an O(1) operation; setting the property is also an O(1) operation.

Read/Write.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Index is less than zero. -or- Index is equal to or greater than Count.

Examples

The example demonstrates how to directly set a value in an ArrayList.

Private Sub Main()
    Dim List As New ArrayList
    Dim Item As Variant

    List.AddRange Array("My", "name", "is", "Earl")

    Debug.Print "Original list contents."
    PrintValues List
    Debug.Print

    List(2) = "isn't"

    Debug.Print "Updated list contents."
    PrintValues List
End Sub

Private Sub PrintValues(ByVal List As IEnumerable)
    Dim Value As Variant

    For Each Value In List
        Debug.Print Value & " ";
    Next

    Debug.Print
End Sub

' The example produces the following output.
'    Original list contents.
'    My Name Is Earl
'
'    Updated list contents.
'    My name isn't Earl

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: IVersionable

IVersionable

 Implements IVersionable

Return Values

IVersionable -

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: LastIndexOf

LastIndexOf

Returns the index of the last occurrence of a value in the list.

 Public Function LastIndexOf(
      ByRef Value As Variant,
      Optional ByRef StartIndex As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Value
[ByRef] Variant. The value to search for in the list.
StartIndex
[ByRef] Optional. Variant. The zero-based index to start searching from.
Count
[ByRef] Optional. Variant. The number of items to be searched.

Return Values

Long - The index of the last occurrence of the value, or -1 if not found.

Remarks

The search is performed from the end of the list towards the beginning.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: Remove

Remove

Removes a value from the list.

 Public Sub Remove(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. The value to be removed.

Remarks

If the value is an object, then it must be the same instance of the object to be removed.

When removing an item, the remaining items maintain there current order relative to the other items.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: RemoveAt

RemoveAt

Removes a value from the list at a specified index.

 Public Sub RemoveAt(
      ByVal Index As Long )

Parameters

Index
[ByVal] Long. The zero-based index in the list to remove the item.

Remarks

When removing an item, the remaining items maintain there current order relative to the other items.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: RemoveRange

RemoveRange

Remove a set of items from the list.

 Public Sub RemoveRange(
      ByVal Index As Long,
      ByVal Count As Long )

Parameters

Index
[ByVal] Long. The zero-based index to start removing items.
Count
[ByVal] Long. The number of items to remove.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: Reverse

Reverse

Reverses the list of items in the list.

 Public Sub Reverse(
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant )

Parameters

Index
[ByRef] Optional. Variant. The zero-based index to start reversing items.
Count
[ByRef] Optional. Variant. The number of items to include in the reverse.

Remarks

If no parameters are supplied, then then entire list will be reversed.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: SetRange

SetRange

Sets the items in the list to a collection of items.

 Public Sub SetRange(
      ByVal Index As Long,
      ByRef Source As Variant )

Parameters

Index
[ByVal] Long. The zero-based index at which to start setting items.
Source
[ByRef] Variant. A collection of items to set in the list.

Remarks

The number of items in the list is not changed, nor is the size of the list increased. Only existing items in the list can be set to the items in the collection. This overwrites existing items with new items.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: Sort

Sort

Sorts the items in the entire ArrayList or range of elements in ArrayList.

 Public Sub Sort(
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant,
      Optional ByVal Comparer As IComparer )

Parameters

Index
[ByRef] Optional. Variant. The zero-based index to start sorting the items.
Count
[ByRef] Optional. Variant. The length of the range to sort.
Comparer
[ByVal] Optional. IComparer. The IComparer implementation to use when comparing elements.
-or-
A Nothing reference to use the default Comparer implementation.

Remarks

If comparer is set to Nothing, this method performs a comparison sort (also called an unstable sort); that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal. To perform a stable sort, you must implement a custom IComparer interface.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Index is less than zero. -or- Count is less than zero.
ArgumentException | Index and Count do not specify a valid range in the ArrayList.
InvalidOperationException | An error occurred while comparing two elements.

Examples

The following code example shows how to sort the values in a range of elements in an ArrayList using the default comparer and a custom comparer that reverses the sort order.

There are two modules created for this example. A BAS module containing the Main method and a Class module implementing the IComparer interface.

The following is a Visual Basic Class module named MyReverserClass.

Option Explicit
Implements IComparer

Private mComparer As New CaseInsensitiveComparer

Public Function Compare(ByRef a As Variant, ByRef b As Variant) As Long
    Compare = mComparer.Compare(b, a)
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IComparer
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IComparer_Compare(a As Variant, b As Variant) As Long
    IComparer_Compare = Compare(a, b)
End Function

The following is a Visual Basic BAS module containing Main start-up method.

Public Sub Main()
    Dim List As New ArrayList
    Dim MyComparer As New MyReverserClass

    List.Add "The"
    List.Add "QUICK"
    List.Add "BROWN"
    List.Add "FOX"
    List.Add "jumped"
    List.Add "over"
    List.Add "the"
    List.Add "lazy"
    List.Add "dog"

    Debug.Print "The ArrayList initially contains the following values:"
    PrintIndexAndValues List

    List.Sort 1, 3, Nothing
    Debug.Print "After sorting from index 1 to index 3 with the default comparer:"
    PrintIndexAndValues List

    List.Sort 1, 3, MyComparer
    Debug.Print "After sorting from index 1 to index 3 with the reverse case-insensitive comparer:"
    PrintIndexAndValues List
End Sub

Private Sub PrintIndexAndValues(ByVal List As ArrayList)
    Dim i As Long

    For i = 0 To List.Count - 1
        Debug.Print CorString.Format(t("\t[{0}]:\t{1}"), i, List(i))
    Next

    Debug.Print
End Sub

' This code produces the following output (individual values may vary because they are randomly generate):
'
' The ArrayList initially contains the following values:
'    [0]:    The
'    [1]:    QUICK
'    [2]:    BROWN
'    [3]:    FOX
'    [4]:    jumped
'    [5]:    over
'    [6]:    the
'    [7]:    lazy
'    [8]:    dog
'
' After sorting from index 1 to index 3 with the default comparer:
'    [0]:    The
'    [1]:    BROWN
'    [2]:    FOX
'    [3]:    QUICK
'    [4]:    jumped
'    [5]:    over
'    [6]:    the
'    [7]:    lazy
'    [8]:    dog
'
' After sorting from index 1 to index 3 with the reverse case-insensitive comparer:
'    [0]:    The
'    [1]:    QUICK
'    [2]:    FOX
'    [3]:    BROWN
'    [4]:    jumped
'    [5]:    over
'    [6]:    the
'    [7]:    lazy
'    [8]:    dog

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: ToArray

ToArray

Returns an array of the items in the list.

 Public Function ToArray(
      Optional ByVal ArrayType As VbVarType = vbVariant ) As Variant

Parameters

ArrayType
[ByVal] Optional. VbVarType. The specific array type to return.

Default: vbVariant

Return Values

Variant - An array of items in the list.

Remarks

If an array type other than variant is specified, then the list attempts to convert each item in the list to the specific array type requested. If an item cannot be converted, then an exception is thrown.

No items will be narrowed in the conversion. For example, a Double will not be converted to a Long. An exception will be thrown.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayList: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class ArrayList Overview

IObject


ArrayList: TrimToSize

TrimToSize

Sets the capacity to the number of items in the list.

 Public Sub TrimToSize ( )

Remarks

This will decrease the size of the internal array. This can save memory if you know that no more items will be added to the list.

See Also

Project CorLib Overview

Class ArrayList Overview


ArrayListStatic

ArrayListStatic

Represents the static methods of the ArrayList class.

Public:

Methods:

Name | Description
Adapter | Creates an object that allows any IList object to be treated as an ArrayList instance.
FixedSize | Returns an ArrayList object that is wrapped in a fixed-size object.
ReadOnly | Returns an ArrayList object wrapped inside a read-only list.
Repeat | Creates a new ArrayList and fills it with the supplied value the specified number of times.

Remarks

This class cannot be directly instantiated. In order to access the method of this class, use the ArrayList.Method syntax.

 Set ReadOnlyList = ArrayList.ReadOnly(list)

See Also

Project CorLib Overview

Class ArrayListStatic Overview

ArrayList


ArrayListStatic: Adapter

Adapter

Creates an object that allows any IList object to be treated as an ArrayList instance.

 Public Function Adapter(
      ByVal List As IList ) As ArrayList

Parameters

List
[ByVal] IList. The list to be wrapped as an ArrayList instance.

Return Values

ArrayList - An IList object that can be used like an ArrayList.

Remarks

The adapter gives all IList objects the ability to be used anywhere an ArrayList instance would be used instead.

Examples

The following example creates a wrapper around an IList object to be treated as an ArrayList. Call using the following syntax:

 Set List = ArrayList.Adapter(OriginalList)

See Also

Project CorLib Overview

Class ArrayListStatic Overview


ArrayListStatic: FixedSize

FixedSize

Returns an ArrayList object that is wrapped in a fixed-size object.

 Public Function FixedSize(
      ByVal List As ArrayList ) As ArrayList

Parameters

List
[ByVal] ArrayList. The ArrayList to be wrapped.

Return Values

ArrayList - The wrapped ArrayList.

Remarks

Passing this object around provides access to the underlying ArrayList, however, prevents the list from changing size. The current values in the list can be modified, but the size of the list cannot change.

Examples

The following example gets a fixes size version of an ArrayList.

 Set FixedSizeList = ArrayList.FixedSize(OriginalList)

See Also

Project CorLib Overview

Class ArrayListStatic Overview


ArrayListStatic: ReadOnly

ReadOnly

Returns an ArrayList object wrapped inside a read-only list.

 Public Function ReadOnly(
      ByVal List As ArrayList ) As ArrayList

Parameters

List
[ByVal] ArrayList. The ArrayList to wrap.

Return Values

ArrayList - The read-only ArrayList wrapper around List.

Remarks

Passing the object around provides access to the underlying ArrayList, however, the list cannot be changed in size or content.

Examples

The following example gets a read-only version of an ArrayList.

 Set ReadOnlyList = ArrayList.ReadOnly(OriginalList)

See Also

Project CorLib Overview

Class ArrayListStatic Overview


ArrayListStatic: Repeat

Repeat

Creates a new ArrayList and fills it with the supplied value the specified number of times.

 Public Function Repeat(
      ByRef Value As Variant,
      ByVal Count As Long ) As ArrayList

Parameters

Value
[ByRef] Variant. The value to fill the ArrayList with.
Count
[ByVal] Long. The number of times the value is to be added to the list.

Return Values

ArrayList - An ArrayList with Count elements, all of which are copies of Value.

Examples

The following example creates an ArrayList containing 20 strings with the letter "a".

 Set List = ArrayList.Repeat("a", 20)

See Also

Project CorLib Overview

Class ArrayListStatic Overview


ArrayTypeMismatchException

ArrayTypeMismatchException

Represents an exception caused by two arrays not being compatible.

Implements:

Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

Remarks

Generally this exception is thrown when elements in one array cannot be converted to elements in a second array.

See Also

Project CorLib Overview

Class ArrayTypeMismatchException Overview

Constructors

ExceptionMethods

Exception

SystemException


ArrayTypeMismatchException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class ArrayTypeMismatchException Overview


ArrayTypeMismatchException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class ArrayTypeMismatchException Overview


ArrayTypeMismatchException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class ArrayTypeMismatchException Overview


ArrayTypeMismatchException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class ArrayTypeMismatchException Overview


ArrayTypeMismatchException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class ArrayTypeMismatchException Overview


ArrayTypeMismatchException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class ArrayTypeMismatchException Overview


ArrayTypeMismatchException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class ArrayTypeMismatchException Overview


ArrayTypeMismatchException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class ArrayTypeMismatchException Overview


ArrayTypeMismatchException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class ArrayTypeMismatchException Overview

Exception


ArrayTypeMismatchException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class ArrayTypeMismatchException Overview


ArrayTypeMismatchException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class ArrayTypeMismatchException Overview


ArrayTypeMismatchException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewArgumentException.

Read Only.

See Also

Project CorLib Overview

Class ArrayTypeMismatchException Overview


ArrayTypeMismatchException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class ArrayTypeMismatchException Overview


ArrayTypeMismatchException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class ArrayTypeMismatchException Overview


ArrayTypeMismatchException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class ArrayTypeMismatchException Overview


ArrayTypeMismatchException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class ArrayTypeMismatchException Overview


ASCIIEncoding

ASCIIEncoding

Provides a set of methods used to encode and decode chars to and from bytes in ASCII format.

Implements:

Encoding
IObject

Public:

Properties:

Name | Description
BodyName (get) | Gets the encoding name to be used in with the mail agent body tags.
CodePage (get) | Gets the code page identifier for this encoding.
DecoderFallback (get) | Gets the current DecoderFallback instance used by the encoding.
DecoderFallback (set) | Sets the DecoderFallback to be used by this encoding instance.
EncoderFallback (get) | Gets the current EncoderFallback instance used by the encoding.
EncoderFallback (set) | Sets the EncoderFallback to be used by this encoding instance.
EncodingName (get) | Gets the name of this encoding.
HeaderName (get) | Gets the encoding name to be used in with the mail agent header tags.
IsBrowserDisplay (get) | Gets if this encoding can be used by browsers to display text.
IsBrowserSave (get) | Gets if this encoding can be used to save data with this encoding.
IsMailNewsDisplay (get) | Gets if this encoding can be used to display mail and news by mail and news clients.
IsMailNewsSave (get) | Gets if this encoding can be used to save date by mail and news clients.
IsReadOnly (get) | When implemented in a derived class, gets a value indicating whether the current encoding is read-only.
IsSingleByte (get) | Gets if the current encoding uses single-byte code points.
WebName (get) | Gets the encoding name registered with the Internet Assigned Numbers Authority.
WindowsCodePage (get) | Gets the Windows Operating Systems code page for this encoding.

Methods:

Name | Description
Clone | Creates a clone of the current Encoding instance.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetByteCount | Calculates the number of bytes produced by encoding the characters in the specified string or character array.
GetBytes | Encodes a set of characters into an array of bytes.
GetBytesEx | Encodes a set of characters into an array of bytes, returning the number of bytes produced.
GetCharCount | Returns the number of characters that would be produced by decoding a byte array.
GetChars | Decodes a set of bytes into a set of characters.
GetCharsEx | Decodes a set of bytes into the supplied Integer array.
GetDecoder | Obtains a decoder that converts an ASCII encoded sequence of bytes into a sequence of Unicode characters.
GetEncoder | Obtains an encoder that converts a sequence of Unicode characters into an ASCII encoded sequence of bytes.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetMaxByteCount | Returns the maximum number of bytes that can be created from a specific number of characters.
GetMaxCharCount | Returns the maximum number of characters than can be decoded from the number of bytes specified.
GetPreamble | Returns an array of bytes that represents this encoding.
GetString | Decodes a range of bytes into a String.
ToString | Returns a string representation of this object instance.

Remarks

Encoding is the process of transforming a set of Unicode characters into a sequence of bytes. Decoding is the process of transforming a sequence of encoded bytes into a set of Unicode characters.

ASCIIEncoding corresponds to the Windows code page 20127. Because ASCII is a 7-bit encoding, ASCII characters are limited to the lowest 128 Unicode characters, from U+0000 to U+007F. If you use the default encoder returned by the Encoding.ASCII property or the ASCIIEncoding constructor, characters outside that range are replaced with a question mark (?) before the encoding operation is performed. Because the ASCIIEncoding class supports only a limited character set, the UTF8Encoding, UnicodeEncoding, and UTF32Encoding classes are better suited for globalized applications. The following considerations can help you to decide whether to use ASCIIEncoding:

  • Some protocols require ASCII or a subset of ASCII. In these cases, ASCII encoding is appropriate.
  • If an 8-bit encoding is expected, ASCII probably isnt the correct choice. Instead, consider using UTF-8. For the characters U+0000 through U+007F, the results are identical, but all Unicode characters are representable in UTF-8, which avoids data loss.
Caution
ASCIIEncoding does not provide error detection. For security reasons, you should use UTF8Encoding, UnicodeEncoding, or UTF32Encoding and enable error detection.

The GetByteCount method determines how many bytes result in encoding a set of Unicode characters, and the GetBytes method performs the actual encoding.

Likewise, the GetCharCount method determines how many characters result in decoding a sequence of bytes, and the GetChars and GetString methods perform the actual decoding.

Note that the default ASCIIEncoding constructor by itself might not have the appropriate behavior for your application. You might want to consider setting the EncoderFallback or DecoderFallback property to EncoderExceptionFallback or DecoderExceptionFallback to prevent sequences with the 8th bit set. Custom behavior might also be appropriate for these cases.

Examples

The following example demonstrates how to encode Unicode characters into ASCII. Notice the loss of data that occurs when your application uses ASCIIEncoding to encode Unicode characters outside of the ASCII range.

Public Sub Main()
    Dim ASCII           As New ASCIIEncoding
    Dim UnicodeString   As String
    Dim IndexOfPi       As Long
    Dim IndexOfSigma    As Long
    Dim EncodedBytes()  As Byte
    Dim DecodedString   As String
    Dim b               As Variant

    Set Console.OutputEncoding = Encoding.UTF8

    ' A Unicode string with two characters outside the ASCII code range.
    UnicodeString = t("This Unicode string contains two characters with codes outside the ASCII code range, Pi (\u03a0) and Sigma (\u03a3).")

    Console.WriteLine "Original string:"
    Console.WriteLine UnicodeString

    ' Save positions of the special characters for later reference.
    IndexOfPi = InStr(UnicodeString, ChrW$(&H3A0))
    IndexOfSigma = InStr(UnicodeString, ChrW$(&H3A3))

    ' Encode string
    EncodedBytes = ASCII.GetBytes(UnicodeString)
    Console.WriteLine
    Console.WriteLine "Encoded bytes:"

    For Each b In EncodedBytes
        Console.WriteValue "[{0}]", b
    Next
    Console.WriteLine

    ' Notice that the special characters have been replaced with
    ' the value 63, which is the ASCII character code for '?'
    Console.WriteLine
    Console.WriteLine "Value as position of Pi characters: {0}", EncodedBytes(IndexOfPi - 1)
    Console.WriteLine "Value as position of Sigma character: {0}", EncodedBytes(IndexOfSigma - 1)

    ' Decode bytes back to string.
    ' Notice missing Pi and Sigma characters.
    DecodedString = ASCII.GetString(EncodedBytes)
    Console.WriteLine
    Console.WriteLine "Decoded bytes:"
    Console.WriteLine DecodedString
    Console.ReadKey
End Sub

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding

UTF8Encoding

UTF7Encoding

UTF32Encoding

UnicodeEncoding


ASCIIEncoding: BodyName (get)

BodyName

Gets the encoding name to be used in with the mail agent body tags.

 Public Property Get BodyName ( ) As String

Return Values

String - The body tag compatible encoding name.

Read Only.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


ASCIIEncoding: Clone

Clone

Creates a clone of the current Encoding instance.

 Public Function Clone ( ) As ASCIIEncoding

Return Values

ASCIIEncoding - A cloned version of this instance.

Remarks

A cloned instance will have the read-only limitations removed.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview


ASCIIEncoding: CodePage (get)

CodePage

Gets the code page identifier for this encoding.

 Public Property Get CodePage ( ) As Long

Return Values

Long - Code page identifier.

Read Only.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


ASCIIEncoding: DecoderFallback (get)

DecoderFallback

Gets the current DecoderFallback instance used by the encoding.

 Public Property Get DecoderFallback ( ) As DecoderFallback

Return Values

DecoderFallback - An object derived from DecoderFallback.

Remarks

The default will return an instance of DecoderReplacementFallback.

Read/Write.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview


ASCIIEncoding: DecoderFallback (set)

DecoderFallback

Sets the DecoderFallback to be used by this encoding instance.

 Public Property Set DecoderFallback(
      ByVal Value As DecoderFallback )

Parameters

Value
[ByVal] DecoderFallback. The DecoderFallback instance to set.

Remarks

By default an Encoding instance is marked as read-only and setting this value will result in an InvalidOperationException being thrown. If a clone of the instance is made, then it will become read-write and allow the setting of the value.

Read/Write.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview


ASCIIEncoding: EncoderFallback (get)

EncoderFallback

Gets the current EncoderFallback instance used by the encoding.

 Public Property Get EncoderFallback ( ) As EncoderFallback

Return Values

EncoderFallback - An object derived from EncoderFallback.

Remarks

The default will return an instance of EncoderReplacementFallback.

Read/Write.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview


ASCIIEncoding: EncoderFallback (set)

EncoderFallback

Sets the EncoderFallback to be used by this encoding instance.

 Public Property Set EncoderFallback(
      ByVal Value As EncoderFallback )

Parameters

Value
[ByVal] EncoderFallback. The EncoderFallback instance to set.

Remarks

By default an Encoding instance is marked as read-only and setting this value will result in an InvalidOperationException being thrown. If a clone of the instance is made, then it will become read-write and allow the setting of the value.

Read/Write.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview


ASCIIEncoding: Encoding

Encoding

 Implements Encoding

Return Values

Encoding -

See Also

Project CorLib Overview

Class ASCIIEncoding Overview


ASCIIEncoding: EncodingName (get)

EncodingName

Gets the name of this encoding.

 Public Property Get EncodingName ( ) As String

Return Values

String - The encodings name.

Read Only.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


ASCIIEncoding: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

IObject


ASCIIEncoding: GetByteCount

GetByteCount

Calculates the number of bytes produced by encoding the characters in the specified string or character array.

 Public Function GetByteCount(
      ByRef Chars As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Chars
[ByRef] Variant. The string or character array containg the characters to encode.
Index
[ByRef] Optional. Variant. The index of the first character to encode.
Count
[ByRef] Optional. Variant. The number of characters to encode.

Return Values

Long - The number of bytes produced by encoding the specified characters.

Remarks

To calculate the exact array size required by GetBytes to store the resulting bytes, the application uses GetByteCount. To calculate the maximum array size, the application should use GetMaxByteCount. The GetByteCount method generally allows allocation of less memory, while the GetMaxByteCount method generally executes faster.

Exception | Condition
ArgumentNullException | Chars is null.
ArgumentOutOfRangeException | Index is less than the LBound of a character array or less than zero for a string. -or- Count is less than zero. -or- Index and Count do not denote a valid range in Chars.
EncoderFallbackException | A fallback occurred -and- EncoderFallback is set to EncoderExceptionFallback.

Examples

The following example demonstrates how to use the GetByteCount method to return the number of bytes required to encode an array of Unicode characters using ASCIIEncoding.

    Dim s           As String
    Dim Chars()     As Integer
    Dim ASCII       As New ASCIIEncoding
    Dim ByteCount   As Long

    s = "ASCII Encoding Example"
    ByteCount = ASCII.GetByteCount(s)
    Debug.Print CorString.Format("{0} bytes needed to encode string.", ByteCount)
    Debug.Print

    Chars = NewChars(ChrW$(&H23), ChrW$(&H25), ChrW$(&H3A0), ChrW$(&H3A3))
    ByteCount = ASCII.GetByteCount(Chars, 1, 2)
    Debug.Print CorString.Format("{0} bytes need to encode characters.", ByteCount)
End Sub

' This code produces the following output.
'
'   22 bytes needed to encode string.
'
'   2 bytes need to encode characters.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding

GetBytes

GetMaxByteCount

GetEncoder


ASCIIEncoding: GetBytes

GetBytes

Encodes a set of characters into an array of bytes.

 Public Function GetBytes(
      ByRef Chars As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Chars
[ByRef] Variant. The Integer array or String containing the set of characters to encode.
Index
[ByRef] Optional. Variant. The index of the first character to encode.
Count
[ByRef] Optional. Variant. The number of characters to encode.

Return Values

Byte() - A byte array containing the results of encoding the specified set of characters.

Remarks

If the data to be converted is available only in sequential blocks (such as data read from a stream) or if the amount of data is so large that it needs to be divided into smaller blocks, the application should use the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively, of an implemented class.

The GetByteCount method determines how many bytes result in encoding a set of Unicode characters, and the GetBytes method performs the actual encoding. The Encoding.GetBytes method expects discrete conversions, in contrast to the Encoder.GetBytes method, which handles multiple conversions on a single input stream.

Exceptions

Exception | Condition
ArgumentNullException | Chars is a null array.
ArgumentOutOfRangeException | Index is less than the lower-bound of Chars for an array or less than zero for a string. -or- Count is less than zero. -or- Index and Count do not denote a valid range in Chars.
EncoderFallbackException | A fallback occurred -and- EncoderFallback is set to EncoderExceptionFallback.

Examples

The following example determines the number of bytes required to encode a string or a range in the string, encodes the characters, and displays the resulting bytes.

Public Sub Main()
    Dim MyStr   As String
    Dim U7      As Encoding
    Dim U8      As Encoding
    Dim U16LE   As Encoding
    Dim U16BE   As Encoding
    Dim U32     As Encoding

    MyStr = t("za\u0306\u01FD\u03B2\uD8FF\uDCFF")

    Set U7 = Encoding.UTF7
    Set U8 = Encoding.UTF8
    Set U16LE = Encoding.Unicode
    Set U16BE = Encoding.BigEndianUnicode
    Set U32 = Encoding.UTF32

    Console.WriteLine "Encoding the entire string:"
    PrintCountsAndBytes MyStr, U7
    PrintCountsAndBytes MyStr, U8
    PrintCountsAndBytes MyStr, U16LE
    PrintCountsAndBytes MyStr, U16BE
    PrintCountsAndBytes MyStr, U32

    Console.WriteLine

    Console.WriteLine "Encoding the characters from index 4 through 6:"
    PrintCountsAndBytes2 MyStr, 4, 3, U7
    PrintCountsAndBytes2 MyStr, 4, 3, U8
    PrintCountsAndBytes2 MyStr, 4, 3, U16LE
    PrintCountsAndBytes2 MyStr, 4, 3, U16BE
    PrintCountsAndBytes2 MyStr, 4, 3, U32

    Console.ReadKey
End Sub

Private Sub PrintCountsAndBytes(ByVal s As String, ByVal Enc As Encoding)
    Dim IBC     As Long
    Dim IMBC    As Long
    Dim Bytes() As Byte

    Console.WriteValue "{0,-30} :", Enc.ToString

    IBC = Enc.GetByteCount(s)
    Console.WriteValue " {0,-3}", IBC

    IMBC = Enc.GetMaxByteCount(Len(s))
    Console.WriteValue " {0,-3} :", IMBC

    Bytes = Enc.GetBytes(s)

    PrintHexBytes Bytes
End Sub

Private Sub PrintCountsAndBytes2(ByVal s As String, ByVal Index As Long, ByVal Count As Long, ByVal Enc As Encoding)
    Dim IBC     As Long
    Dim IMBC    As Long
    Dim Bytes() As Byte

    Console.WriteValue "{0,-30} :", Enc.ToString

    IBC = Enc.GetByteCount(s, Index, Count)
    Console.WriteValue " {0,-3}", IBC

    IMBC = Enc.GetMaxByteCount(Count)
    Console.WriteValue " {0,-3} :", IMBC

    Bytes = Enc.GetBytes(s, Index, Count)

    PrintHexBytes Bytes
End Sub

Private Sub PrintHexBytes(ByRef Bytes() As Byte)
    Dim i As Long

    If CorArray.IsNullOrEmpty(Bytes) Then
        Console.WriteLine "<none>"
    Else
        For i = LBound(Bytes) To UBound(Bytes)
            Console.WriteValue "{0:X2} ", Bytes(i)
        Next

        Console.WriteLine
    End If
End Sub

' This example code produces the following output.
'
'    Encoding the entire string:
'    CorLib.UTF7Encoding            : 18  23  :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D
'    CorLib.UTF8Encoding            : 12  24  :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
'    CorLib.UnicodeEncoding         : 14  16  :7A 00 61 00 06 03 FD 01 B2 03 FF D8 FF DC
'    CorLib.UnicodeEncoding         : 14  16  :00 7A 00 61 03 06 01 FD 03 B2 D8 FF DC FF
'    CorLib.UTF32Encoding           : 24  32  :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00
'
'    Encoding the characters from index 4 through 6:
'    CorLib.UTF7Encoding            : 10  11  :2B 41 37 4C 59 2F 39 7A 2F 2D
'    CorLib.UTF8Encoding            : 6   12  :CE B2 F1 8F B3 BF
'    CorLib.UnicodeEncoding         : 6   8   :B2 03 FF D8 FF DC
'    CorLib.UnicodeEncoding         : 6   8   :03 B2 D8 FF DC FF
'    CorLib.UTF32Encoding           : 8   16  :B2 03 00 00 FF FC 04 00

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding

GetBytesEx

GetEncoder

GetByteCount

GetMaxByteCount


ASCIIEncoding: GetBytesEx

GetBytesEx

Encodes a set of characters into an array of bytes, returning the number of bytes produced.

 Public Function GetBytesEx(
      ByRef Chars As Variant,
      ByVal CharIndex As Long,
      ByVal CharCount As Long,
      ByRef Bytes ( ) As Byte,
      ByVal ByteIndex As Long ) As Long

Parameters

Chars
[ByRef] Variant. the set of characters to be encoded into bytes. This can be either an Integer array or a String.
CharIndex
[ByVal] Long. The index of the first character to begin encoding from.
CharCount
[ByVal] Long. The number of characters to be encoded.
Bytes
[ByRef] Byte. The destination for the encoded characters.
ByteIndex
[ByVal] Long. The index of the first byte stored in the destination array.

Return Values

Long - The number of bytes produce by the encoding.

Remarks

The Bytes array cannot be null and must be large enough to hold the encoded set of characters. To obtain the size required, use GetByteCount to find the necessary size. Or, use GetMaxByteCount to get the largest size that could be produced. The largest size is not the perfect size, only the maximum number of bytes that could ever be produced by a number of characters. Resizing of the resultant Bytes array may be necessary.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


ASCIIEncoding: GetCharCount

GetCharCount

Returns the number of characters that would be produced by decoding a byte array.

 Public Function GetCharCount(
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Bytes
[ByRef] Byte. The bytes to use when calculating the number of characters.
Index
[ByRef] Optional. Variant. The starting index in Bytes to being calculating from.
Count
[ByRef] Optional. Variant. The number of bytes to be used in the calculation.

Return Values

Long - The number of characters that would be decoded from the set of bytes.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


ASCIIEncoding: GetChars

GetChars

Decodes a set of bytes into a set of characters.

 Public Function GetChars(
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Integer ( )

Parameters

Bytes
[ByRef] Byte. The set of bytes to be decoded into characters.
Index
[ByRef] Optional. Variant. The index of the first byte to be used in decoding.
Count
[ByRef] Optional. Variant. The number of bytes to be used in decoding.

Return Values

Integer() - An array of characters decoded from the set of bytes.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


ASCIIEncoding: GetCharsEx

GetCharsEx

Decodes a set of bytes into the supplied Integer array.

 Public Function GetCharsEx(
      ByRef Bytes ( ) As Byte,
      ByVal ByteIndex As Long,
      ByVal ByteCount As Long,
      ByRef Chars ( ) As Integer,
      ByVal CharIndex As Long ) As Long

Parameters

Bytes
[ByRef] Byte. The set of bytes to be decoded into characters.
ByteIndex
[ByVal] Long. The index of the first byte to begin decoding from.
ByteCount
[ByVal] Long. The number of bytes to be used in decoding.
Chars
[ByRef] Integer. The destination character array for the decoded bytes.
CharIndex
[ByVal] Long. The first index to begin storing decoded bytes in Chars.

Return Values

Long - The number of characters decoded from the array of bytes.

Remarks

The Chars array must be large enough to handle all the bytes that will be decoded. To ensure the Chars array is large enough, use either GetCharCount or GetMaxCharCount to determine a size that will hold the decoded bytes.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


ASCIIEncoding: GetDecoder

GetDecoder

Obtains a decoder that converts an ASCII encoded sequence of bytes into a sequence of Unicode characters.

 Public Function GetDecoder ( ) As Decoder

Return Values

Decoder - A Decoder that converts an ASCII encoded sequence of bytes into a sequence of Unicode characters.

Remarks

The Decoder.GetChars method converts sequential blocks of bytes into sequential blocks of characters, in a manner similar to the GetChars method of this class. However, a Decoder maintains state information between calls so it can correctly decode byte sequences that span blocks. The Decoder also preserves trailing bytes at the end of data blocks and uses the trailing bytes in the next decoding operation. Therefore, GetDecoder and GetEncoder are useful for network transmission and file operations, because those operations often deal with blocks of data instead of a complete data stream.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


ASCIIEncoding: GetEncoder

GetEncoder

Obtains an encoder that converts a sequence of Unicode characters into an ASCII encoded sequence of bytes.

 Public Function GetEncoder ( ) As Encoder

Return Values

Encoder - An Encoder that converts a sequence of Unicode characters into an ASCII encoded sequence of bytes.

Remarks

The Encoder.GetBytes method converts sequential blocks of characters into sequential blocks of bytes, in a manner similar to the GetBytes method of this class. However, an Encoder maintains state information between calls so it can correctly encode character sequences that span blocks. The Encoder also preserves trailing characters at the end of data blocks and uses the trailing characters in the next encoding operation. For example, a data block might end with an unmatched high surrogate, and the matching low surrogate might be in the next data block. Therefore, Project CorLib Overview

Class ASCIIEncoding Overview


ASCIIEncoding: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

IObject


ASCIIEncoding: GetMaxByteCount

GetMaxByteCount

Returns the maximum number of bytes that can be created from a specific number of characters.

 Public Function GetMaxByteCount(
      ByVal CharCount As Long ) As Long

Parameters

CharCount
[ByVal] Long. The number of characters to be encoded.

Return Values

Long - The maximum number of bytes that can be generated from the specified number of characters.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


ASCIIEncoding: GetMaxCharCount

GetMaxCharCount

Returns the maximum number of characters than can be decoded from the number of bytes specified.

 Public Function GetMaxCharCount(
      ByVal ByteCount As Long ) As Long

Parameters

ByteCount
[ByVal] Long. The number of bytes to be decoded.

Return Values

Long - The maximum number of characters that can be decoded from the specified number of bytes.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | ByteCount is less than zero. -or- The resulting number of bytes is greater than the maximum number that can be returned as an integer.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


ASCIIEncoding: GetPreamble

GetPreamble

Returns an array of bytes that represents this encoding.

 Public Function GetPreamble ( ) As Byte ( )

Return Values

Byte() - A byte array containing a sequence of bytes that specifies the encoding used.
-or-
A byte array of length zero, if a preamble is not required.

See Encoding.GetPreamble for additional information.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


ASCIIEncoding: GetString

GetString

Decodes a range of bytes into a String.

 Public Function GetString(
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As String

Parameters

Bytes
[ByRef] Byte. The set of bytes to be decoded into a string.
Index
[ByRef] Optional. Variant. The index of the first byte to be decoded.
Count
[ByRef] Optional. Variant. The number of bytes to be used in the decoding.

Return Values

String - A string containing the decoded set of bytes.

Exceptions

Exception | Condition
ArgumentNullException | Bytes is null.
ArgumentOutOfRangeException | Index is less than the lower-bound of Bytes. -or- Count is less than zero. -or- Index and Count do not denote a valid range in Bytes.
DecoderFallbackException | A fallback occurred -and- DecoderFallback is set to DecoderExceptionFallback.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


ASCIIEncoding: HeaderName (get)

HeaderName

Gets the encoding name to be used in with the mail agent header tags.

 Public Property Get HeaderName ( ) As String

Return Values

String - The header tag compatible encoding name.

Read Only.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


ASCIIEncoding: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class ASCIIEncoding Overview


ASCIIEncoding: IsBrowserDisplay (get)

IsBrowserDisplay

Gets if this encoding can be used by browsers to display text.

 Public Property Get IsBrowserDisplay ( ) As Boolean

Return Values

Boolean - The indication for browser display capable.

Read Only.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


ASCIIEncoding: IsBrowserSave (get)

IsBrowserSave

Gets if this encoding can be used to save data with this encoding.

 Public Property Get IsBrowserSave ( ) As Boolean

Return Values

Boolean - The indication for the browser saving capable.

Read Only.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


ASCIIEncoding: IsMailNewsDisplay (get)

IsMailNewsDisplay

Gets if this encoding can be used to display mail and news by mail and news clients.

 Public Property Get IsMailNewsDisplay ( ) As Boolean

Return Values

Boolean - Indication for mail and news client capable.

Read Only.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


ASCIIEncoding: IsMailNewsSave (get)

IsMailNewsSave

Gets if this encoding can be used to save date by mail and news clients.

 Public Property Get IsMailNewsSave ( ) As Boolean

Return Values

Boolean - Indication for the mail and news clients to use this encoding for saving.

Read Only.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


ASCIIEncoding: IsReadOnly (get)

IsReadOnly

When implemented in a derived class, gets a value indicating whether the current encoding is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - True if the current Encoding is read-only; otherwise, False.

Read Only.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview


ASCIIEncoding: IsSingleByte (get)

IsSingleByte

Gets if the current encoding uses single-byte code points.

 Public Property Get IsSingleByte ( ) As Boolean

Return Values

Boolean - Returns True for single-byte, False for multi-byte code points.

Read Only.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview


ASCIIEncoding: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

IObject


ASCIIEncoding: WebName (get)

WebName

Gets the encoding name registered with the Internet Assigned Numbers Authority.

 Public Property Get WebName ( ) As String

Return Values

String - The registered encoding name.

Read Only.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


ASCIIEncoding: WindowsCodePage (get)

WindowsCodePage

Gets the Windows Operating Systems code page for this encoding.

 Public Property Get WindowsCodePage ( ) As Long

Return Values

Long - The Windows code page for this encoding.

Read Only.

See Also

Project CorLib Overview

Class ASCIIEncoding Overview

Encoding


AsymmetricAlgorithm

AsymmetricAlgorithm

Provides a common interface to be implemented by all Asymmetrical algorithm classes.

Public:

Properties:

Name | Description
KeyExchangeAlgorithm (get) | Returns the exchange algorithm used for key exchanges.
KeySize (get) | Returns the key size of the current algorithm instance.
KeySize (let) | Sets the key size to be used by the current algorithm instance.
LegalKeySizes (get) | Returns an array of KeySizes representing all legal and valid key sizes for the current instance of the algorithm.
SignatureAlgorithm (get) | Returns the name of the algorithm used for signing data and hashes.

Methods:

Name | Description
Clear | Releases all resources used by the current algorithm instance.
Equals | Returns if the value and this object instance are equal.
FromXmlString | Initializes an Asymmetric Algorithm instance from an XML string.
GetHashCode | Returns a semi-unique value genetated for this instance.
ToString | Returns a string representation of this instance.
ToXmlString | Returns an XML representation of the Asymmetrice Algorithm.

See Also

Project CorLib Overview

Class AsymmetricAlgorithm Overview

RSACryptoServiceProvider

DSACryptoServiceProvider


AsymmetricAlgorithm: Clear

Clear

Releases all resources used by the current algorithm instance.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class AsymmetricAlgorithm Overview


AsymmetricAlgorithm: Equals

Equals

Returns if the value and this object instance are equal.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test for equality.

Return Values

Boolean - Returns True if the value and this object instance are equal, False otherwise.

See Also

Project CorLib Overview

Class AsymmetricAlgorithm Overview


AsymmetricAlgorithm: FromXmlString

FromXmlString

Initializes an Asymmetric Algorithm instance from an XML string.

 Public Sub FromXmlString(
      ByRef XmlString As String )

Parameters

XmlString
[ByRef] String. The string to initialize the instance from.

See Also

Project CorLib Overview

Class AsymmetricAlgorithm Overview


AsymmetricAlgorithm: GetHashCode

GetHashCode

Returns a semi-unique value genetated for this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A semi-unique value.

See Also

Project CorLib Overview

Class AsymmetricAlgorithm Overview


AsymmetricAlgorithm: KeyExchangeAlgorithm (get)

KeyExchangeAlgorithm

Returns the exchange algorithm used for key exchanges.

 Public Property Get KeyExchangeAlgorithm ( ) As String

Return Values

String - A string name of the key exchange algorithm.

Read Only.

See Also

Project CorLib Overview

Class AsymmetricAlgorithm Overview


AsymmetricAlgorithm: KeySize (get)

KeySize

Returns the key size of the current algorithm instance.

 Public Property Get KeySize ( ) As Long

Return Values

Long - The key size being used by the current algorithm instance.

Read/Write.

See Also

Project CorLib Overview

Class AsymmetricAlgorithm Overview


AsymmetricAlgorithm: KeySize (let)

KeySize

Sets the key size to be used by the current algorithm instance.

 Public Property Let KeySize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The new key size value.

Read/Write.

See Also

Project CorLib Overview

Class AsymmetricAlgorithm Overview


AsymmetricAlgorithm: LegalKeySizes (get)

LegalKeySizes

Returns an array of KeySizes representing all legal and valid key sizes for the current instance of the algorithm.

 Public Property Get LegalKeySizes ( ) As KeySizes ( ) :

Return Values

KeySizes() - A array of KeySizes objects.

Read Only.

See Also

Project CorLib Overview

Class AsymmetricAlgorithm Overview


AsymmetricAlgorithm: SignatureAlgorithm (get)

SignatureAlgorithm

Returns the name of the algorithm used for signing data and hashes.

 Public Property Get SignatureAlgorithm ( ) As String

Return Values

String - The name of the algorithm used for signing.

Read Only.

See Also

Project CorLib Overview

Class AsymmetricAlgorithm Overview


AsymmetricAlgorithm: ToString

ToString

Returns a string representation of this instance.

 Public Function ToString ( ) As String

Return Values

String - A string describing this instance.

See Also

Project CorLib Overview

Class AsymmetricAlgorithm Overview


AsymmetricAlgorithm: ToXmlString

ToXmlString

Returns an XML representation of the Asymmetrice Algorithm.

 Public Function ToXmlString(
      ByVal IncludePrivateParameters As Boolean ) As String

Parameters

IncludePrivateParameters
[ByVal] Boolean. A flag indicating if the private portion of the key should be included in the XML string.

Return Values

String - An XML string.

See Also

Project CorLib Overview

Class AsymmetricAlgorithm Overview


AsyncCallback

AsyncCallback

Used as a means for asynchronous operations to notify when a procedure is finished.

Public:

Methods:

Name | Description
Execute | The method called by an asynchronous operation when it has completed.

See Also

Project CorLib Overview

Class AsyncCallback Overview


AsyncCallback: Execute

Execute

The method called by an asynchronous operation when it has completed.

 Public Sub Execute(
      ByVal ar As IAsyncResult )

Parameters

ar
[ByVal] IAsyncResult. The result of the operation.

Remarks

This interface should be implemented in a class that is to respond to the asynchronous operation.

See Also

Project CorLib Overview

Class AsyncCallback Overview


BigInteger

BigInteger

Represents an unlimited size signed integer value.

Implements:

IComparable
IFormattable
IObject

Public:

Properties:

Name | Description
IsEven (get) | Returns if the value is an even number.
IsOne (get) | Returns if the value is equal to one.
IsZero (get) | Returns if the value is equal to zero.
Precision (get) | Returns the number of bytes being used to represent the number.
Sign (get) | Returns the sign of the number this instance represents.

Methods:

Name | Description
Absolute | Returns the absolute (positive or zero) value of this instance.
Add | Adds a value to this instance of BigInteger.
BitwiseAnd | Peforms a bitwise AND of this BigInteger instance and the value passed in.
BitwiseAndNot | Peforms a bitwise AND of this BigInteger instance and the NOT value passed in.
BitwiseNot | Peforms a bitwise NOT of this BigInteger instance and the value passed in.
BitwiseOr | Performs a bitwise OR of this BigInteger instance and the value passed in.
BitwiseXor | Performs a bitwise XOR of this BigInteger instance and the value passed in.
ClearBit | Clears the specified bit of the BigInteger instance to 0.
CompareTo | Compares two BigInteger instance to each other returning their relation.
Divide | Divides this BigInteger instance by the supplied divisor.
DivRem | Divides this value by the value, returning the quotient and remainding.
Equals | Determines if this BigInteger instance is equal to the other value.
Factorial | Returns the factorial of this BigInteger value.
FlipBit | Flips the specified bit, toggling between True and False.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GreatestCommonDivisor | Returns the greatest common divisor between this instance and the passed in value.
Max | Returns the maximum of this instance and a second BigInteger instance.
Min | Returns the mininum of this instance and a second BigInteger instance.
Modulus | Performs a modulus operation, returning the remainder.
Multiply | Multiplies this instance of BigInteger by the supplied multiplier.
Negate | Returns the opposite signed value of this BigInteger instance.
Pow | Raises the BigInteger value to the specified power.
SetBit | Sets the specified bit of the BigInteger instance to 1.
ShiftLeft | Performs a left shift operation on the BigInteger instance.
ShiftRight | Performs a bit shifting operation to the the right.
SquareRoot | Returns the integer square root of a BigInteger.
Subtract | Subtracts a value to this instance of BigInteger.
TestBit | Tests a specific bit in the number to determine if it is set (1) or not (0).
ToByteArray | Returns a byte array representing the number.
ToString | Returns a human readable string of characters representing the number.

Remarks

The BigInteger can represent a positive or negative value limited in size only by memory.

Negative values are represented in a twos-complement fashion mimicking the way the hardware and VB uses signed integer values.

The value is represented internally as an array of Integers. This was selected over Bytes because of the speed increase with working with multiple bytes simultaneously. However, Integers are never exposed outside of the class, only byte arrays.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: Absolute

Absolute

Returns the absolute (positive or zero) value of this instance.

 Public Function Absolute ( ) As BigInteger

Return Values

BigInteger - Returns a positive (or zero) value of the current BigInteger instance.

Remarks

If the value is already positive or zero, then the same object instance is returned. If the value is negative, then the negated value is returned.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: Add

Add

Adds a value to this instance of BigInteger.

 Public Function Add(
      ByVal Value As BigInteger ) As BigInteger

Parameters

Value
[ByVal] BigInteger. A numeric representation of the value to be added to this instance.

Return Values

BigInteger - A new instance of BigInteger containing the summed value.

Remarks

This method accepts a BigInteger, one of VBs numeric values or a string to be parsed.

 Dim b As BigInteger
 Set b = BInt(100)
 Set b = b.Add(BInt(150))
 Debug.Print b.ToString

 ' This outputs the following:
 250

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: BitwiseAnd

BitwiseAnd

Peforms a bitwise AND of this BigInteger instance and the value passed in.

 Public Function BitwiseAnd(
      ByVal Value As BigInteger ) As BigInteger

Parameters

Value
[ByVal] BigInteger. The value to perform the bitwise AND with.

Return Values

BigInteger - A new BigInteger value containing the performed bitwise AND result.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: BitwiseAndNot

BitwiseAndNot

Peforms a bitwise AND of this BigInteger instance and the NOT value passed in.

 Public Function BitwiseAndNot(
      ByVal Value As BigInteger ) As BigInteger

Parameters

Value
[ByVal] BigInteger. The value that will be NOTted to perform the bitwise AND with.

Return Values

BigInteger - A new BigInteger value containing the performed bitwise AND/NOT result.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: BitwiseNot

BitwiseNot

Peforms a bitwise NOT of this BigInteger instance and the value passed in.

 Public Function BitwiseNot ( ) As BigInteger

Return Values

BigInteger - A new BigInteger value containing the performed bitwise NOT result.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: BitwiseOr

BitwiseOr

Performs a bitwise OR of this BigInteger instance and the value passed in.

 Public Function BitwiseOr(
      ByVal Value As BigInteger ) As BigInteger

Parameters

Value
[ByVal] BigInteger. The value to perform the bitwise OR with.

Return Values

BigInteger - A new BigInteger value containing the performed bitwise OR result.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: BitwiseXor

BitwiseXor

Performs a bitwise XOR of this BigInteger instance and the value passed in.

 Public Function BitwiseXor(
      ByVal Value As BigInteger ) As BigInteger

Parameters

Value
[ByVal] BigInteger. The value to perform the bitwise XOR with.

Return Values

BigInteger - A new BigInteger value containing the performed bitwise XOR result.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: ClearBit

ClearBit

Clears the specified bit of the BigInteger instance to 0.

 Public Function ClearBit(
      ByVal Bit As Long ) As BigInteger

Parameters

Bit
[ByVal] Long. The bit to be set to 0.

Return Values

BigInteger - A new BigInteger value with the bit set to 0.

Remarks

Bit is a zero-based index. The first bit is 0.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: CompareTo

CompareTo

Compares two BigInteger instance to each other returning their relation.

 Public Function CompareTo(
      ByVal Other As BigInteger ) As Long

Parameters

Other
[ByVal] BigInteger. The right handed value to compare this instance against.

Return Values

Long - Returns the relation between this instance and the other number as shown in the following table.
Value | Meaning
Less than zero | This instance is less than Other.
Zero | This instance equals Other.
Greater than zero | This instance is greater than Other.

Remarks

If Nothing is passed in, it is treated as zero.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: Divide

Divide

Divides this BigInteger instance by the supplied divisor.

 Public Function Divide(
      ByVal Divisor As BigInteger ) As BigInteger

Parameters

Divisor
[ByVal] BigInteger. A numeric representation of the value to divide this instance by.

Return Values

BigInteger - A new instance of BigInteger containing the quotient value.

Remarks

This method accepts a BigInteger, one of VBs numeric values or a string to be parsed.

 Dim b As BigInteger
 Set b = BInt(100)
 Set b = b.Divide(BInt(40))
 Debug.Print b.ToString

 ' This outputs the following:
 2

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: DivRem

DivRem

Divides this value by the value, returning the quotient and remainding.

 Public Function DivRem(
      ByVal Divisor As BigInteger,
      ByRef Remainder As BigInteger ) As BigInteger

Parameters

Divisor
[ByVal] BigInteger. A numeric representation of the value to divide this instance by.
Remainder
[ByRef] BigInteger. A reference to the variable to receive the remainder as a result of the division.

Return Values

BigInteger - A new instance of BigInteger containing the quotient value.

Remarks

This method accepts a BigInteger, one of VBs numeric values or a string to be parsed.

 Dim b As BigInteger
 Dim r As BigInteger
 Dim q As BigInteger
 Set b = BInt(100)
 Set q = b.DivRem(BInt(40), r)
 Debug.Print q.ToString
 Debug.Print r.ToString

 ' This outputs the following:
 2
 20

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: Equals

Equals

Determines if this BigInteger instance is equal to the other value.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if this instance is equal to.

Return Values

Boolean - True if this object and the other value are equal, False otherwise.

Remarks

The function accepts a String, Number, Byte Array, or BigInteger object. The BInt function is called to convert the other value to a BigInteger object before comparison.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: Factorial

Factorial

Returns the factorial of this BigInteger value.

 Public Function Factorial ( ) As BigInteger

Return Values

BigInteger - The factorial of this BigInteger instance value.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: FlipBit

FlipBit

Flips the specified bit, toggling between True and False.

 Public Function FlipBit(
      ByVal Bit As Long ) As BigInteger

Parameters

Bit
[ByVal] Long. The bit to toggle.

Return Values

BigInteger - A new BigInteger with the specified bit flipped.

Remarks

If the bit specified is larger than the current instance of the BigInteger value, then the new value will be extended to include the bit being flipped.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: GreatestCommonDivisor

GreatestCommonDivisor

Returns the greatest common divisor between this instance and the passed in value.

 Public Function GreatestCommonDivisor(
      ByVal Value As BigInteger ) As BigInteger

Parameters

Value
[ByVal] BigInteger. The other value used to determine the greatest common divisor between.

Return Values

BigInteger - Returns the greatest common divisor for the two values.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: IComparable

IComparable

 Implements IComparable

Return Values

IComparable -

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: IFormattable

IFormattable

 Implements IFormattable

Return Values

IFormattable -

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: IsEven (get)

IsEven

Returns if the value is an even number.

 Public Property Get IsEven ( ) As Boolean

Return Values

Boolean - True if the value is even, otherwise False.

Remarks

This is equivalent to the expression:

 value.Modulus(2) = 0

Read Only.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: IsOne (get)

IsOne

Returns if the value is equal to one.

 Public Property Get IsOne ( ) As Boolean

Return Values

Boolean - True if the value is one, otherwise False.

Read Only.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: IsZero (get)

IsZero

Returns if the value is equal to zero.

 Public Property Get IsZero ( ) As Boolean

Return Values

Boolean - True if the value is zero, otherwise False.

Read Only.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: Max

Max

Returns the maximum of this instance and a second BigInteger instance.

 Public Function Max(
      ByVal Value As BigInteger ) As BigInteger

Parameters

Value
[ByVal] BigInteger. One of the two values to be tested.

Return Values

BigInteger - If this instance is equal to or greater than Value, then this instance is returned, otherwise value is returned.

If Value is Nothing it will be treated as zero.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: Min

Min

Returns the mininum of this instance and a second BigInteger instance.

 Public Function Min(
      ByVal Value As BigInteger ) As BigInteger

Parameters

Value
[ByVal] BigInteger. One of the two values to be tested.

Return Values

BigInteger - If this instance is less than or equal to Value, then this instance is returned, otherwise value is returned.

If Value is Nothing it will be treated as zero.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: Modulus

Modulus

Performs a modulus operation, returning the remainder.

 Public Function Modulus(
      ByVal Divisor As BigInteger ) As BigInteger

Parameters

Divisor
[ByVal] BigInteger. A numeric representation of the value to divide this instance by.

Return Values

BigInteger - The modulus (remainder) of the division.

Remarks

This method accepts a BigInteger, one of VBs numeric values or a string to be parsed.

 Dim b As BigInteger
 Set b = BInt(100)
 Set b = b.Modulus(BInt(40))
 Debug.Print b.ToString

 ' This outputs the following:
 20

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: Multiply

Multiply

Multiplies this instance of BigInteger by the supplied multiplier.

 Public Function Multiply(
      ByVal Value As BigInteger ) As BigInteger

Parameters

Value
[ByVal] BigInteger. A numeric representation of the value to multiply this instance by.

Return Values

BigInteger - A new instance of BigInteger containing the product value.

Remarks

This method accepts a BigInteger, one of VBs numeric values or a string to be parsed.

 Dim b As BigInteger
 Set b = BInt(100)
 Set b = b.Multiply(BInt(150))
 Debug.Print b.ToString

 ' This outputs the following:
 15000

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: Negate

Negate

Returns the opposite signed value of this BigInteger instance.

 Public Function Negate ( ) As BigInteger

Return Values

BigInteger - Returns a BigInteger instance containing the opposite signed value.

Remarks

Negative values are represented as a twos-complement number, unlike other systems used to represent a negative value. Any negation requires the twos-complement algorithm to be applied to the number. This keeps in step with how users of VB already deal with negative numbers, helping to ease the transition to using BigInteger values.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: Pow

Pow

Raises the BigInteger value to the specified power.

 Public Function Pow(
      ByVal Exponent As Long ) As BigInteger

Parameters

Exponent
[ByVal] Long. The value to raise the BigInteger value to.

Return Values

BigInteger - Returns the BigInteger value raised to the specified power.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: Precision (get)

Precision

Returns the number of bytes being used to represent the number.

 Public Property Get Precision ( ) As Long

Return Values

Long - The number of bytes being used to represent the number.

Remarks

There may be additional bytes allocated, but not considered as part of the number. Those bytes are not represented in the precision.

Since a negative value can have an infinite number of leading &HFFFF values, only 1 (2 bytes) is counted if it is needed.

Read Only.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: SetBit

SetBit

Sets the specified bit of the BigInteger instance to 1.

 Public Function SetBit(
      ByVal Bit As Long ) As BigInteger

Parameters

Bit
[ByVal] Long. The bit to be set to 1.

Return Values

BigInteger - A new BigInteger value with the bit set to 1.

Remarks

If the bit specified is larger than the current instance of the BigInteger value, then the new value will be extended to include the bit being set.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: ShiftLeft

ShiftLeft

Performs a left shift operation on the BigInteger instance.

 Public Function ShiftLeft(
      ByVal BitCount As Long ) As BigInteger

Parameters

BitCount
[ByVal] Long. The number of bits the value is to be shifted left.

Return Values

BigInteger - Returns a new BigInteger instance containing the shifted value.

Remarks

If BitCount is negative, then a right shift is performed.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: ShiftRight

ShiftRight

Performs a bit shifting operation to the the right.

 Public Function ShiftRight(
      ByVal BitCount As Long ) As BigInteger

Parameters

BitCount
[ByVal] Long. The number of bits the BigInteger value is to be shifted.

Return Values

BigInteger - Returns a new BigInteger instance containing the bit shifted value.

Remarks

If BitCount is negative, then a left shift is performed.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: Sign (get)

Sign

Returns the sign of the number this instance represents.

 Public Property Get Sign ( ) As Sign

Return Values

Sign - The value of type SignRemarks

Returns -1 for negative, 0 for zero, 1 for positive.

Read Only.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: SquareRoot

SquareRoot

Returns the integer square root of a BigInteger.

 Public Function SquareRoot ( ) As BigInteger

Return Values

BigInteger - The integer square root of the value.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: Subtract

Subtract

Subtracts a value to this instance of BigInteger.

 Public Function Subtract(
      ByVal Value As BigInteger ) As BigInteger

Parameters

Value
[ByVal] BigInteger. A numeric representation of the value to be subtracted to this instance.

Return Values

BigInteger - A new instance of BigInteger containing the differenced value.

Remarks

This method accepts a BigInteger, one of VBs numeric values or a string to be parsed.

 Dim b As BigInteger
 Set b = BInt(100)
 Set b = b.Subtract(BInt(150))
 Debug.Print b.ToString

 ' This outputs the following:
 -50

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: TestBit

TestBit

Tests a specific bit in the number to determine if it is set (1) or not (0).

 Public Function TestBit(
      ByVal Bit As Long ) As Boolean

Parameters

Bit
[ByVal] Long. The bit to be tested.

Return Values

Boolean - Returns True if the bit is set (1), False if it is not.

Remarks

The max value for bit is 2147483647. If the bit value is larger than the BigInteger instance, then the sign of the number is used. This will represent a negative number with infinite sign extension bits.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: ToByteArray

ToByteArray

Returns a byte array representing the number.

 Public Function ToByteArray ( ) As Byte ( )

Return Values

Byte() - A byte array the same length as Precision that represents the number.

Remarks

To represent a byte array for a negative value, the highest bit must be set. To ensure this, a pair of bytes with the value of &HFF may be part of the return value.

See Also

Project CorLib Overview

Class BigInteger Overview


BigInteger: ToString

ToString

Returns a human readable string of characters representing the number.

 Public Function ToString(
      Optional ByRef Format As String,
      Optional ByVal Provider As IFormatProvider ) As String

Parameters

Format
[ByRef] Optional. String. The specific numerical format wish to have the number displayed as.
Provider
[ByVal] Optional. IFormatProvider. An object that supplies culture-specific formatting information about this instance.

Return Values

String - The numeric value of the number in the specified format.

Remarks

"X" and "x" for hex in either upper or lowercase. Everything else defaults to a decimal display.

The specifier can also contain a number of mininum digits to be displayed. If the value isnt long enough to reach the mininum digits, then leading 0's or FFs will be added to the beginning of the output.

 Dim b As BigInteger
 Set b = BInt(-200)
 Debug.Print b.ToString("d8") ' -00000200
 Debug.Print b.ToString("d")  ' -200
 Debug.Print b.ToString("x8") ' ffffff38
 Debug.Print b.ToString("x")  ' ff38

If no format is specified, the default of "d" is used.

See Also

Project CorLib Overview

Class BigInteger Overview


BigIntegerStatic

BigIntegerStatic

Provides methods used to manipulate BigInteger objects.

Public:

Properties:

Name | Description
MinusOne (get) | Returns a shared BigInteger instance with the value of -1.
One (get) | Returns a shared BigInteger instance with the value of 1.
Ten (get) | Returns a shared BigInteger instance with the value of 10.
Zero (get) | Returns a shared BigInteger instance with the value of 0.

Methods:

Name | Description
Absolute | Returns the absolute (positive or zero) value of this instance.
Add | Adds two BigInteger value instances together, returning the sum.
BitwiseAnd | Peforms a bitwise AND operation, returning the result.
BitwiseAndNot | Peforms a bitwise AND operation after NOTting the second operand, returning the result.
BitwiseNot | Peforms a bitwise NOT of this BigInteger instance.
BitwiseOr | Peforms a bitwise OR operation, returning the result.
BitwiseXor | Peforms a bitwise XOR operation, returning the result.
ClearBit | Clears the specified bit of the BigInteger instance to 0.
Compare | Compares two BigInteger instances to each other returning their relation.
Divide | Divides one BigInteger value by another, returning the quotient.
DivRem | Divides one BigInteger value by another, returning both the quotient and remainder.
Equals | Returns the equality of two BigInteger values.
Factorial | Calculates the factorial of a BigInteger value.
FlipBit | Flips the specified bit, toggling between True and False.
GreatestCommonDivisor | Returns the greatest common divisor between the two BigInteger values.
Max | Returns the maximum of the two BigInteger values.
Min | Returns the mininum of the two BigInteger values.
ModPow | Performs a modulo on a BigInteger value raised to a power. b = (x^y) mod z.
Modulus | Returns the remainder of division between two BigInteger values.
Multiply | Multiplies BigInteger values, returning their product.
Negate | Returns the opposite signed value of this BigInteger instance.
Parse | Attemps to parse a string of characters of the specified base type.
Pow | Raise a base value to the specified power.
Randomize | Randomizes the Rnd function.
Rnd | Generates a random BigInteger number of the specified size.
SeedRnd | Sets the seeding of the Rnd function.
SetBit | Sets the specified bit of the BigInteger instance to 1.
ShiftLeft | Performs a left shift operation on the BigInteger instance.
ShiftRight | Performs a bit shifting operation to the the right.
SquareRoot | Returns the integer square root of a BigInteger.
Subtract | Subtracts one BigInteger value from another, returning the difference.
TestBit | Tests a specific bit in the BigInteger number to determine if it is set (1) or not (0).
ToString | Returns a human readable string of characters representing the number.
TryParse | Attemps to parse a string of characters of the specified base type.
TryParseEx | Tries to convert the string representation of a number in a specified style and culture-specific format to its BigInteger equivalent, and returns a value that indicates whether the conversion succeeded.

Remarks

The methods provided by this class are accessed through the convention of BigInteger.MethodName.

 Dim b As BigInteger
 Set b = BigInteger.Rnd(128)
 Set b = BigInteger.Pow(b, BInt(3))

Most of these methods exist in the BigInteger class and can be used directly with BigInteger objects. The primary advantage of using the methods defined in this class is that a value of Nothing can be passed in and will be treated as a value of 0.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: Absolute

Absolute

Returns the absolute (positive or zero) value of this instance.

 Public Function Absolute(
      ByVal Value As BigInteger ) As BigInteger

Parameters

Value
[ByVal] BigInteger. The BigInteger value to return the absolute value of.

Return Values

BigInteger - Returns a positive (or zero) value of the current BigInteger instance.

Remarks

If the value is already positive or zero, then the same object instance is returned. If the value is negative, then the negated value is returned.

Value is Nothing it will be treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: Add

Add

Adds two BigInteger value instances together, returning the sum.

 Public Function Add(
      ByVal Left As BigInteger,
      ByVal Right As BigInteger ) As BigInteger

Parameters

Left
[ByVal] BigInteger. The first value to add.
Right
[ByVal] BigInteger. The second value to add.

Return Values

BigInteger - The sum of Left and Right.

Remarks

Values of Nothing will be treated as zero.

 Dim b As BigInteger
 Set b = BigInteger.Add(BInt(100), BInt(150))
 Debug.Print b.ToString ' 250

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: BitwiseAnd

BitwiseAnd

Peforms a bitwise AND operation, returning the result.

 Public Function BitwiseAnd(
      ByVal Left As BigInteger,
      ByVal Right As BigInteger ) As BigInteger

Parameters

Left
[ByVal] BigInteger. The left hand value of the AND operation.
Right
[ByVal] BigInteger. The right hand value of the AND operation.

Return Values

BigInteger - A new BigInteger value containing the performed bitwise AND result.

Values of Nothing will be treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: BitwiseAndNot

BitwiseAndNot

Peforms a bitwise AND operation after NOTting the second operand, returning the result.

 Public Function BitwiseAndNot(
      ByVal Left As BigInteger,
      ByVal Right As BigInteger ) As BigInteger

Parameters

Left
[ByVal] BigInteger. The left hand value of the operation.
Right
[ByVal] BigInteger. The right hand value to be NOTted for the operation.

Return Values

BigInteger - A new BigInteger value containing the performed bitwise result.

Values of Nothing will be treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: BitwiseNot

BitwiseNot

Peforms a bitwise NOT of this BigInteger instance.

 Public Function BitwiseNot(
      ByVal Value As BigInteger ) As BigInteger

Parameters

Value
[ByVal] BigInteger. The BigInteger to perform the NOT operation on.

Return Values

BigInteger - A new BigInteger value containing the performed bitwise NOT result.

Values of Nothing will be treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: BitwiseOr

BitwiseOr

Peforms a bitwise OR operation, returning the result.

 Public Function BitwiseOr(
      ByVal Left As BigInteger,
      ByVal Right As BigInteger ) As BigInteger

Parameters

Left
[ByVal] BigInteger. The left hand value of the OR operation.
Right
[ByVal] BigInteger. The right hand value of the OR operation.

Return Values

BigInteger - A new BigInteger value containing the performed bitwise OR result.

Values of Nothing will be treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: BitwiseXor

BitwiseXor

Peforms a bitwise XOR operation, returning the result.

 Public Function BitwiseXor(
      ByVal Left As BigInteger,
      ByVal Right As BigInteger ) As BigInteger

Parameters

Left
[ByVal] BigInteger. The left hand value of the XOR operation.
Right
[ByVal] BigInteger. The right hand value of the XOR operation.

Return Values

BigInteger - A new BigInteger value containing the performed bitwise XOR result.

Values of Nothing will be treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: ClearBit

ClearBit

Clears the specified bit of the BigInteger instance to 0.

 Public Function ClearBit(
      ByVal Value As BigInteger,
      ByVal Bit As Long ) As BigInteger

Parameters

Value
[ByVal] BigInteger. The BigInteger value to clear the bit on.
Bit
[ByVal] Long. The bit to be set to 0.

Return Values

BigInteger - A new BigInteger value with the bit set to 0.

Values of Nothing will be treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: Compare

Compare

Compares two BigInteger instances to each other returning their relation.

 Public Function Compare(
      ByVal Left As BigInteger,
      ByVal Right As BigInteger ) As Long

Parameters

Left
[ByVal] BigInteger. The left handed value to be compared to.
Right
[ByVal] BigInteger. The right handed value to be compared to.

Return Values

Long - Returns the relation between to the two numbers.

Remarks

If Nothing is passed in, it is treated as zero.
Value | Condition
Less than zero | Left is less than Right.
Zero | Left equals Right.
Greater than zero | Left is greater than Right.

 Dim a As BigInteger, b As BigInteger, Relation As String
 Set a = BInt(1)
 Set b = BInt(2)

 Select Case BigInteger.Compare(a, b)
     Case Is < 0: Relation = "<"
     Case Is > 0: Relation = ">"
     Case Else: Relation = "="
 End Select

 Console.WriteLine "{0} {1} {2}", a, Relation, b

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: Divide

Divide

Divides one BigInteger value by another, returning the quotient.

 Public Function Divide(
      ByVal Dividend As BigInteger,
      ByVal Divisor As BigInteger ) As BigInteger

Parameters

Dividend
[ByVal] BigInteger. The BigInteger value to be divided.
Divisor
[ByVal] BigInteger. The BigInteger value to divide by.

Return Values

BigInteger - The quotient of the division.

Remarks

Values of Nothing will be treated as zero.

Integer division is applied, there is no rounding values. This method discards the remainder.

 Dim b As BigInteger
 Set b = BigInteger.Divide(BInt(100), BInt(40))
 Debug.Print b.ToString ' 2

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: DivRem

DivRem

Divides one BigInteger value by another, returning both the quotient and remainder.

 Public Function DivRem(
      ByVal Dividend As BigInteger,
      ByVal Divisor As BigInteger,
      ByRef Remainder As BigInteger ) As BigInteger

Parameters

Dividend
[ByVal] BigInteger. The BigInteger value to be divided.
Divisor
[ByVal] BigInteger. The BigInteger value to divide by.
Remainder
[ByRef] BigInteger. A variable to place the remainder in to.

Return Values

BigInteger - The quotient of the division.

Remarks

Values of Nothing will be treated as zero.

 Dim b As BigInteger
 Dim r As BigInteger
 Dim q As BigInteger
 Set b = BInt(100)
 Set q = BigInteger.DivRem(b, BInt(40), r)
 Debug.Print q.ToString ' 2
 Debug.Print r.ToString ' 20

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: Equals

Equals

Returns the equality of two BigInteger values.

 Public Function Equals(
      ByVal x As BigInteger,
      ByVal y As BigInteger ) As Boolean

Parameters

x
[ByVal] BigInteger. The left handed value to test for equality.
y
[ByVal] BigInteger. The right handed value to test for equality.

Return Values

Boolean - True if the values are equal, False otherwise.

Remarks

If Nothing is passed in, it is treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: Factorial

Factorial

Calculates the factorial of a BigInteger value.

 Public Function Factorial(
      ByVal Value As BigInteger ) As BigInteger

Parameters

Value
[ByVal] BigInteger. The value to calculate the factorial of.

Return Values

BigInteger - A BigInteger value of the factorial.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: FlipBit

FlipBit

Flips the specified bit, toggling between True and False.

 Public Function FlipBit(
      ByVal Value As BigInteger,
      ByVal Bit As Long ) As BigInteger

Parameters

Value
[ByVal] BigInteger. The BigInteger value to flip the bit on.
Bit
[ByVal] Long. The bit to toggle.

Return Values

BigInteger - A new BigInteger with the specified bit flipped.

Remarks

If the bit specified is larger than the current instance of the BigInteger value, then the new value will be extended to include the bit being flipped.

Values of Nothing will be treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: GreatestCommonDivisor

GreatestCommonDivisor

Returns the greatest common divisor between the two BigInteger values.

 Public Function GreatestCommonDivisor(
      ByVal Left As BigInteger,
      ByVal Right As BigInteger ) As BigInteger

Parameters

Left
[ByVal] BigInteger. One of the values to find the GCD of.
Right
[ByVal] BigInteger. One of the values to find the GCD of.

Return Values

BigInteger - Returns the GCD for two given values.

Remarks

Values of Nothing will be treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: Max

Max

Returns the maximum of the two BigInteger values.

 Public Function Max(
      ByVal x As BigInteger,
      ByVal y As BigInteger ) As BigInteger

Parameters

x
[ByVal] BigInteger. One of the two values to be tested.
y
[ByVal] BigInteger. One of the two values to be tested.

Return Values

BigInteger - If x is equal or greater than y, then x is returned, otherwise y is returned.

Values of Nothing will be treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: Min

Min

Returns the mininum of the two BigInteger values.

 Public Function Min(
      ByVal x As BigInteger,
      ByVal y As BigInteger ) As BigInteger

Parameters

x
[ByVal] BigInteger. One of the two values to be tested.
y
[ByVal] BigInteger. One of the two values to be tested.

Return Values

BigInteger - If x is less or equal to y, then x is returned, otherwise y is returned.

Values of Nothing will be treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: MinusOne (get)

MinusOne

Returns a shared BigInteger instance with the value of -1.

 Public Property Get MinusOne ( ) As BigInteger

Return Values

BigInteger - Returns a shared instance of the value of -1.

Remarks

This is to reduce the creation of multiple instances of values that are commonly used.

Read Only.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: ModPow

ModPow

Performs a modulo on a BigInteger value raised to a power. b = (x^y) mod z.

 Public Function ModPow(
      ByVal BaseValue As BigInteger,
      ByVal Exponent As BigInteger,
      ByVal m As BigInteger ) As BigInteger

Parameters

BaseValue
[ByVal] BigInteger. The value to be raised to the power of the exponent.
Exponent
[ByVal] BigInteger. The power to raise the baseValue to.
m
[ByVal] BigInteger. The modulus value to perform on the raised baseValue.

Return Values

BigInteger - Returns the modulus of the raised baseValue.

Values of

Nothing

are treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: Modulus

Modulus

Returns the remainder of division between two BigInteger values.

 Public Function Modulus(
      ByVal Dividend As BigInteger,
      ByVal Divisor As BigInteger ) As BigInteger

Parameters

Dividend
[ByVal] BigInteger. The value to be divided.
Divisor
[ByVal] BigInteger. The value to divide by.

Return Values

BigInteger - Returns the remainder portion of the division operation.

Remarks

Values of Nothing will be treated as zero.

 Dim b As BigInteger
 Set b = BInt(100)
 Set b = BigInteger.Remainder(b, BInt(40))
 Debug.Print b.ToString ' 20

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: Multiply

Multiply

Multiplies BigInteger values, returning their product.

 Public Function Multiply(
      ByVal Left As BigInteger,
      ByVal Right As BigInteger ) As BigInteger

Parameters

Left
[ByVal] BigInteger. The multiplicand to be multiplied.
Right
[ByVal] BigInteger. The multiplier to multiply by.

Return Values

BigInteger - The product of the two values.

Remarks

Values of Nothing will be treated as zero.

 Dim b As BigInteger
 Set b = BigInteger.Multiply(BInt(100), BInt(150))
 Debug.Print b.ToString ' 15000

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: Negate

Negate

Returns the opposite signed value of this BigInteger instance.

 Public Function Negate(
      ByVal Value As BigInteger ) As BigInteger

Parameters

Value
[ByVal] BigInteger. The value to be negated.

Return Values

BigInteger - Returns a BigInteger instance containing the opposite signed value.

Remarks

Negative values are represented as a twos-complement number, unlike other systems used to represent a negative value. Any negation requires the twos-complement algorithm to be applied to the number. This keeps in step with how users of VB already deal with negative numbers, helping to ease the transition to using BigInteger values.

If Value is Nothing it will be treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: One (get)

One

Returns a shared BigInteger instance with the value of 1.

 Public Property Get One ( ) As BigInteger

Return Values

BigInteger - Returns a shared instance of the value of 1.

Remarks

This is to reduce the creation of multiple instances of values that are commonly used.

Read Only.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: Parse

Parse

Attemps to parse a string of characters of the specified base type.

 Public Function Parse(
      ByRef Value As String,
      Optional ByVal Style As NumberStyles = NumberStyles. Integer,
      Optional ByVal Provider As IFormatProvider ) As BigInteger

Parameters

Value
[ByRef] String. The string of characters to attempt to be parsed.
Style
[ByVal] Optional. NumberStyles. A bitwise combination of the enumeration values that specify the permitted format of Value.

Default: NumberStyles . Integer

Provider
[ByVal] Optional. IFormatProvider. An object that provides culture-specific formatting information about Value.

Return Values

BigInteger - Returns an instance of BigInteger containing the parsed value.

Remarks

If the string could not be parsed, an exception is thrown.

3 base types are supported for parsing (Decimal, Hex.) The string must include a base type specifier for Hex. Decimal is the default.

Hex Specifiers: 0x, 0X, &H, &H - (0xFF, 0XFF, &HFF, &HFF)

 Dim b As BigInteger
 Set b = BigInteger.Parse("&H7FFF")
 Debug.Print b.ToString("X") ' 7FFF

Parsing is not case sensitive.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: Pow

Pow

Raise a base value to the specified power.

 Public Function Pow(
      ByVal Value As BigInteger,
      ByVal Exponent As Long ) As BigInteger

Parameters

Value
[ByVal] BigInteger. The value to be raised to a specified power.
Exponent
[ByVal] Long. The power to raise the value to.

Return Values

BigInteger - Returns the baseValue^exponent result.

Remarks

Values of Nothing are treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: Randomize

Randomize

Randomizes the Rnd function.

 Public Sub Randomize(
      Optional ByRef Value As Variant )

Parameters

Value
[ByRef] Optional. Variant. The number used to randomize the Rnd method.

Remarks

This is provided because the VB Rnd function runs independently for each component.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: Rnd

Rnd

Generates a random BigInteger number of the specified size.

 Public Function Rnd(
      ByVal Size As Long,
      Optional ByVal IsNegative As Boolean = False ) As BigInteger

Parameters

Size
[ByVal] Long. The size of the number in bytes.
IsNegative
[ByVal] Optional. Boolean. Indicates if a negative random number should be generated.

Default: False

Return Values

BigInteger - A new BigInteger of a random value.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: SeedRnd

SeedRnd

Sets the seeding of the Rnd function.

 Public Sub SeedRnd(
      Optional ByRef seed As Variant )

Parameters

seed
[ByRef] Optional. Variant. The number to be used as the seed.

Remarks

This is provided because the VB Rnd function runs independently for each component.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: SetBit

SetBit

Sets the specified bit of the BigInteger instance to 1.

 Public Function SetBit(
      ByVal Value As BigInteger,
      ByVal Bit As Long ) As BigInteger

Parameters

Value
[ByVal] BigInteger. The BigInteger value to set the bit on.
Bit
[ByVal] Long. The bit to be set to 1.

Return Values

BigInteger - A new BigInteger value with the bit set to 1.

Remarks

If the bit specified is larger than the current instance of the BigInteger value, then the new value will be extended to include the bit being set.

Values of Nothing will be treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: ShiftLeft

ShiftLeft

Performs a left shift operation on the BigInteger instance.

 Public Function ShiftLeft(
      ByVal Value As BigInteger,
      ByVal BitCount As Long ) As BigInteger

Parameters

Value
[ByVal] BigInteger. The BigInteger to shift left.
BitCount
[ByVal] Long. The number of bits the value is to be shifted left.

Return Values

BigInteger - Returns a new BigInteger instance containing the shifted value.

Remarks

If BitCount is negative, then a right shift is performed.

Values of Nothing will be treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: ShiftRight

ShiftRight

Performs a bit shifting operation to the the right.

 Public Function ShiftRight(
      ByVal Value As BigInteger,
      ByVal BitCount As Long ) As BigInteger

Parameters

Value
[ByVal] BigInteger. The BigInteger to shift right.
BitCount
[ByVal] Long. The number of bits the BigInteger value is to be shifted.

Return Values

BigInteger - Returns a new BigInteger instance containing the bit shifted value.

Remarks

If BitCount is negative, then a left shift is performed.

Values of Nothing will be treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: SquareRoot

SquareRoot

Returns the integer square root of a BigInteger.

 Public Function SquareRoot(
      ByVal Value As BigInteger ) As BigInteger

Parameters

Value
[ByVal] BigInteger. The value to calculate the integer square root for.

Return Values

BigInteger - The integer square root of the value.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: Subtract

Subtract

Subtracts one BigInteger value from another, returning the difference.

 Public Function Subtract(
      ByVal Left As BigInteger,
      ByVal Right As BigInteger ) As BigInteger

Parameters

Left
[ByVal] BigInteger. The minuend value to be subracted from.
Right
[ByVal] BigInteger. The subtrahend value to subtract from the minuend value.

Return Values

BigInteger - The difference of the two values.

Remarks

Values of Nothing will be treated as zero.

 Dim b As BigInteger
 Set b = BigInteger.Subtract(BInt(100), BInt(150))
 Debug.Print b.ToString ' -50

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: Ten (get)

Ten

Returns a shared BigInteger instance with the value of 10.

 Public Property Get Ten ( ) As BigInteger

Return Values

BigInteger - Returns a shared instance of the value of 10.

Remarks

This is to reduce the creation of multiple instances of values that are commonly used.

Read Only.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: TestBit

TestBit

Tests a specific bit in the BigInteger number to determine if it is set (1) or not (0).

 Public Function TestBit(
      ByVal Value As BigInteger,
      ByVal Bit As Long ) As Boolean

Parameters

Value
[ByVal] BigInteger. The BigInteger number to test the bit of.
Bit
[ByVal] Long. The bit to be tested.

Return Values

Boolean - Returns True if the bit is set (1), false if it is not (0).

Remarks

The max value for bit is 2147483647. If the bit value is larger than the BigInteger instance, then the sign of the number is used. This will represent a negative number with infinite sign extension bits.

Values of Nothing will be treated as zero.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: ToString

ToString

Returns a human readable string of characters representing the number.

 Public Function ToString(
      ByVal Value As BigInteger,
      Optional ByRef Format As String ) As String

Parameters

Value
[ByVal] BigInteger. The BigInteger to create a string from.
Format
[ByRef] Optional. String. The specific numerical format wish to have the number displayed as.

Return Values

String - The numeric value of the number in the specified format.

Remarks

"X" and "x" for hex in either upper or lowercase. Everything else defaults to a decimal display.

The specifier can also contain a number of mininum digits to be displayed. If the value isnt long enough to reach the mininum digits, then leading 0's or FFs will be added to the beginning of the output.

 Dim b As BigInteger
 Set b = BInt(-200)
 Debug.Print b.ToString("d8") ' -00000200
 Debug.Print b.ToString("d")  ' -200
 Debug.Print b.ToString("x8") ' ffffff38
 Debug.Print b.ToString("x")  ' ff38

If no format is specified, the default of "d" is used.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: TryParse

TryParse

Attemps to parse a string of characters of the specified base type.

 Public Function TryParse(
      ByRef Value As String,
      ByRef OutResult As BigInteger ) As Boolean

Parameters

Value
[ByRef] String. The string of characters to parse.
OutResult
[ByRef] BigInteger. The returning BigInteger object if the string was successfully parsed.

Return Values

Boolean - True if the string was parsed, False otherwise.

Remarks

2 base types are supported for parsing; Decimal and Hex. The string must include a base type specifier for Hex. Decimal is the default.

Hex Prefix Specifiers: 0x, 0X, &H, &H

Parsing is not case sensitive.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: TryParseEx

TryParseEx

Tries to convert the string representation of a number in a specified style and culture-specific format to its BigInteger equivalent, and returns a value that indicates whether the conversion succeeded.

 Public Function TryParseEx(
      ByRef Value As String,
      ByVal Style As NumberStyles,
      ByVal Provider As IFormatProvider,
      ByRef OutResult As BigInteger ) As Boolean

Parameters

Value
[ByRef] String. The string representation of a number. The string is interpreted using the style specified by style.
Style
[ByVal] NumberStyles. A bitwise combination of enumeration values that indicates the style elements that can be present in value. A typical value to specify is NumberStyles.Integer.
Provider
[ByVal] IFormatProvider. An object that supplies culture-specific formatting information about value. If Nothing is passed in the current CultureInfo will be used.
OutResult
[ByRef] BigInteger. When this method returns, contains the BigInteger equivalent to the number that is contained in value, or BigInteger.Zero if the conversion failed. The conversion fails if thevalue parameter is null or is not in a format that is compliant withstyle. This parameter is passed uninitialized.

Return Values

Boolean -

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BigIntegerStatic: Zero (get)

Zero

Returns a shared BigInteger instance with the value of 0.

 Public Property Get Zero ( ) As BigInteger

Return Values

BigInteger - Returns a shared instance of the value of 0.

Remarks

This is to reduce the creation of multiple instances of values that are commonly used.

Read Only.

See Also

Project CorLib Overview

Class BigIntegerStatic Overview


BinaryReader

BinaryReader

Provides a set of methods to read typed information from a Stream.

Implements:

IObject

Public:

Properties:

Name | Description
BaseStream (get) | Returns the underlying Stream being read by the BinaryReader.

Methods:

Name | Description
CloseReader | Closes the reader and underlying Stream.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
PeekChar | Returns the next character to be decoded from the byte stream. The position in the stream is not advanced after the read.
Read | Fills either a Byte array or Integer array with the specified number of elements. Or returns the next character to be decoded from the stream.
ReadBoolean | Reads a Boolean value from the current stream and advances the current position of the stream by one byte.
ReadByte | Reads the next byte in the stream, and advances the position one byte.
ReadBytes | Reads the specified number of bytes from the stream and returns them in an array.
ReadChar | Reads the next decode character in the stream, and advances the position the number of bytes requirece to assemble a single character.
ReadChars | Reads the specified number of characters from the current stream, returns the data in a character array, and advances the current position in accordance with the Encoding used and the specific character being read from the stream.
ReadCurrency | Reads an 8-byte Currency value from the current stream and advances the current position of the stream by eight bytes.
ReadDate | Reads eight bytes from the stream and returns them as a Date type.
ReadDecimal | Reads a decimal value from the current stream and advances the current position of the stream by sixteen bytes.
ReadDouble | Reads an 8-byte floating point value from the current stream and advances the current position of the stream by eight bytes.
ReadInt16 | Reads an 2-byte signed integer from the current stream and advances the current position of the stream by two bytes.
ReadInt32 | Reads a 4-byte signed integer from the current stream and advances the current position of the stream by four bytes.
ReadInt64 | Reads an 8-byte signed integer from the current stream and advances the current position of the stream by eight bytes.
ReadSingle | Reads a 4-byte floating point value from the current stream and advances the current position of the stream by four bytes.
ReadString | Reads a string from the current stream. The string is prefixed with the length, encoded as an integer seven bits at a time.
ToString | Returns a string representation of this object instance.

Remarks

The bytes from a stream can be read and cast to a specific data type. Each data type will determine the number of bytes to be read from the stream. Once the number of bytes have been read, they are assembled into the requested data type, advancing the position in the stream the required number of bytes.

Characters can be read from the stream using the specified Encoding. If Encoding is not specified then the BinaryReader is created using UTF8Encoding.

Examples

The following example demonstrates the two ways to create a BinaryReader object using the NewBinaryReader constructor method.

Public Sub Main()
    Dim Source As FileStream
    Dim Reader As BinaryReader

    Set Source = File.OpenFile("MyFile.txt", FileMode.OpenExisting)

    ' method one
    Set Reader = NewBinaryReader(Source)

    ' method two
    Set Reader = Cor.NewBinaryReader(Source)

End Sub

See Also

Project CorLib Overview

Class BinaryReader Overview

Constructors

BinaryWriter

Stream


BinaryReader: BaseStream (get)

BaseStream

Returns the underlying Stream being read by the BinaryReader.

 Public Property Get BaseStream ( ) As Stream

Return Values

Stream - The underlying Stream associated with the BinaryReader.

Read Only.

See Also

Project CorLib Overview

Class BinaryReader Overview


BinaryReader: CloseReader

CloseReader

Closes the reader and underlying Stream.

 Public Sub CloseReader ( )

Remarks

If the reader was created with the LeaveOpen parameter set to True then the underlying stream will not be closed with this reader.

See Also

Project CorLib Overview

Class BinaryReader Overview


BinaryReader: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class BinaryReader Overview

IObject


BinaryReader: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class BinaryReader Overview

IObject


BinaryReader: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class BinaryReader Overview


BinaryReader: PeekChar

PeekChar

Returns the next character to be decoded from the byte stream. The position in the stream is not advanced after the read.

 Public Function PeekChar ( ) As Long

Return Values

Long - The next character to be Read, or -1 if no more characters are in the stream.

Remarks

This function requires the stream to support Seeking. If it does not, then -1 will always be returned.

Exceptions

Exception | Condition
EndOfStreamException | The end of the stream is reached.
ObjectDisposedException | The stream is closed.
IOException | An I/O error occurs.

See Also

Project CorLib Overview

Class BinaryReader Overview

ReadChar


BinaryReader: Read

Read

Fills either a Byte array or Integer array with the specified number of elements. Or returns the next character to be decoded from the stream.

 Public Function Read(
      Optional ByRef Buffer As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Buffer
[ByRef] Optional. Variant. The array to write the data to.
Index
[ByRef] Optional. Variant. The first index in Buffer to start writing data.
Count
[ByRef] Optional. Variant. The number of elements to be written to the array.

Return Values

Long - If an array is specified, this returns the actual number of elements written to Buffer. This could be less than the requested amount. If no parameters are specified then the next character is returned.

Remarks

If a Byte array is passed in, then the bytes from the underlying stream are copied to the array. If an Integer array is passed in, then enough bytes are read from the stream to produce the requested number of decoded characters. The decoded characters are placed in the array starting at Index.

The position within the stream is advanced based on the Encoding being used.

If all parameters are missing then a single character will be decoded from the stream and returned.

All parameters must either be missing or supplied or an exception is thrown.

Exceptions

Exception | Condition
ObjectDisposedException | The stream is closed.
IOException | An I/O error occurs.

Examples

This example writes several bytes to a MemoryStream and read back from the stream bytes and characters depending what parameters are specified.

Private Sub Main()
    Dim Source As New MemoryStream
    Dim Reader As BinaryReader
    Dim Bytes(0 To 1) As Byte
    Dim Chars(0 To 1) As Integer

    Source.WriteBlock NewBytes(65, 66, 67, 194, 163, 70), 0, 6
    Source.Position = 0

    Set Reader = NewBinaryReader(Source)

    Debug.Print "Read next one character."
    PrintChar Reader.Read
    Debug.Print

    Debug.Print "Read next two bytes."
    Debug.Print CorString.Format("  {0} byte(s) read.", Reader.Read(Bytes, 0, 2))
    PrintBytes Bytes
    Debug.Print

    Debug.Print "Read next two characters."
    Debug.Print CorString.Format("  {0} character(s) read.", Reader.Read(Chars, 0, 2))
    PrintChars Chars
End Sub

Private Sub PrintChars(ByRef Chars() As Integer)
    Dim Char As Variant

    For Each Char In Chars
        PrintChar Char
    Next
End Sub

Private Sub PrintChar(ByVal Char As Integer)
    Debug.Print CorString.Format("  {0,3} = ""{0:$}""", Char)
End Sub

Private Sub PrintBytes(ByRef Bytes() As Byte)
    Dim Value As Variant

    For Each Value In Bytes
        Debug.Print CorString.Format("  &h{0:X2} ", Value)
    Next
End Sub

' This example code produces the following output.
'
'    Read next one character.
'       65 = "A"
'
'    Read next two bytes.
'      2 byte(s) read.
'      &h42
'      &h43
'
'    Read next two characters.
'      2 character(s) read.
'      163 = "£"
'       70 = "F"

See Also

Project CorLib Overview

Class BinaryReader Overview

ReadChars

ReadBytes

CorString

Constructors


BinaryReader: ReadBoolean

ReadBoolean

Reads a Boolean value from the current stream and advances the current position of the stream by one byte.

 Public Function ReadBoolean ( ) As Boolean

Return Values

Boolean - True if the byte is nonzero; otherwise, False.

Remarks

BinaryReader does not restore the file position after an unsuccessful read.

Exceptions

Exception | Condition
EndOfStreamException | The end of the stream is reached.
ObjectDisposedException | The stream is closed.
IOException | An I/O error occurs.

See Also

Project CorLib Overview

Class BinaryReader Overview


BinaryReader: ReadByte

ReadByte

Reads the next byte in the stream, and advances the position one byte.

 Public Function ReadByte ( ) As Byte

Return Values

Byte - The next byte in the stream.

Remarks

BinaryReader does not restore the file position after an unsuccessful read.

Exceptions

Exception | Condition
EndOfStreamException | The end of the stream is reached.
ObjectDisposedException | The stream is closed.
IOException | An I/O error occurs.

Examples

The following example writes a 32-bit integer value then reads it back one byte at a time using ReadByte.

Public Sub Main()
    Dim Source As New MemoryStream
    Dim Reader As BinaryReader
    Dim Writer As BinaryWriter

    Set Writer = NewBinaryWriter(Source, New UnicodeEncoding)
    Writer.WriteValue &H80706050

    Source.Position = 0

    Set Reader = NewBinaryReader(Source)

    PrintByte Reader.ReadByte
    PrintByte Reader.ReadByte
    PrintByte Reader.ReadByte
    PrintByte Reader.ReadByte
End Sub

Private Sub PrintByte(ByVal Value As Byte)
    Debug.Print CorString.Format("&h{0:X2}", Value)
End Sub

' This example code produces the following output.
'
'   &h50
'   &h60
'   &h70
'   &h80

See Also

Project CorLib Overview

Class BinaryReader Overview

Read

ReadBytes

CorString

Constructors


BinaryReader: ReadBytes

ReadBytes

Reads the specified number of bytes from the stream and returns them in an array.

 Public Function ReadBytes(
      ByVal Count As Long ) As Byte ( )

Parameters

Count
[ByVal] Long. The number of bytes to read from the stream.

Return Values

Byte() - A byte array containing the bytes read from the stream.

Remarks

If not enough bytes are in the stream, then the remaining bytes are returned. If there are no bytes in the stream, then a zero-length array is returned, not a null array.

Exceptions

Exception | Condition
ArgumentException | The number of decoded characters to read is greater than Count. This can happen if a Unicode decoder returns fallback characters or a surrogate pair.
ObjectDisposedException | The stream is closed.
IOException | An I/O error occurs.
ArgumentOutOfRangeException | Count is less than zero.

Examples

The following example writes a 32-bit integer value then reads them all back at once using ReadByte.

Public Sub Main()
    Dim Source As New MemoryStream
    Dim Reader As BinaryReader
    Dim Writer As BinaryWriter

    Set Writer = NewBinaryWriter(Source, New UnicodeEncoding)
    Writer.WriteValue &H80706050

    Source.Position = 0

    Set Reader = NewBinaryReader(Source)

    Dim Bytes() As Byte
    Dim Value As Variant

    Bytes = Reader.ReadBytes(4)

    Debug.Print CorString.Format("Read {0} bytes.", CorArray.Length(Bytes))

    For Each Value In Bytes
        PrintByte Value
    Next
End Sub

Private Sub PrintByte(ByVal Value As Byte)
    Debug.Print CorString.Format("&h{0:X2}", Value)
End Sub

' This example code produces the following output.
'
'   Read 4 bytes.
'   &h50
'   &h60
'   &h70
'   &h80

See Also

Project CorLib Overview

Class BinaryReader Overview

Read

ReadByte

CorString

CorArray

Constructors


BinaryReader: ReadChar

ReadChar

Reads the next decode character in the stream, and advances the position the number of bytes requirece to assemble a single character.

 Public Function ReadChar ( ) As Long

Return Values

Long - The next character in the stream.

Remarks

If no characters are left in the stream, and EndOfStreamException is thrown.

Exceptions

Exception | Condition
EndOfStreamException | The end of the stream is reached.
ObjectDisposedException | The stream is closed.
IOException | An I/O error occurs.
ArgumentException | A surrogate character was read.

Examples

The following example writes five characters to a stream then reads them back one character at a time using ReadChar.

Public Sub Main()
    Dim Source As New MemoryStream
    Dim Reader As BinaryReader
    Dim Writer As BinaryWriter

    Set Writer = NewBinaryWriter(Source)
    Writer.WriteValue NewChars("H", "e", "l", "l", "o")

    Source.Position = 0

    Set Reader = NewBinaryReader(Source)

    PrintChar Reader.ReadChar
    PrintChar Reader.ReadChar
    PrintChar Reader.ReadChar
    PrintChar Reader.ReadChar
    PrintChar Reader.ReadChar
End Sub

Private Sub PrintChar(ByVal Char As Integer)
    Debug.Print CorString.Format("{0,3} = ""{0:$}""", Char)
End Sub

' This example code produces the following output.
'
'     72 = "H"
'    101 = "e"
'    108 = "l"
'    108 = "l"
'    111 = "o"

See Also

Project CorLib Overview

Class BinaryReader Overview

Read

ReadChars

PeekChar

CorString

Constructors


BinaryReader: ReadChars

ReadChars

Reads the specified number of characters from the current stream, returns the data in a character array, and advances the current position in accordance with the Encoding used and the specific character being read from the stream.

 Public Function ReadChars(
      ByVal Count As Long ) As Integer ( )

Parameters

Count
[ByVal] Long. The number of characters to read.

Return Values

Integer() - A character array containing data read from the underlying stream. This might be less than the number of characters requested if the end of the stream is reached.

Remarks

BinaryReader does not restore the file position after an unsuccessful read operation.

Examples

The following example writes five characters to a stream then reads them all back at once using ReadChars.

Public Sub Main()
    Dim Source As New MemoryStream
    Dim Reader As BinaryReader
    Dim Writer As BinaryWriter

    Set Writer = NewBinaryWriter(Source)
    Writer.WriteValue NewChars("H", "e", "l", "l", "o")

    Source.Position = 0

    Set Reader = NewBinaryReader(Source)

    Dim Chars() As Integer
    Dim Char As Variant

    Chars = Reader.ReadChars(5)

    Debug.Print CorString.Format("Read {0} characters.", CorArray.Length(Chars))

    For Each Char In Chars
        PrintChar Char
    Next
End Sub

Private Sub PrintChar(ByVal Char As Integer)
    Debug.Print CorString.Format("{0,3} = ""{0:$}""", Char)
End Sub

' This example code produces the following output.
'
'    Read 5 characters.
'     72 = "H"
'    101 = "e"
'    108 = "l"
'    108 = "l"
'    111 = "o"

See Also

Project CorLib Overview

Class BinaryReader Overview

Read

ReadChar

CorString

CorArray

Constructors


BinaryReader: ReadCurrency

ReadCurrency

Reads an 8-byte Currency value from the current stream and advances the current position of the stream by eight bytes.

 Public Function ReadCurrency ( ) As Currency

Return Values

Currency - An 8-byte Currency value read from the current stream.

Remarks

BinaryReader does not restore the file position after an unsuccessful read.

BinaryReader reads this data type in little-endian format.

Exceptions

Exception | Condition
EndOfStreamException | The end of the stream is reached.
ObjectDisposedException | The stream is closed.
IOException | An I/O error occurs.

See Also

Project CorLib Overview

Class BinaryReader Overview


BinaryReader: ReadDate

ReadDate

Reads eight bytes from the stream and returns them as a Date type.

 Public Function ReadDate ( ) As Date

Return Values

Date - A Date type read from the stream.

Remarks

A Visual Basic Date type is represented as a Double type. However, this method reads in a 64 bit integer value as the Ticks of a CorDateTime type and converts it to Date.

If there is a need to read in a standard Date represeted as Double use the ReadDouble method.

Exceptions

Exception | Condition
EndOfStreamException | The end of the stream is reached.
ObjectDisposedException | The stream is closed.
IOException | An I/O error occurs.
OverflowException | The sequence of eight bytes represented an invalid date.

See Also

Project CorLib Overview

Class BinaryReader Overview

ReadDouble


BinaryReader: ReadDecimal

ReadDecimal

Reads a decimal value from the current stream and advances the current position of the stream by sixteen bytes.

 Public Function ReadDecimal ( ) As Variant

Return Values

Variant - A decimal value read from the current stream.

Remarks

BinaryReader does not restore the file position after an unsuccessful read.

BinaryReader reads this data type in little-endian format.

The decimal type is created from sixteen bytes using the same layout as the .NET decimal type. The layout is different than that of Visual Basic as shown in the following table.

Framework | Layout
Visual Basic | bytes 0-1: Variant sub-type information (vbDecimal) bytes 2: precision (0 to 28) bytes 3: sign (&H80 is negative) bytes 4-7: high 32 bits in the 96-bit value bytes 8-11: low 32 bits in the 96-bit value bytes 12-15: middle 32 bits in the 96-bit value
.NET Framework | bytes 0-3: low 32 bits in the 96-bit value bytes 4-7: middle 32 bits in the 96-bit value bytes 8-11: high 32 bits in the 96-bit value bytes 12-13: unused (zero) bytes 14: precision (0 to 28) bytes 15: sign (&H80 is negative)

If the sign byte is non-zero, then the Decimal will be set as negative.

Exceptions

Exception | Condition
EndOfStreamException | The end of the stream is reached.
ObjectDisposedException | The stream is closed.
IOException | An I/O error occurs.
ArgumentOutOfRangeException | The decimal precision is greater than 28.

See Also

Project CorLib Overview

Class BinaryReader Overview


BinaryReader: ReadDouble

ReadDouble

Reads an 8-byte floating point value from the current stream and advances the current position of the stream by eight bytes.

 Public Function ReadDouble ( ) As Double

Return Values

Double - An 8-byte floating point value read from the current stream.

Remarks

BinaryReader does not restore the file position after an unsuccessful read.

BinaryReader reads this data type in little-endian format.

Exceptions

Exception | Condition
EndOfStreamException | The end of the stream is reached.
ObjectDisposedException | The stream is closed.
IOException | An I/O error occurs.

See Also

Project CorLib Overview

Class BinaryReader Overview


BinaryReader: ReadInt16

ReadInt16

Reads an 2-byte signed integer from the current stream and advances the current position of the stream by two bytes.

 Public Function ReadInt16 ( ) As Integer

Return Values

Integer - An 2-byte signed integer read from the current stream.

Remarks

BinaryReader does not restore the file position after an unsuccessful read.

BinaryReader reads this data type in little-endian format.

Exceptions

Exception | Condition
EndOfStreamException | The end of the stream is reached.
ObjectDisposedException | The stream is closed.
IOException | An I/O error occurs.

See Also

Project CorLib Overview

Class BinaryReader Overview


BinaryReader: ReadInt32

ReadInt32

Reads a 4-byte signed integer from the current stream and advances the current position of the stream by four bytes.

 Public Function ReadInt32 ( ) As Long

Return Values

Long - A 4-byte signed integer read from the current stream.

Remarks

BinaryReader does not restore the file position after an unsuccessful read.

BinaryReader reads this data type in little-endian format.

Exceptions

Exception | Condition
EndOfStreamException | The end of the stream is reached.
ObjectDisposedException | The stream is closed.
IOException | An I/O error occurs.

See Also

Project CorLib Overview

Class BinaryReader Overview


BinaryReader: ReadInt64

ReadInt64

Reads an 8-byte signed integer from the current stream and advances the current position of the stream by eight bytes.

 Public Function ReadInt64 ( ) As Int64

Return Values

Int64 - An 8-byte signed integer read from the current stream.

Remarks

BinaryReader does not restore the file position after an unsuccessful read.

BinaryReader reads this data type in little-endian format.

Exceptions

Exception | Condition
EndOfStreamException | The end of the stream is reached.
ObjectDisposedException | The stream is closed.
IOException | An I/O error occurs.

See Also

Project CorLib Overview

Class BinaryReader Overview


BinaryReader: ReadSingle

ReadSingle

Reads a 4-byte floating point value from the current stream and advances the current position of the stream by four bytes.

 Public Function ReadSingle ( ) As Single

Return Values

Single - A 4-byte floating point value read from the current stream.

Remarks

BinaryReader does not restore the file position after an unsuccessful read.

BinaryReader reads this data type in little-endian format.

Exceptions

Exception | Condition
EndOfStreamException | The end of the stream is reached.
ObjectDisposedException | The stream is closed.
IOException | An I/O error occurs.

See Also

Project CorLib Overview

Class BinaryReader Overview


BinaryReader: ReadString

ReadString

Reads a string from the current stream. The string is prefixed with the length, encoded as an integer seven bits at a time.

 Public Function ReadString ( ) As String

Return Values

String - The string datatype.

Remarks

BinaryReader does not restore the file position after an unsuccessful read.

The string is stored in the stream with the number of encoded bytes preceding the actual string data. The bytes are not the typical 4 bytes as is used by Visual Basci when representing the length of the string. The bytes represent a value encoded as 7 bits per byte. While the next read byte has the high bit set (&H80), then the following byte is also part of the length value. For each byte read, first 7 bits of that byte is pushed out 7 bits multiplied by the current byte number - 1 in the sequence. This is not the normal shifting of the current sum of the values. Each read byte must be shifted left individually, as each byte represents a higher set of bits in the resulting number.

We AND the byte with &H3f because we only want the lower 7 bits.
byte 1: (byte and &H3f) << shifted 0 bits added to the sum
byte 2: (byte and &H3f) << shifted 7 bits added to the sum
byte 3: (byte and &H3f) << shifted 14 bits added to the sum

this continues until a byte with a value less than 128 is encountered. At which point, it is shifted and summed like the rest, but no more bytes are to be read in. The sum now contains the number of bytes to be read in and decoded into the string. The Encoding used to write the original string should be used to retrieve the string. Using a different Encoding may return a corrupt string.

Once the length is determined then enough bytes are read in that can be decoded to the string using the specified Encoding.

Exceptions

Exception | Condition
EndOfStreamException | The end of the stream is reached.
ObjectDisposedException | The stream is closed.
IOException | An I/O error occurs.

See Also

Project CorLib Overview

Class BinaryReader Overview


BinaryReader: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class BinaryReader Overview

IObject


BinaryResourceEncoder

BinaryResourceEncoder

This will accept a byte array to be encoded into a .RES file.

Implements:

IResourceEncoder

Public:

Methods:

Name | Description
Encode | Stores a byte array to be written out to a resource (.RES) file.
GetEncodedResource | Retrieves the next encoded resource in the encoder.
Reset | Releases all currently encoded values.

Remarks

Multiple resources can be encoded. Each encoded resource will be stored internally for later retrieval.

See Also

Project CorLib Overview

Class BinaryResourceEncoder Overview

ResourceWriter


BinaryResourceEncoder: Encode

Encode

Stores a byte array to be written out to a resource (.RES) file.

 Public Function Encode(
      ByRef Value As Variant,
      ByRef ResourceName As Variant,
      Optional ByRef ResourceType As Variant,
      Optional ByRef LanguageID As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The byte array to be written to the .RES file.
ResourceName
[ByRef] Variant. The name or ID of the resource.
ResourceType
[ByRef] Optional. Variant. The type of value being encoded.
LanguageID
[ByRef] Optional. Variant. The LocaleID the bitmap is associated with.

Return Values

Boolean - Returns True if the encoder was able to encode the value, False otherwise.

Remarks

Any value can be passed in. No exception is thrown. If the value is not a Byte array then the function returns False.

The ResourceName and ResourceType must be a String or a Numeric value.

The LanguageID can be a CultureInfo object, a culture name, or an LCID. If the LanguageID is not supplied, then the current culture is used.

Null arrays are not encoded. False will be returned.

See Also

Project CorLib Overview

Class BinaryResourceEncoder Overview


BinaryResourceEncoder: GetEncodedResource

GetEncodedResource

Retrieves the next encoded resource in the encoder.

 Public Function GetEncodedResource(
      ByRef OutKey As ResourceKey,
      ByRef OutValue ( ) As Byte ) As Boolean

Parameters

OutKey
[ByRef] ResourceKey. This is set to a ResourceKey object that uniquely identify the encoded resource.
OutValue
[ByRef] Byte. This will be set to a byte array.

Return Values

Boolean - Returns True if an encoded resource was returned, False otherwise.

Remarks

This function can be called multiple times to retrieve multiple resources. As long as a resource is returned, True will be returned, otherwise False will be returned.

See Also

Project CorLib Overview

Class BinaryResourceEncoder Overview


BinaryResourceEncoder: IResourceEncoder

IResourceEncoder

 Implements IResourceEncoder

Return Values

IResourceEncoder -

See Also

Project CorLib Overview

Class BinaryResourceEncoder Overview


BinaryResourceEncoder: Reset

Reset

Releases all currently encoded values.

 Public Sub Reset ( )

See Also

Project CorLib Overview

Class BinaryResourceEncoder Overview


BinaryWriter

BinaryWriter

Provides methods to write typed information to a stream.

Implements:

IObject

Public:

Properties:

Name | Description
BaseStream (get) | Returns the underlying stream this writer is writing to.

Methods:

Name | Description
CloseWriter | Closes the writer, flushing any data.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
Flush | Tells the underlying stream to store its data to its repository.
GetHashCode | Returns a pseudo-unique number identifying this instance.
SeekPosition | Sets the underlying streams current position.
ToString | Returns a string representation of this object instance.
WriteChar | Writes a character to the underlying stream.
WriteValue | Writes the binary representation of a datatype to the underlying stream.

Remarks

The data types that are written to the stream are written in their binary form. The values are written as they are represented in memory. For example, as data type of vbLong is written as 4 bytes, regardless of the actual value of the vbLong variable.

See Also

Project CorLib Overview

Class BinaryWriter Overview

Constructors

BinaryReader


BinaryWriter: BaseStream (get)

BaseStream

Returns the underlying stream this writer is writing to.

 Public Property Get BaseStream ( ) As Stream

Return Values

Stream - The underlying stream.

Remarks

The stream is flushed before it is returned.

Read Only.

See Also

Project CorLib Overview

Class BinaryWriter Overview


BinaryWriter: CloseWriter

CloseWriter

Closes the writer, flushing any data.

 Public Sub CloseWriter ( )

See Also

Project CorLib Overview

Class BinaryWriter Overview


BinaryWriter: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class BinaryWriter Overview

IObject


BinaryWriter: Flush

Flush

Tells the underlying stream to store its data to its repository.

 Public Sub Flush ( )

See Also

Project CorLib Overview

Class BinaryWriter Overview


BinaryWriter: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class BinaryWriter Overview

IObject


BinaryWriter: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class BinaryWriter Overview


BinaryWriter: SeekPosition

SeekPosition

Sets the underlying streams current position.

 Public Function SeekPosition(
      ByVal Offset As Currency,
      ByVal Origin As SeekOrigin ) As Currency

Parameters

Offset
[ByVal] Currency. The number of bytes to move the position.
Origin
[ByVal] SeekOrigin. The starting point to move from in the stream.

Return Values

Currency - The final position in the stream.

See Also

Project CorLib Overview

Class BinaryWriter Overview


BinaryWriter: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class BinaryWriter Overview

IObject


BinaryWriter: WriteChar

WriteChar

Writes a character to the underlying stream.

 Public Sub WriteChar(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. The character to be written. This can be a string or a numeric value.

Remarks

The character is encoded and the byte array is written to the stream.

See Also

Project CorLib Overview

Class BinaryWriter Overview


BinaryWriter: WriteValue

WriteValue

Writes the binary representation of a datatype to the underlying stream.

 Public Sub WriteValue(
      ByRef Value As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant )

Parameters

Value
[ByRef] Variant. The datatype to be written.
Index
[ByRef] Optional. Variant. The starting index of arrays or string characters to being writing from.
Count
[ByRef] Optional. Variant. The number of elements or characters to be written to the stream.

Remarks

Index and vCount are only valid when writing Byte arrays, Integer array, and Strings. For all other types, these parameters are ignored.

Simple datatypes such as vbLong and vbDouble are written out exactly as they appear in memory. Each individual byte of that datatype is written. For example, a vbLong is 4 bytes in memory, even if its value is 0. The 4 bytes are written to the stream, not one byte with a value of 0. A vbDouble is 8 bytes, so all 8 bytes are written as is to the stream.

The one exception is when writing a String value. Both the number of bytes from an encoded string and the encoded bytes are written, however, the length is not written as the individual bytes, like the other datatypes. The length of the string is written as a series of 7bit values. Each byte for the length is calculated by starting out with the actual value, then ANDing it with &H7F to take the first 7 bits. The value is ORed with &H80 to signify there are more bytes to follow for the length. Once that byte is written, the original value is shifted right 7 bits and the process starts over until the value reaches less than &H80. The final byte value is not ORed with &H80, it is written as is without the high bit set. When reading the bytes back, the byte without the high bit set will signal as the last byte in the value.

    Do While value > &H80
        WriteValue CByte((value And &H7F) Or &H80)
        value = (value And &HFFFFFF80) \ &H80
    Loop
    WriteValue CByte(value)

The characters of the string are written as the encoded bytes generated by the current Encoding.

Byte arrays are written as is. There is no description written along with the byte values. The number of bytes will have to be known in advance or manually stored in the stream.

Integer arrays are treated as characters and are converted to the encoded bytes using the current encoding. Like the byte array, the number of bytes is not stored with the encoded characters and will have to be manually stored.

The Decimal datatype is converted to 16 bytes with the same layout as used in .NET. The layout is different than that of VB.

VB Decimal layout
bytes 0-1: Variant datatype information
bytes 2: precision
bytes 3: sign (&H80 is negative)
bytes 4-7: the 32 highest bits in the 96bit value
bytes 8-11: the 32 lowest bits in the 96bit value
bytes 12-15: the 32 middle bits in the 96bit value

.NET Decimal layout
bytes 0-3: the 32 lowest bits in the 96bit value
bytes 4-7: the 32 middle bits in the 96bit value
bytes 8-11: the 32 highest bits in the 96bit value
bytes 12-13: unused (zero)
bytes 14: precision
bytes 15: sign (&H80 is negative)

See Also

Project CorLib Overview

Class BinaryWriter Overview


BitArray

BitArray

Manages a compact array of bit values. Each bit represents a boolean, where True = 1, and False = 0.

Implements:

ICloneable
ICollection
IEnumerable
IObject
IVersionable

Public:

Properties:

Name | Description
Count (get) | Gets the number of bits being represented in the array.
IsReadOnly (get) | Gets if the instance is a read-only instance.
Item (get) | Gets the value of a specific bit in the array.
Item (let) | Sets the value of a specific bit in the array.
Length (get) | Gets the number of bits represented in the array.
Length (let) | Sets the number of bits represented in the array.

Methods:

Name | Description
AndBits | Performs a bitwise AND on the current instance of BitArray using the bits in another instance of BitArray.
Clone | Returns a duplicate of the current instance.
CopyTo | Copies the internal bit-array to a compatible array.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetEnumerator | Returns an enumerator for this instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
NotBits | Performs bitwise negate operation on the internal array.
OrBits | Performs a bitwise OR on the current instance of BitArray using the bits in another instance of BitArray.
SetAll | Sets all of the bits to the specified value of True (1) or False (0).
ToString | Returns a string representation of this object instance.
XorBits | Performs a bitwise XOR on the current instance of BitArray using the bits in another instance of BitArray.

Remarks

The default BitArray size is 32 bits unless a constructor is used to define a custom size.

Examples

The following code example shows how to create and initialize a BitArray and how to print out its values.

Private Sub Main()
    Const CountFormatter As String = "   Count:    {0}"
    Const LengthFormatter As String = "   Length:   {0}"
    Dim MyBA1 As BitArray
    Dim MyBA2 As BitArray
    Dim MyBA3 As BitArray
    Dim MyBA4 As BitArray
    Dim MyBA5 As BitArray

    ' Creates and initializes several BitArrays.
    Set MyBA1 = NewBitArray(5)
    Set MyBA2 = NewBitArray(5, True)
    Set MyBA3 = BitArray.FromBytes(NewBytes(1, 2, 3, 4, 5))
    Set MyBA4 = BitArray.FromBooleans(NewBooleans(True, False, True, True, False))
    Set MyBA5 = BitArray.FromLongs(NewLongs(6, 7, 8, 9, 10))

    ' Displays the properties and values of the BitArrays.
    Debug.Print "MyBA1"
    Debug.Print CorString.Format(CountFormatter, MyBA1.Count)
    Debug.Print CorString.Format(CountFormatter, MyBA1.Length)
    Debug.Print "   Values:"
    PrintValues MyBA1, 8

    Debug.Print "MyBA2"
    Debug.Print CorString.Format(CountFormatter, MyBA2.Count)
    Debug.Print CorString.Format(CountFormatter, MyBA2.Length)
    Debug.Print "   Values:"
    PrintValues MyBA2, 8

    Debug.Print "MyBA3"
    Debug.Print CorString.Format(CountFormatter, MyBA3.Count)
    Debug.Print CorString.Format(CountFormatter, MyBA3.Length)
    Debug.Print "   Values:"
    PrintValues MyBA3, 8

    Debug.Print "MyBA4"
    Debug.Print CorString.Format(CountFormatter, MyBA4.Count)
    Debug.Print CorString.Format(CountFormatter, MyBA4.Length)
    Debug.Print "   Values:"
    PrintValues MyBA4, 8

    Debug.Print "MyBA5"
    Debug.Print CorString.Format(CountFormatter, MyBA5.Count)
    Debug.Print CorString.Format(CountFormatter, MyBA5.Length)
    Debug.Print "   Values:"
    PrintValues MyBA5, 8
End Sub

Private Sub PrintValues(ByVal MyList As IEnumerable, ByVal MyWidth As Long)
    Dim i As Long
    Dim Value As Variant

    i = MyWidth

    For Each Value In MyList
        If i <= 0 Then
            i = MyWidth
            Debug.Print
        End If

        i = i - 1
        Debug.Print CorString.Format("{0,8}", Value);
    Next

    Debug.Print
End Sub

' This code produces the following output.
'
'    MyBA1
'       Count:    5
'       Count:    5
'    Values:
'       False   False   False   False   False
'    MyBA2
'       Count:    5
'       Count:    5
'    Values:
'       True    True    True    True    True
'    MyBA3
'       Count:    40
'       Count:    40
'    Values:
'        True   False   False   False   False   False   False   False
'       False    True   False   False   False   False   False   False
'        True    True   False   False   False   False   False   False
'       False   False    True   False   False   False   False   False
'        True   False    True   False   False   False   False   False
'    MyBA4
'       Count:    5
'       Count:    5
'    Values:
'        True   False    True    True   False
'    MyBA5
'       Count:    160
'       Count:    160
'    Values:
'       False    True    True   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'        True    True    True   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False    True   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'        True   False   False    True   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False    True   False    True   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False

See Also

Project CorLib Overview

Class BitArray Overview

Constructors

BitArrayStatic


BitArray: AndBits

AndBits

Performs a bitwise AND on the current instance of BitArray using the bits in another instance of BitArray.

 Public Function AndBits(
      ByVal Bits As BitArray ) As BitArray

Parameters

Bits
[ByVal] BitArray. The BitArray object with which to perform the bitwise AND operation with.

Return Values

BitArray - The internal set of bits is modified based on the operation, however, the object returns itself for ease of concatenated operations.

See Also

Project CorLib Overview

Class BitArray Overview


BitArray: Clone

Clone

Returns a duplicate of the current instance.

 Public Function Clone ( ) As BitArray

Return Values

BitArray - A duplicate of the current instance.

See Also

Project CorLib Overview

Class BitArray Overview


BitArray: CopyTo

CopyTo

Copies the internal bit-array to a compatible array.

 Public Sub CopyTo(
      ByRef Arr As Variant,
      ByVal Index As Long )

Parameters

Arr
[ByRef] Variant. The array to copy the values to.
Index
[ByVal] Long. The starting position in the array to begin copying to.

Remarks

This method supports the copying to three array types: Long, Byte and Boolean. When copying to Long or Byte type arrays, the bits in the elements are equivalents to the bits in the BitArray. When copying to a Boolean array, each boolean element represents a single bit in the array.

See Also

Project CorLib Overview

Class BitArray Overview


BitArray: Count (get)

Count

Gets the number of bits being represented in the array.

 Public Property Get Count ( ) As Long

Return Values

Long - The number of bits represented.

Remarks

This returns the same value as Length, however, this property is read-only.

Read Only.

See Also

Project CorLib Overview

Class BitArray Overview


BitArray: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class BitArray Overview

IObject


BitArray: GetEnumerator

GetEnumerator

Returns an enumerator for this instance.

 Public Function GetEnumerator ( ) As IEnumerator

Return Values

IEnumerator - An enumerator

See Also

Project CorLib Overview

Class BitArray Overview


BitArray: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class BitArray Overview

IObject


BitArray: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class BitArray Overview


BitArray: ICollection

ICollection

 Implements ICollection

Return Values

ICollection -

See Also

Project CorLib Overview

Class BitArray Overview


BitArray: IEnumerable

IEnumerable

 Implements IEnumerable

Return Values

IEnumerable -

See Also

Project CorLib Overview

Class BitArray Overview


BitArray: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class BitArray Overview


BitArray: IsReadOnly (get)

IsReadOnly

Gets if the instance is a read-only instance.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - Value indicating if the instance is read-only.

Read Only.

See Also

Project CorLib Overview

Class BitArray Overview


BitArray: Item (get)

Item

Gets the value of a specific bit in the array.

 Public Property Get Item(
      ByVal Index As Long ) As Boolean

Parameters

Index
[ByVal] Long. The specific bit to return.

Return Values

Boolean - Value of the specified bit.

Remarks

Index is zero based.

Read/Write.

See Also

Project CorLib Overview

Class BitArray Overview


BitArray: Item (let)

Item

Sets the value of a specific bit in the array.

 Public Property Let Item(
      ByVal Index As Long,
      ByVal Value As Boolean )

Parameters

Index
[ByVal] Long. The specific bit to set.
Value
[ByVal] Boolean. The value to set the specified bit to.

Remarks

Index is zero based.

Read/Write.

See Also

Project CorLib Overview

Class BitArray Overview


BitArray: IVersionable

IVersionable

 Implements IVersionable

Return Values

IVersionable -

See Also

Project CorLib Overview

Class BitArray Overview


BitArray: Length (get)

Length

Gets the number of bits represented in the array.

 Public Property Get Length ( ) As Long

Return Values

Long - The number of bits represented.

Read/Write.

See Also

Project CorLib Overview

Class BitArray Overview


BitArray: Length (let)

Length

Sets the number of bits represented in the array.

 Public Property Let Length(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The number of bits to represent.

Remarks

If the length of the array is increased, then the newly available bits are set to 0 (False).

Read/Write.

See Also

Project CorLib Overview

Class BitArray Overview


BitArray: NotBits

NotBits

Performs bitwise negate operation on the internal array.

 Public Function NotBits ( ) As BitArray

Return Values

BitArray - Returns a reference to itself to allow for concatenated operations.

See Also

Project CorLib Overview

Class BitArray Overview


BitArray: OrBits

OrBits

Performs a bitwise OR on the current instance of BitArray using the bits in another instance of BitArray.

 Public Function OrBits(
      ByVal Bits As BitArray ) As BitArray

Parameters

Bits
[ByVal] BitArray. The BitArray object with which to perform the bitwise OR operation with.

Return Values

BitArray - The internal set of bits is modified based on the operation, however, the object returns itself for ease of concatenated operations.

See Also

Project CorLib Overview

Class BitArray Overview


BitArray: SetAll

SetAll

Sets all of the bits to the specified value of True (1) or False (0).

 Public Sub SetAll(
      ByVal Value As Boolean )

Parameters

Value
[ByVal] Boolean. The value to set all the bits to.

See Also

Project CorLib Overview

Class BitArray Overview


BitArray: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class BitArray Overview

IObject


BitArray: XorBits

XorBits

Performs a bitwise XOR on the current instance of BitArray using the bits in another instance of BitArray.

 Public Function XorBits(
      ByVal Bits As BitArray ) As BitArray

Parameters

Bits
[ByVal] BitArray. The BitArray object with which to perform the bitwise XOR operation with.

Return Values

BitArray - The internal set of bits is modified based on the operation, however, the object returns itself for ease of concatenated operations.

See Also

Project CorLib Overview

Class BitArray Overview


BitArrayStatic

BitArrayStatic

Provides creation methods from various types of arrays.

Public:

Methods:

Name | Description
FromBooleans | Returns a BitArray object created from an array of Booleans. Each boolean represents a single bit in the bit array.
FromBytes | Returns a BitArray object created from an array of Bytes. Each bit in each byte represents an associated bit in the bit array.
FromLongs | Returns a BitArray object created from an array of Longs. Each bit in each long represents an associated bit in the bit array.

Remarks

This class cannot be directly instantiated. In order to use the methods in the class, use the BitArray.MethodName syntax.

Examples

The following code example shows how to create and initialize a BitArray and how to print out its values.

Private Sub Main()
    Const CountFormatter As String = "   Count:    {0}"
    Const LengthFormatter As String = "   Length:   {0}"
    Dim MyBA1 As BitArray
    Dim MyBA2 As BitArray
    Dim MyBA3 As BitArray
    Dim MyBA4 As BitArray
    Dim MyBA5 As BitArray

    ' Creates and initializes several BitArrays.
    Set MyBA1 = NewBitArray(5)
    Set MyBA2 = NewBitArray(5, True)
    Set MyBA3 = BitArray.FromBytes(NewBytes(1, 2, 3, 4, 5))
    Set MyBA4 = BitArray.FromBooleans(NewBooleans(True, False, True, True, False))
    Set MyBA5 = BitArray.FromLongs(NewLongs(6, 7, 8, 9, 10))

    ' Displays the properties and values of the BitArrays.
    Debug.Print "MyBA1"
    Debug.Print CorString.Format(CountFormatter, MyBA1.Count)
    Debug.Print CorString.Format(CountFormatter, MyBA1.Length)
    Debug.Print "   Values:"
    PrintValues MyBA1, 8

    Debug.Print "MyBA2"
    Debug.Print CorString.Format(CountFormatter, MyBA2.Count)
    Debug.Print CorString.Format(CountFormatter, MyBA2.Length)
    Debug.Print "   Values:"
    PrintValues MyBA2, 8

    Debug.Print "MyBA3"
    Debug.Print CorString.Format(CountFormatter, MyBA3.Count)
    Debug.Print CorString.Format(CountFormatter, MyBA3.Length)
    Debug.Print "   Values:"
    PrintValues MyBA3, 8

    Debug.Print "MyBA4"
    Debug.Print CorString.Format(CountFormatter, MyBA4.Count)
    Debug.Print CorString.Format(CountFormatter, MyBA4.Length)
    Debug.Print "   Values:"
    PrintValues MyBA4, 8

    Debug.Print "MyBA5"
    Debug.Print CorString.Format(CountFormatter, MyBA5.Count)
    Debug.Print CorString.Format(CountFormatter, MyBA5.Length)
    Debug.Print "   Values:"
    PrintValues MyBA5, 8
End Sub

Private Sub PrintValues(ByVal MyList As IEnumerable, ByVal MyWidth As Long)
    Dim i As Long
    Dim Value As Variant

    i = MyWidth

    For Each Value In MyList
        If i <= 0 Then
            i = MyWidth
            Debug.Print
        End If

        i = i - 1
        Debug.Print CorString.Format("{0,8}", Value);
    Next

    Debug.Print
End Sub

' This code produces the following output.
'
'    MyBA1
'       Count:    5
'       Count:    5
'    Values:
'       False   False   False   False   False
'    MyBA2
'       Count:    5
'       Count:    5
'    Values:
'       True    True    True    True    True
'    MyBA3
'       Count:    40
'       Count:    40
'    Values:
'        True   False   False   False   False   False   False   False
'       False    True   False   False   False   False   False   False
'        True    True   False   False   False   False   False   False
'       False   False    True   False   False   False   False   False
'        True   False    True   False   False   False   False   False
'    MyBA4
'       Count:    5
'       Count:    5
'    Values:
'        True   False    True    True   False
'    MyBA5
'       Count:    160
'       Count:    160
'    Values:
'       False    True    True   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'        True    True    True   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False    True   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'        True   False   False    True   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False    True   False    True   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False
'       False   False   False   False   False   False   False   False

See Also

Project CorLib Overview

Class BitArrayStatic Overview

BitArray


BitArrayStatic: FromBooleans

FromBooleans

Returns a BitArray object created from an array of Booleans. Each boolean represents a single bit in the bit array.

 Public Function FromBooleans(
      ByRef Values ( ) As Boolean ) As BitArray

Parameters

Values
[ByRef] Boolean. An array of Boolean types.

Return Values

BitArray - A BitArray initialized to the number of bits as there are boolean elements in the array. Each bit is set to the corrisponding boolean value in the array.

See Also

Project CorLib Overview

Class BitArrayStatic Overview


BitArrayStatic: FromBytes

FromBytes

Returns a BitArray object created from an array of Bytes. Each bit in each byte represents an associated bit in the bit array.

 Public Function FromBytes(
      ByRef Values ( ) As Byte ) As BitArray

Parameters

Values
[ByRef] Byte. An array of Byte types.

Return Values

BitArray - A BitArray initialized to the number of bits and their state in the values array.

See Also

Project CorLib Overview

Class BitArrayStatic Overview


BitArrayStatic: FromLongs

FromLongs

Returns a BitArray object created from an array of Longs. Each bit in each long represents an associated bit in the bit array.

 Public Function FromLongs(
      ByRef Values ( ) As Long ) As BitArray

Parameters

Values
[ByRef] Long. An array of Long types.

Return Values

BitArray - A BitArray initialized to the number of bits an their state in the values array.

See Also

Project CorLib Overview

Class BitArrayStatic Overview


BitConverter

BitConverter

Converts base data types to an array of bytes, and an array of bytes to base data types.

Public:

Methods:

Name | Description
CurrencyToInt64Bits | Converts the specified currency number to 64-bit signed integer.
DoubleToInt64Bits | Converts the specified double-precision floating point number to 64-bit signed integer.
GetBytes | Returns a byte array representation of the datatype value.
Int32BitsToSingle | Converts the specified 32-bit signed integer to a single-precision floating point number.
Int64BitsToCurrency | Converts the specified 64-bit signed integer to a currency number.
Int64BitsToDouble | Converts the specified 64-bit signed integer to a double-precision floating point number.
SingleToInt32Bits | Converts the specified single-precision floating point number to 32-bit signed integer.
ToBoolean | Converts an array of bytes to a Boolean value.
ToCurrency | Converts an array of bytes to a Currency value.
ToDate | Converts an array of bytes to a Date value.
ToDecimal | Converts an array of bytes do a Variant Decimal value.
ToDouble | Converts an array of bytes to a Double value.
ToInt16 | Converts an array of bytes to an Integer value.
ToInt32 | Converts an array of bytes to a Long value.
ToInt64 | Returns a 64-bit signed integer converted from eight bytes at a specified position in a byte array.
ToSingle | Converts an array of bytes to a Single value.
ToString | Converts an array of bytes to a string of hexidecimal notations.

Remarks

The BitConverter class helps manipulate value types in their fundamental form, as a series of bytes. A byte is defined as an 8-bit unsigned integer. The BitConverter class includes static methods to convert each of the primitive types to and from an array of bytes, as the following table illustrates.
Type | To byte conversion | From byte conversion
Boolean | GetBytes(Boolean) | ToBoolean
Double | GetBytes(Double) -or- DoubleToInt64Bits(Double) | ToDouble -or- Int64BitsToDouble
Int16 | GetBytes(Int16) | ToInt16
Int32 | GetBytes(Int32) | ToInt32
Int64 | GetBytes(Int64) | ToInt64
Single | GetBytes(Single) | ToSingle
Date | GetBytes(Date) | ToDate
Decimal | GetBytes(Decimal) | ToDecimal

Examples

The following code example illustrates the use of several BitConverter class methods.

Public Sub Main()
    Const Formatter As String = "{0,25}{1,30}"
    Const ADouble   As Double = 0.111111111111111
    Const ASingle   As Single = 0.1111111!
    Const ALong     As Long = 1111111111
    Const AnInt     As Integer = 11111
    Const ABool     As Boolean = True
    Dim AnInt64     As Int64

    AnInt64 = CInt64("1111111111111111111")

    Debug.Print t("This example of methods of the BitConverter class\ngenerates the following output.\n")
    Debug.Print CorString.Format(Formatter, "Argument", "Byte array")
    Debug.Print CorString.Format(Formatter, "--------", "----------")

    PrintValue ADouble
    PrintValue ASingle
    PrintValue AnInt64
    PrintValue ALong
    PrintValue AnInt
    PrintValue ABool
End Sub

Private Sub PrintValue(ByRef Value As Variant)
    Const Formatter As String = "{0,25}{1,30}"
    Dim Bytes() As Byte
    Dim Contents As String

    Bytes = BitConverter.GetBytes(Value)
    Contents = BitConverter.ToString(Bytes)

    Debug.Print CorString.Format(Formatter, Value, Contents)
End Sub

' This code produces the following output.
'
'    This example of methods of the BitConverter class
'    generates the following output.
'
'                     Argument                    Byte array
'                     --------                    ----------
'            0.111111111111111       14-C7-71-1C-C7-71-BC-3F
'                    0.1111111                   37-8E-E3-3D
'          1111111111111111111       C7-71-C4-2B-AB-75-6B-0F
'                   1111111111                   C7-35-3A-42
'                        11111                         67-2B
'                         True                            01

See Also

Project CorLib Overview

Class BitConverter Overview


BitConverter: CurrencyToInt64Bits

CurrencyToInt64Bits

Converts the specified currency number to 64-bit signed integer.

 Public Function CurrencyToInt64Bits(
      ByVal Value As Currency ) As Int64

Parameters

Value
[ByVal] Currency. The number to convert.

Return Values

Int64 - A 64-bit signed integer whose value is equivalent to Value.

Remarks

This copies the 64-bit representation of a currency number to a 64-bit integer. It does not attempt to convert the value similar to using CInt64.

See Also

Project CorLib Overview

Class BitConverter Overview


BitConverter: DoubleToInt64Bits

DoubleToInt64Bits

Converts the specified double-precision floating point number to 64-bit signed integer.

 Public Function DoubleToInt64Bits(
      ByVal Value As Double ) As Int64

Parameters

Value
[ByVal] Double. The number to convert.

Return Values

Int64 - A 64-bit signed integer whose value is equivalent to Value.

Remarks

This copies the 64-bit representation of a double-precision floating point number to a 64-bit integer. It does not attempt to convert the value similar to using CInt64.

See Also

Project CorLib Overview

Class BitConverter Overview


BitConverter: GetBytes

GetBytes

Returns a byte array representation of the datatype value.

 Public Function GetBytes(
      ByRef Value As Variant ) As Byte ( )

Parameters

Value
[ByRef] Variant. The datatype to be converted to a byte array.

Return Values

Byte() - An array of bytes converted from the bits of the original datatype.

Remarks

A type boolean is converted to one byte. If the boolean value is True, then the byte is 1, otherwise, it is 0.

The byte array contains as many bytes as the length of the datatype being converted. A Long returns a 4-byte array, where as a Double will return an 8-byte array.

The following is a list of types that are supported.

  • Boolean
  • Byte
  • Integer
  • Long
  • Int64
  • Single
  • Double
  • Currency
  • Date
  • Decimal

The Decimal type is converted to 16 bytes with the same layout as used in .NET. The layout is different than that of Visual Basic.

The differing layouts is shown in the following table.

Framework | Layout
Visual Basic | bytes 0-1: Variant type information (Decimal has value 14) bytes 2: precision bytes 3: sign (&H80 is negative) bytes 4-7: the 32 highest bits in the 96bit value bytes 8-11: the 32 lowest bits in the 96bit value bytes 12-15: the 32 middle bits in the 96bit value
.NET | bytes 0-3: the 32 lowest bits in the 96bit value bytes 4-7: the 32 middle bits in the 96bit value bytes 8-11: the 32 highest bits in the 96bit value bytes 12-13: unused (zero) bytes 14: precision bytes 15: sign (&H80 is negative)

See Also

Project CorLib Overview

Class BitConverter Overview


BitConverter: Int32BitsToSingle

Int32BitsToSingle

Converts the specified 32-bit signed integer to a single-precision floating point number.

 Public Function Int32BitsToSingle(
      ByVal Value As Long ) As Single

Parameters

Value
[ByVal] Long. The number to convert.

Return Values

Single - A single-precision floating point number whose value is equivalent to Value.

Remarks

This copies the 32-bits of the Value parameter to single-precision value.

Typically, Value is an integer that is returned by the SingleToInt32Bits method.

See Also

Project CorLib Overview

Class BitConverter Overview


BitConverter: Int64BitsToCurrency

Int64BitsToCurrency

Converts the specified 64-bit signed integer to a currency number.

 Public Function Int64BitsToCurrency(
      ByRef Value As Int64 ) As Currency

Parameters

Value
[ByRef] Int64. The number to convert.

Return Values

Currency - A currency number whose value is equivalent to Value.

Remarks

This copies the 64-bits of the Value parameter to currency value.

Typically, Value is an integer that is returned by the CurrencyToInt64Bits method.

See Also

Project CorLib Overview

Class BitConverter Overview


BitConverter: Int64BitsToDouble

Int64BitsToDouble

Converts the specified 64-bit signed integer to a double-precision floating point number.

 Public Function Int64BitsToDouble(
      ByRef Value As Int64 ) As Double

Parameters

Value
[ByRef] Int64. The number to convert.

Return Values

Double - A double-precision floating point number whose value is equivalent to Value.

Remarks

This copies the 64-bits of the Value parameter to double-precision value.

Typically, Value is an integer that is returned by the DoubleToInt64Bits method.

See Also

Project CorLib Overview

Class BitConverter Overview


BitConverter: SingleToInt32Bits

SingleToInt32Bits

Converts the specified single-precision floating point number to 32-bit signed integer.

 Public Function SingleToInt32Bits(
      ByVal Value As Single ) As Long

Parameters

Value
[ByVal] Single. The number to convert.

Return Values

Long - A 32-bit signed integer whose value is equivalent to Value.

Remarks

This copies the 32-bit representation of a single-precision floating point number to a 32-bit integer. It does not attempt to convert the value similar to using CLng.

See Also

Project CorLib Overview

Class BitConverter Overview


BitConverter: ToBoolean

ToBoolean

Converts an array of bytes to a Boolean value.

 Public Function ToBoolean(
      ByRef Value ( ) As Byte,
      ByVal StartIndex As Long ) As Boolean

Parameters

Value
[ByRef] Byte. The array of bytes to create a boolean from.
StartIndex
[ByVal] Long. The byte in the array to create the boolean from.

Return Values

Boolean - Boolean representation of the byte used in the array.

Remarks

The boolean value is created from one byte. If the byte is a non-zero value, True is returned, otherwise, False is returned.

Exceptions

Exception | Condition
ArgumentNullException | Value is uninitialized.
ArgumentOutOfRangeException | StartIndex is less than zero or greater than the length of Value minus 1.

See Also

Project CorLib Overview

Class BitConverter Overview


BitConverter: ToCurrency

ToCurrency

Converts an array of bytes to a Currency value.

 Public Function ToCurrency(
      ByRef Value ( ) As Byte,
      ByVal StartIndex As Long ) As Currency

Parameters

Value
[ByRef] Byte. The array of bytes used to create a Currency from.
StartIndex
[ByVal] Long. The starting byte in the array to create a Currency from.

Return Values

Currency - Currency data-type representation of the 8 bytes used in the array.

Exceptions

Exception | Condition
ArgumentException | StartIndex is greater than or equal to the length of Value minus 7, and is less than or equal to the length of Value minus 1.
ArgumentNullException | Value is uninitialized.
ArgumentOutOfRangeException | StartIndex is less than zero or greater than the length of Value minus 1.

See Also

Project CorLib Overview

Class BitConverter Overview


BitConverter: ToDate

ToDate

Converts an array of bytes to a Date value.

 Public Function ToDate(
      ByRef Value ( ) As Byte,
      ByVal StartIndex As Long ) As Date

Parameters

Value
[ByRef] Byte. The array of bytes to create a date from.
StartIndex
[ByVal] Long. The starting byte in the array to create a date from.

Return Values

Date - Date datatype representation of the 8 bytes used in the array.

Remarks

The date type is stored as ticks in a 64-bit signed integer. The Visual Basic Date type cannot represent the entire range storable in 64-bits.

Exceptions

Exception | Condition
ArgumentException | StartIndex is greater than or equal to the length of Value minus 7, and is less than or equal to the length of Value minus 1.
ArgumentNullException | Value is uninitialized.
ArgumentOutOfRangeException | StartIndex is less than zero or greater than the length of Value minus 1.
OverflowException | The 64-bit value is outside the valid range of the Visual Basic Date type.

See Also

Project CorLib Overview

Class BitConverter Overview


BitConverter: ToDecimal

ToDecimal

Converts an array of bytes do a Variant Decimal value.

 Public Function ToDecimal(
      ByRef Value ( ) As Byte,
      ByVal StartIndex As Long ) As Variant

Parameters

Value
[ByRef] Byte. The array of bytes used to create a Decimal value. Must be atleast 16 bytes in length.
StartIndex
[ByVal] Long. The starting index within the array to be converting to a Decimal value.

Return Values

Variant - The converted Decimal value.

Remarks

The Decimal type is created from 16 bytes with the same layout as used in .NET. The layout is different than that of Visual Basic.

The differing layouts is shown in the following table.

Framework | Layout
Visual Basic | bytes 0-1: Variant type information (Decimal has value 14) bytes 2: precision bytes 3: sign (&H80 is negative) bytes 4-7: the 32 highest bits in the 96bit value bytes 8-11: the 32 lowest bits in the 96bit value bytes 12-15: the 32 middle bits in the 96bit value
.NET | bytes 0-3: the 32 lowest bits in the 96bit value bytes 4-7: the 32 middle bits in the 96bit value bytes 8-11: the 32 highest bits in the 96bit value bytes 12-13: unused (zero) bytes 14: precision bytes 15: sign (&H80 is negative)
If the sign byte is non-zero, then the Decimal will be set as negative.

Exceptions

Exception | Condition
ArgumentException | StartIndex is greater than or equal to the length of Value minus 15, and is less than or equal to the length of Value minus 1.
ArgumentNullException | Value is uninitialized.
ArgumentOutOfRangeException | StartIndex is less than zero or greater than the length of Value minus 1. -or- The precision is greater than 28.

See Also

Project CorLib Overview

Class BitConverter Overview


BitConverter: ToDouble

ToDouble

Converts an array of bytes to a Double value.

 Public Function ToDouble(
      ByRef Value ( ) As Byte,
      ByVal StartIndex As Long ) As Double

Parameters

Value
[ByRef] Byte. The array of bytes to create a double from.
StartIndex
[ByVal] Long. The starting byte in the array to create a double from.

Return Values

Double - Double data-type representation of the 8 bytes used in the array.

Exceptions

Exception | Condition
ArgumentException | StartIndex is greater than or equal to the length of Value minus 7, and is less than or equal to the length of Value minus 1.
ArgumentNullException | Value is uninitialized.
ArgumentOutOfRangeException | StartIndex is less than zero or greater than the length of Value minus 1.

See Also

Project CorLib Overview

Class BitConverter Overview


BitConverter: ToInt16

ToInt16

Converts an array of bytes to an Integer value.

 Public Function ToInt16(
      ByRef Value ( ) As Byte,
      ByVal StartIndex As Long ) As Integer

Parameters

Value
[ByRef] Byte. The array of bytes used to create an integer from.
StartIndex
[ByVal] Long. The starting byte in the array to create an integer from.

Return Values

Integer - Integer data-type representation of the 2 bytes used in the array.

Exceptions

Exception | Condition
ArgumentException | StartIndex is greater than or equal to the length of Value minus 1, and is less than or equal to the length of Value minus 1.
ArgumentNullException | Value is uninitialized.
ArgumentOutOfRangeException | StartIndex is less than zero or greater than the length of Value minus 1.

See Also

Project CorLib Overview

Class BitConverter Overview


BitConverter: ToInt32

ToInt32

Converts an array of bytes to a Long value.

 Public Function ToInt32(
      ByRef Value ( ) As Byte,
      ByVal StartIndex As Long ) As Long

Parameters

Value
[ByRef] Byte. The array of bytes used to create a Long from.
StartIndex
[ByVal] Long. The starting byte in the array to create a Long from.

Return Values

Long - Long data-type representation of the 4 bytes used in the array.

Exceptions

Exception | Condition
ArgumentException | StartIndex is greater than or equal to the length of Value minus 3, and is less than or equal to the length of Value minus 1.
ArgumentNullException | Value is uninitialized.
ArgumentOutOfRangeException | StartIndex is less than zero or greater than the length of Value minus 1.

See Also

Project CorLib Overview

Class BitConverter Overview


BitConverter: ToInt64

ToInt64

Returns a 64-bit signed integer converted from eight bytes at a specified position in a byte array.

 Public Function ToInt64(
      ByRef Value ( ) As Byte,
      ByVal StartIndex As Long ) As Int64

Parameters

Value
[ByRef] Byte. An array of bytes.
StartIndex
[ByVal] Long. The starting position within Value.

Return Values

Int64 - A 64-bit signed integer formed by eight bytes beginning at StartIndex.

Remarks

The ToInt64 method converts the bytes from index StartIndex to StartIndex + 7 to a Int64 value. The order of bytes in the array must be little-endian.

Exceptions

Exception | Condition
ArgumentException | StartIndex is greater than or equal to the length of Value minus 7, and is less than or equal to the length of Value minus 1.
ArgumentNullException | Value is uninitialized.
ArgumentOutOfRangeException | StartIndex is less than zero or greater than the length of Value minus 1.

See Also

Project CorLib Overview

Class BitConverter Overview


BitConverter: ToSingle

ToSingle

Converts an array of bytes to a Single value.

 Public Function ToSingle(
      ByRef Value ( ) As Byte,
      ByVal StartIndex As Long ) As Single

Parameters

Value
[ByRef] Byte. The array of bytes used to create a Single from.
StartIndex
[ByVal] Long. The starting byte in the array to create a Single from.

Return Values

Single - Single data-type representation of the 4 bytes used in the array.

Exceptions

Exception | Condition
ArgumentException | StartIndex is greater than or equal to the length of Value minus 3, and is less than or equal to the length of Value minus 1.
ArgumentNullException | Value is uninitialized.
ArgumentOutOfRangeException | StartIndex is less than zero or greater than the length of Value minus 1.

See Also

Project CorLib Overview

Class BitConverter Overview


BitConverter: ToString

ToString

Converts an array of bytes to a string of hexidecimal notations.

 Public Function ToString(
      ByRef Value ( ) As Byte,
      Optional ByRef StartIndex As Variant,
      Optional ByRef Count As Variant ) As String

Parameters

Value
[ByRef] Byte. The array of bytes used to create a string of hexidecimal values.
StartIndex
[ByRef] Optional. Variant. The starting byte to begin creating hexidecimal values from in the array.
Count
[ByRef] Optional. Variant. The number of bytes to be converted to a hexidecimal notation.

Return Values

String - String containing hexidecimal notations for each byte, separated by hyphens.

Remarks

Each byte to be converted to string is converted into a hexidecimal representation. For example a byte value of 160 would become A0' in the return string. Each byte is separated by a hyphen when more than one byte is being converted. An example is a Long of &HABCDEF01 would become 01-EF-CD-AB'.

See Also

Project CorLib Overview

Class BitConverter Overview


BitMapResourceDecoder

BitMapResourceDecoder

Decodes bitmap byte data from a byte array and produces a StdPicture. Usually the byte array comes from a .RES file file.

Implements:

IResourceDecoder

Public:

Methods:

Name | Description
Decode | Attempts to decode a set of bytes into a Bitmap.
GetDecodeType | Returns the of resource this decoder can decode.
GetResource | Returns the next decoded resource available in the decoder.

See Also

Project CorLib Overview

Class BitMapResourceDecoder Overview

ResourceReader

WinResourceReader


BitMapResourceDecoder: Decode

Decode

Attempts to decode a set of bytes into a Bitmap.

 Public Function Decode(
      ByVal Key As ResourceKey,
      Bytes ( ) As Byte ) As Long

Parameters

Key
[ByVal] ResourceKey. The identifier for the set of bytes.
Bytes
[ByRef] Byte. The byte data to be decoded into a bitmap.

Return Values

Long - The number of resources decoded from the byte data. Returns 1 on success.

Remarks

The key must be of a resource type bitmap (ResourceTypes.BitmapResource).

See Also

Project CorLib Overview

Class BitMapResourceDecoder Overview

ResourceTypes

ResourceKey


BitMapResourceDecoder: GetDecodeType

GetDecodeType

Returns the of resource this decoder can decode.

 Public Function GetDecodeType ( ) As Variant

Return Values

Variant - Returns either a number or string representing the resource type.

See Also

Project CorLib Overview

Class BitMapResourceDecoder Overview

ResourceTypes


BitMapResourceDecoder: GetResource

GetResource

Returns the next decoded resource available in the decoder.

 Public Function GetResource(
      ByRef ReturnKey As ResourceKey,
      ByRef ReturnValue As Variant ) As Boolean

Parameters

ReturnKey
[ByRef] ResourceKey. This is set to the resource key of the next available resource.
ReturnValue
[ByRef] Variant. This is set to the resource value of the next available resource.

Return Values

Boolean - Returns True if a return resource was available and set, False otherwise.

Remarks

For this resource type only 1 resource is ever returned. Once it is returned, the function will return False and the resource cannot be retrieved again.

See Also

Project CorLib Overview

Class BitMapResourceDecoder Overview

ResourceKey


BitMapResourceDecoder: IResourceDecoder

IResourceDecoder

 Implements IResourceDecoder

Return Values

IResourceDecoder -

See Also

Project CorLib Overview

Class BitMapResourceDecoder Overview


BitMapResourceEncoder

BitMapResourceEncoder

This encodes a multiple StdPicture bitmaps into individual arrays of bytes.

Implements:

IResourceEncoder

Public:

Methods:

Name | Description
Encode | Encodes a bitmap into a ResourceKey and encoded byte array.
GetEncodedResource | Retrieves the next encoded resource in the encoder.
Reset | Releases all currently encoded values.

Remarks

In order to save a bitmap into a .RES file, it must be converted to an array of bytes so it can be written to the file.

Each time a bitmap is encoded, the array of bytes is stored internally for future retrieval. Multiple bitmaps can be encoded, each encoded bitmap will be stored with a ResourceKey for future retrieval.

See Also

Project CorLib Overview

Class BitMapResourceEncoder Overview

ResourceWriter


BitMapResourceEncoder: Encode

Encode

Encodes a bitmap into a ResourceKey and encoded byte array.

 Public Function Encode(
      ByRef Value As Variant,
      ByRef ResourceName As Variant,
      Optional ByRef ResourceType As Variant,
      Optional ByRef LanguageID As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The bitmap to be encoded.
ResourceName
[ByRef] Variant. The name or ID of the bitmap.
ResourceType
[ByRef] Optional. Variant. The type of value being encoded. This will always be ignored, and the value ResourceTypes.BitMapResource is used.
LanguageID
[ByRef] Optional. Variant. The LocaleID the bitmap is associated with.

Return Values

Boolean - Returns True if the encoder was able to encode the value, False otherwise.

Remarks

Any value can be passed in. No exception is thrown. If the value is not a bitmap then the function returns False.

The ResourceName can be a String or a Numeric value.

The LanguageID can be a CultureInfo object, a culture name, or an LCID. If the LanguageID is not supplied, then the current culture is used.

See Also

Project CorLib Overview

Class BitMapResourceEncoder Overview


BitMapResourceEncoder: GetEncodedResource

GetEncodedResource

Retrieves the next encoded resource in the encoder.

 Public Function GetEncodedResource(
      ByRef OutKey As ResourceKey,
      ByRef OutValue ( ) As Byte ) As Boolean

Parameters

OutKey
[ByRef] ResourceKey. This is set to a ResourceKey object that uniquely identify the encoded resource.
OutValue
[ByRef] Byte. This will be set to a byte array.

Return Values

Boolean - Returns True if an encoded resource was returned, False otherwise.

Remarks

This function can be called multiple times to retrieve multiple resources. As long as thre is a resource to be returned, True will be returned, otherwise False will be returned.

See Also

Project CorLib Overview

Class BitMapResourceEncoder Overview


BitMapResourceEncoder: IResourceEncoder

IResourceEncoder

 Implements IResourceEncoder

Return Values

IResourceEncoder -

See Also

Project CorLib Overview

Class BitMapResourceEncoder Overview


BitMapResourceEncoder: Reset

Reset

Releases all currently encoded values.

 Public Sub Reset ( )

See Also

Project CorLib Overview

Class BitMapResourceEncoder Overview


Buffer

Buffer

This class provides methods for copying manipulating arrays as byte arrays.

Public:

Methods:

Name | Description
BlockCopy | Copies the bytes from the source array to the destination array.
ByteLength | Returns the length of the array in bytes.
GetByte | Returns a the byte value at the given byte index within an array.
SetByte | Sets the byte value at a given byte index within the array.

Remarks

Any array that is used in these methods are treated as byte arrays. No attention is paid to the type of the original array. They are manipulated as bytes.

Examples

The following code example illustrates the use of several Buffer class methods.

Private Sub Main()
    Dim Arr() As Integer

    Arr = NewIntegers(258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271)

    Debug.Print t("This example of the Buffer class " & _
        "methods generates the following output.\n" & _
        "Note: The array is displayed from right to left.\n")
    Debug.Print t("Initial values of array:\n")

    ' Display the initial array values and ByteLength.
    DisplayArray Arr
    Debug.Print t("\nBuffer.ByteLength(Arr): ") & Buffer.ByteLength(Arr)

    ' Copy a region of the array; set a byte within the array.
    Debug.Print t("\nCall these methods: \n" & _
        "  Buffer.BlockCopy(Arr, 5, Arr, 16, 9),\n" & _
        "  Buffer.SetByte(Arr, 7, 170).\n")

    Buffer.BlockCopy Arr, 5, Arr, 16, 9
    Buffer.SetByte Arr, 7, 170

    ' Display the array and a byte within the array.
    Debug.Print t("Final values of array:\n")
    DisplayArray Arr
    Debug.Print t("\nBuffer.GetByte(Arr, 26): ") & Buffer.GetByte(Arr, 26)
End Sub

' Display the array elements from right to left in hexadecimal.
Private Sub DisplayArray(ByRef Arr() As Integer)
    Dim i As Long

    Debug.Print "  Arr:";

    For i = UBound(Arr) To LBound(Arr) Step -1
        Debug.Print CorString.Format(" {0:X4}", Arr(i));
    Next

    Debug.Print
End Sub

' This code produces the following output.
'
'    This example of the Buffer class methods generates the following output.
'    Note: The array is displayed from right to left.
'
'    Initial values of array:
'
'      Arr: 010F 010E 010D 010C 010B 010A 0109 0108 0107 0106 0105 0104 0103 0102
'
'    Buffer.ByteLength(Arr): 28
'
'    Call these methods:
'      Buffer.BlockCopy(Arr, 5, Arr, 16, 9),
'      Buffer.SetByte(Arr, 7, 170).
'
'    Final values of array:
'
'      Arr: 010F 0101 0801 0701 0601 0501 0109 0108 0107 0106 AA05 0104 0103 0102
'
'    Buffer.GetByte(Arr, 26): 15

See Also

Project CorLib Overview

Class Buffer Overview


Buffer: BlockCopy

BlockCopy

Copies the bytes from the source array to the destination array.

 Public Sub BlockCopy(
      ByRef Source As Variant,
      ByVal SourceOffset As Long,
      ByRef Destination As Variant,
      ByVal DestinationOffset As Long,
      ByVal Count As Long )

Parameters

Source
[ByRef] Variant. The array to copy bytes from.
SourceOffset
[ByVal] Long. The starting byte position to begin copying.
Destination
[ByRef] Variant. The array to receive the bytes.
DestinationOffset
[ByVal] Long. The starting byte position to begin setting bytes.
Count
[ByVal] Long. The number of bytes to be copied.

Remarks

The arrays are treated as byte arrays, so no data-type conversion takes place. All indexes are in bytes, not in the type of the specific array.

The lower-bound of the arrays is ignored. The first byte is at index 0.

Exceptions

Exception | Condition
ArgumentNullException | Source or Destination is uninitialized.
ArgumentException | Source or Destination is not an array. -or- The number of bytes in Source is less than SourceOffset plus Count. -or- The number of bytes in Destination is less than DestinationOffset plus Count.
ArgumentOutOfRangeException | Source, Destination, or Count is less than zero.

See Also

Project CorLib Overview

Class Buffer Overview


Buffer: ByteLength

ByteLength

Returns the length of the array in bytes.

 Public Function ByteLength(
      ByRef Arr As Variant ) As Long

Parameters

Arr
[ByRef] Variant. The array to retrieve the size in bytes from.

Return Values

Long - The size of the array in bytes.

Remarks

The size is calculated by taking the number of elements in the array and multiply it by the number of bytes each element is in length.

Exceptions

Exception | Condition
ArgumentNullException | Arr is unintialized.
ArgumentException | Arr is not an array.

See Also

Project CorLib Overview

Class Buffer Overview


Buffer: GetByte

GetByte

Returns a the byte value at the given byte index within an array.

 Public Function GetByte(
      ByRef Arr As Variant,
      ByVal Index As Long ) As Byte

Parameters

Arr
[ByRef] Variant. The array to retrieve the byte value from.
Index
[ByVal] Long. The byte index to read the byte at.

Return Values

Byte - The byte value from within the array.

Remarks

The index is based on bytes, not the size of the actual array elements. For example: if getting the byte from a Long array at index 3, then the upper 8-bits of the first element will be returned.

The lower-bound of the array is ignored. Index begins at 0.

Exceptions

Exception | Condition
ArgumentNullException | Arr is unintialized.
ArgumentException | Arr is not an array.
ArgumentOutOfRangeException | Index is negative or greater than the length of Arr.

See Also

Project CorLib Overview

Class Buffer Overview


Buffer: SetByte

SetByte

Sets the byte value at a given byte index within the array.

 Public Sub SetByte(
      ByRef Arr As Variant,
      ByVal Index As Long,
      ByVal Value As Byte )

Parameters

Arr
[ByRef] Variant. The array to set the byte value in.
Index
[ByVal] Long. The byte index into the array to set the byte at.
Value
[ByVal] Byte. The byte value to set.

Remarks

The index is based on bytes, not the size of the actual array elements. For example: if setting the byte of a Long array at index 3 , then the upper 8-bits of the first element will be set.

The lower-bound of the array is ignored. Index begins at 0.

Exceptions

Exception | Condition
ArgumentNullException | Arr is unintialized.
ArgumentException | Arr is not an array.
ArgumentOutOfRangeException | Index is negative or greater than the length of Arr.

See Also

Project CorLib Overview

Class Buffer Overview


Calendar

Calendar

Represents various systems of time in which the beginning, length, and divisions of a year are defined.

Public:

Types:

Name | Description
CalendarAlgorithmType | Specifies whether a calendar is solar-based, lunar-based, or lunisolar-based.
CalendarWeekRule | Inidicates how many days of the beginning of January must the first week contain in order to be counted as the first week.

Properties:

Name | Description
AlgorithmType (get) | Gets a value indicating whether the current calendar is solar-based, lunar-based, or a combination of both.
Eras (get) | Returns an list of the eras the calendar can represent.
IsReadOnly (get) | Gets a value indicating whether this Calendar object is read-only.
MaxSupportedDateTime (get) | Gets the latest date and time supported by this Calendar object.
MinSupportedDateTime (get) | Gets the earliest date and time supported by this Calendar object.
TwoDigitYearMax (get) | Returns the maximinum 4-digit year that will be created from a 2-digit value.
TwoDigitYearMax (let) | Sets the maximum 4-digit year that will be created from a 2-digit value.

Methods:

Name | Description
AddDays | Returns a CorDateTime that is the specified number of days from the original Time.
AddHours | Returns a CorDateTime this is the specified number of hours from the original Time.
AddMilliseconds | Returns a CorDateTime this is the specified number of Milliseconds from the original Time.
AddMinutes | Returns a CorDateTime this is the specified number of Minutes from the original Time.
AddMonths | Returns a CorDateTime this is the specified number of Months from the original Time.
AddSeconds | Returns a CorDateTime this is the specified number of Seconds from the original Time.
AddWeeks | Returns a CorDateTime this is the specified number of Weeks from the original Time.
AddYears | Returns a CorDateTime this is the specified number of Years from the original Time.
Clone | Creates a new object that is a copy of the current Calendar object.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetDayOfMonth | Returns the day of the months for the specified date.
GetDayOfWeek | Returns the DayOfWeek enum of the specified date.
GetDayOfYear | Returns the day of the year for the specified date.
GetDaysInMonth | Returns the number of days in the specified month.
GetDaysInYear | Returns the number of days in the specified year.
GetEra | Returns the era that the specified time exists in.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetHour | Returns the hour of the specified time.
GetLeapMonth | Calculates the leap month for a specified year and era.
GetMilliseconds | Returns the milliseconds of the specified time.
GetMinute | Returns the minute of the specified time.
GetMonth | Returns the month of the specified time.
GetMonthsInYear | Returns the number of months in the specified year.
GetSecond | Returns the second of the specified time.
GetWeekOfYear | Returns the week of the year that the specified date belongs to.
GetYear | Returns the year of the specified time.
IsLeapDay | Returns a boolean indicating if the specific day is a leap day.
IsLeapMonth | Returns a boolean indicating if the specific month is a leap month.
IsLeapYear | Returns a boolean indicating if the specific year is a leap year.
ToDateTime | Returns a Gregorian CorDateTime computed using the specific calendar rules.
ToFourDigitYear | Returns a 4-digit year from a 2-digit number.
ToString | Returns a string representation of this object instance.

Remarks

This class cannot be instantiated and should only be used to implement the interface of a calendar class.

See Also

Project CorLib Overview

Class Calendar Overview

CalendarStatic

GregorianCalendar

HebrewCalendar

HijriCalendar

JapaneseCalendar

JulianCalendar

KoreanCalendar

TaiwanCalendar

ThaiBuddhistCalendar


Calendar: AddDays

AddDays

Returns a CorDateTime that is the specified number of days from the original Time.

 Public Function AddDays(
      ByRef Time As Variant,
      ByVal Days As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The date inwhich to add the days to.
Days
[ByVal] Long. The number of days to be added. This value can be negative.

Return Values

CorDateTime - The new CorDateTime with the days added or subtracted.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: AddHours

AddHours

Returns a CorDateTime this is the specified number of hours from the original Time.

 Public Function AddHours(
      ByRef Time As Variant,
      ByVal Hours As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of hours to.
Hours
[ByVal] Long. The number of hours to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a with the specified number of hours added.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: AddMilliseconds

AddMilliseconds

Returns a CorDateTime this is the specified number of Milliseconds from the original Time.

 Public Function AddMilliseconds(
      ByRef Time As Variant,
      ByVal Milliseconds As Double ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Milliseconds to.
Milliseconds
[ByVal] Double. The number of Milliseconds to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Milliseconds added.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: AddMinutes

AddMinutes

Returns a CorDateTime this is the specified number of Minutes from the original Time.

 Public Function AddMinutes(
      ByRef Time As Variant,
      ByVal Minutes As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Minutes to.
Minutes
[ByVal] Long. The number of Minutes to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Minutes added.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: AddMonths

AddMonths

Returns a CorDateTime this is the specified number of Months from the original Time.

 Public Function AddMonths(
      ByRef Time As Variant,
      ByVal Months As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Months to.
Months
[ByVal] Long. The number of Months to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Months added.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: AddSeconds

AddSeconds

Returns a CorDateTime this is the specified number of Seconds from the original Time.

 Public Function AddSeconds(
      ByRef Time As Variant,
      ByVal Seconds As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Seconds to.
Seconds
[ByVal] Long. The number of Seconds to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Seconds added.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: AddWeeks

AddWeeks

Returns a CorDateTime this is the specified number of Weeks from the original Time.

 Public Function AddWeeks(
      ByRef Time As Variant,
      ByVal Weeks As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Weeks to.
Weeks
[ByVal] Long. The number of Weeks to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Weeks added.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: AddYears

AddYears

Returns a CorDateTime this is the specified number of Years from the original Time.

 Public Function AddYears(
      ByRef Time As Variant,
      ByVal Years As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Years to.
Years
[ByVal] Long. The number of Years to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Years added.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: AlgorithmType (get)

AlgorithmType

Gets a value indicating whether the current calendar is solar-based, lunar-based, or a combination of both.

 Public Property Get AlgorithmType ( ) As CalendarAlgorithmType

Return Values

CalendarAlgorithmType - One of the CalendarAlgorithmType values.

Read Only.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: CalendarAlgorithmType

CalendarAlgorithmType

Specifies whether a calendar is solar-based, lunar-based, or lunisolar-based.

 Public Enum CalendarAlgorithmType

Values

Unknown
An unknown calendar basis.
SolarCalendar
A solar-based calendar.
LunarCalendar
A lunar-based calendar.
LunisolarCalendar
A lunisolar-based calendar.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: CalendarWeekRule

CalendarWeekRule

Inidicates how many days of the beginning of January must the first week contain in order to be counted as the first week.

 Public Enum CalendarWeekRule

Values

FirstDay
The first defined week that contains the first day of January is considered the first week of the year.
FirstFullWeek
The first defined week that contains 7 days of January is considered the first week of the year.
FirstFourDayWeek
The first defined week that contains the first 4 days of January is considered the first week of the year.

Remarks

When a full week of 7 days from January is required, the week may not contain January 1st to 6th, since up to the first 6 days of January may exist in the same week and the week would not have 7 days from January in it as it may contain parts of the previous December. Those days would not count towards the number of weeks in the year.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: Clone

Clone

Creates a new object that is a copy of the current Calendar object.

 Public Function Clone ( ) As Calendar

Return Values

Calendar - A copy of the Calendar object.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: Eras (get)

Eras

Returns an list of the eras the calendar can represent.

 Public Property Get Eras ( ) As Long ( ) :

Return Values

Long() - A list of the eras for the calendar.

Remarks

The Eras are listed in reverse chronological order. The current era is the first era in the list.

Eras can be used to segregate sections in a calendar and cause the years to begin at 1 again. How the eras are determined based on the culture the calendar represents.

Read Only.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: GetDayOfMonth

GetDayOfMonth

Returns the day of the months for the specified date.

 Public Function GetDayOfMonth(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The date inwhich to retrieve the day of the month.

Return Values

Long - The day of the month for the specified date.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: GetDayOfWeek

GetDayOfWeek

Returns the DayOfWeek enum of the specified date.

 Public Function GetDayOfWeek(
      ByRef Time As Variant ) As DayOfWeek

Parameters

Time
[ByRef] Variant. The date to retrieve the day of the week for.

Return Values

DayOfWeek - A DayOfWeek enum representing the day of the week.

Remarks

The DayOfWeek is Sunday and is 0-based. The Visual Basic enum vbDayOfWeek is 1-based.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: GetDayOfYear

GetDayOfYear

Returns the day of the year for the specified date.

 Public Function GetDayOfYear(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The date to retrieve the day of the year from.

Return Values

Long - The day of the year.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: GetDaysInMonth

GetDaysInMonth

Returns the number of days in the specified month.

 Public Function GetDaysInMonth(
      ByVal Year As Long,
      ByVal Month As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year inwhich the month exists. This is used by calendars that have months that change based on the year, such as leap years.
Month
[ByVal] Long. The month to retrieve the number of days of.
Era
[ByRef] Optional. Variant. The time period inwhich the year exists.

Return Values

Long -

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: GetDaysInYear

GetDaysInYear

Returns the number of days in the specified year.

 Public Function GetDaysInYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year to retrieve the number of days of.
Era
[ByRef] Optional. Variant. The era the year exists in.

Return Values

Long - The number of days in the year.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: GetEra

GetEra

Returns the era that the specified time exists in.

 Public Function GetEra(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to find the containing era of.

Return Values

Long - The era for the time.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: GetHour

GetHour

Returns the hour of the specified time.

 Public Function GetHour(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the hour from.

Return Values

Long - The hour portion of the time.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: GetLeapMonth

GetLeapMonth

Calculates the leap month for a specified year and era.

 Public Function GetLeapMonth(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. A year.
Era
[ByRef] Optional. Variant. An era.

Return Values

Long - A positive integer that indicates the leap month in the specified year and era.
-or-
Zero if this calendar does not support a leap month or if the year and era parameters do not specify a leap year.

Remarks

In a calendar that supports the notion of a leap month, the leap month can occur either after a particular month or after any month in a year. For example, the GetMonth(DateTime) method returns a number between 1 and 13 that indicates the month associated with a specified date. If there is a leap month between the eighth and ninth months of the year, the GetMonth(DateTime) method returns 8 for the eighth month, 9 for the leap eighth month, and 10 for the ninth month.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: GetMilliseconds

GetMilliseconds

Returns the milliseconds of the specified time.

 Public Function GetMilliseconds(
      ByRef Time As Variant ) As Double

Parameters

Time
[ByRef] Variant. The time to retrieve the milliseconds from.

Return Values

Double - The millisecond portion of the time.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: GetMinute

GetMinute

Returns the minute of the specified time.

 Public Function GetMinute(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the minute from.

Return Values

Long - The minute portion of the time.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: GetMonth

GetMonth

Returns the month of the specified time.

 Public Function GetMonth(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the month from.

Return Values

Long - The month portion of the time.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: GetMonthsInYear

GetMonthsInYear

Returns the number of months in the specified year.

 Public Function GetMonthsInYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year to get the number of months of.
Era
[ByRef] Optional. Variant. The era the year exists in.

Return Values

Long - The number of months in the year.

Remarks

In some calendars not all years have the same number of months. The Hebrew calendar can have 13 months on leap years.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: GetSecond

GetSecond

Returns the second of the specified time.

 Public Function GetSecond(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the second from.

Return Values

Long - The second portion of the time.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: GetWeekOfYear

GetWeekOfYear

Returns the week of the year that the specified date belongs to.

 Public Function GetWeekOfYear(
      ByRef Time As Variant,
      ByVal Rule As CalendarWeekRule,
      ByVal FirstDayOfWeek As DayOfWeek ) As Long

Parameters

Time
[ByRef] Variant. The date to find the week it belongs.
Rule
[ByVal] CalendarWeekRule. Rule to decide what constitutes the first week of the year.
FirstDayOfWeek
[ByVal] DayOfWeek. Defines which week day is the start of a new week.

Return Values

Long - The week that the date belongs to.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: GetYear

GetYear

Returns the year of the specified time.

 Public Function GetYear(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the year from.

Return Values

Long - The year portion of the time.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: IsLeapDay

IsLeapDay

Returns a boolean indicating if the specific day is a leap day.

 Public Function IsLeapDay(
      ByVal Year As Long,
      ByVal Month As Long,
      ByVal Day As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year the day is in.
Month
[ByVal] Long. The month the day is in.
Day
[ByVal] Long. The day to check if is a leap day.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the day is a leap day.

Remarks

A leap day only exists in a leap year, such as February 29th in the Gregorian calendar.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: IsLeapMonth

IsLeapMonth

Returns a boolean indicating if the specific month is a leap month.

 Public Function IsLeapMonth(
      ByVal Year As Long,
      ByVal Month As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year the month is in.
Month
[ByVal] Long. The month to check if it is a leap month.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the month is a leap month.

Remarks

A leap month only exists in a leap year, such as Adar II in the Hebrew calendar.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: IsLeapYear

IsLeapYear

Returns a boolean indicating if the specific year is a leap year.

 Public Function IsLeapYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year to check if is a leap year.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the year is a leap year.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: IsReadOnly (get)

IsReadOnly

Gets a value indicating whether this Calendar object is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - True if this Calendar object is read-only; otherwise, False.

Read Only.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: MaxSupportedDateTime (get)

MaxSupportedDateTime

Gets the latest date and time supported by this Calendar object.

 Public Property Get MaxSupportedDateTime ( ) As CorDateTime

Return Values

CorDateTime - The latest date and time supported by this calendar.

Read Only.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: MinSupportedDateTime (get)

MinSupportedDateTime

Gets the earliest date and time supported by this Calendar object.

 Public Property Get MinSupportedDateTime ( ) As CorDateTime

Return Values

CorDateTime - The earliest date and time supported by this calendar.

Read Only.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: ToDateTime

ToDateTime

Returns a Gregorian CorDateTime computed using the specific calendar rules.

 Public Function ToDateTime(
      ByVal Year As Long,
      ByVal Month As Long,
      ByVal Day As Long,
      ByVal Hour As Long,
      ByVal Minute As Long,
      ByVal Second As Long,
      ByVal Millisecond As Long,
      Optional ByRef Era As Variant ) As CorDateTime

Parameters

Year
[ByVal] Long. The Year in the specific calendar type.
Month
[ByVal] Long. The Month in the specific calendar type.
Day
[ByVal] Long. The Day in the specific calendar type.
Hour
[ByVal] Long. The hour for the new time.
Minute
[ByVal] Long. The minute for the new time.
Second
[ByVal] Long. The second for the new time.
Millisecond
[ByVal] Long. The milliseconds for the new time.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

CorDateTime - A Gregorian version of the date specified.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: ToFourDigitYear

ToFourDigitYear

Returns a 4-digit year from a 2-digit number.

 Public Function ToFourDigitYear(
      ByVal Year As Long ) As Long

Parameters

Year
[ByVal] Long. The year to be converted to 4-digits.

Return Values

Long - A 4-digit year in the specific calendar.

Remarks

A normal way of dealing with years is by refering to them as a 2-digit value. This is evident in the Gregorian calendar system. The year 2005 may be referenced as 05 (pronounced oh-five). When converting a 2-digit year to a 4-digit the century is unknown. 05 could be 2005 or 1905. This property gives the calendar a rule to follow when converting 2-digit years to 4-digit.

A max year of 2029 will cause a minimum year of 1930. These two years represent 100 years which 2-digit years will fall. 00-99 will fall within 1930-2029.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: TwoDigitYearMax (get)

TwoDigitYearMax

Returns the maximinum 4-digit year that will be created from a 2-digit value.

 Public Property Get TwoDigitYearMax ( ) As Long

Return Values

Long - The maximinum year that will be created from a 2-digit value.

Remarks

This value is used by the ToFourDigitYear method.

Read/Write.

See Also

Project CorLib Overview

Class Calendar Overview


Calendar: TwoDigitYearMax (let)

TwoDigitYearMax

Sets the maximum 4-digit year that will be created from a 2-digit value.

 Public Property Let TwoDigitYearMax(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The maximinum 4-digit year to be created.

Remarks

This value is used by the ToFourDigitYear method.

Read/Write.

See Also

Project CorLib Overview

Class Calendar Overview


CalendarStatic

CalendarStatic

Provides static methods for the Calendar class.

Public:

Properties:

Name | Description
CurrentEra (get) | Returns the current era for any calendar class.

Methods:

Name | Description
ReadOnly | Returns a read-only version of the specified Calendar object.

Remarks

To access these methods, use the variable name Calendar directly.

 Era = Calendar.CurrentEra

See Also

Project CorLib Overview

Class CalendarStatic Overview


CalendarStatic: CurrentEra (get)

CurrentEra

Returns the current era for any calendar class.

 Public Property Get CurrentEra ( ) As Long

Return Values

Long - The current era.

Remarks

A constant is returned with the value of 0.

Read Only.

See Also

Project CorLib Overview

Class CalendarStatic Overview

Calendar


CalendarStatic: ReadOnly

ReadOnly

Returns a read-only version of the specified Calendar object.

 Public Function ReadOnly(
      ByVal Calendar As Calendar ) As Calendar

Parameters

Calendar
[ByVal] Calendar. The Calendar object.

Return Values

Calendar - The Calendar object specified by the calendar parameter, if calendar is read-only.
-or-
A read-only memberwise clone of the Calendar object specified by Calendar, if Calendar is not read-only.

See Also

Project CorLib Overview

Class CalendarStatic Overview


CaseInsensitiveComparer

CaseInsensitiveComparer

Provides a comparer that is case-insensitive when comparing strings.

Implements:

IComparer
IObject

Public:

Methods:

Name | Description
Compare | Returns the comparison between two values.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
ToString | Returns a string representation of this object instance.

See Also

Project CorLib Overview

Class CaseInsensitiveComparer Overview

CaseInsensitiveComparerStatic

Constructors


CaseInsensitiveComparer: Compare

Compare

Returns the comparison between two values.

 Public Function Compare(
      ByRef a As Variant,
      ByRef b As Variant ) As Long

Parameters

a
[ByRef] Variant. The left-hand-side of the equation.
b
[ByRef] Variant. the right-hand-side of the equation.

Return Values

Long - The relationship between the values as shown in the table.
Value | Meaning
Less than zero | a is less than b, with casing ignored.
Zero | a equals b, with casing ignored.
Greater than zero | a is greater than b, with casing ignored.

See Also

Project CorLib Overview

Class CaseInsensitiveComparer Overview


CaseInsensitiveComparer: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class CaseInsensitiveComparer Overview


CaseInsensitiveComparer: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class CaseInsensitiveComparer Overview


CaseInsensitiveComparer: IComparer

IComparer

 Implements IComparer

Return Values

IComparer -

See Also

Project CorLib Overview

Class CaseInsensitiveComparer Overview


CaseInsensitiveComparer: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class CaseInsensitiveComparer Overview


CaseInsensitiveComparer: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class CaseInsensitiveComparer Overview


CaseInsensitiveComparerStatic

CaseInsensitiveComparerStatic

Provides access to default culture-sensitive CaseInsensitiveComparer objects.

Public:

Properties:

Name | Description
Default (get) | Gets an instance of CaseInsensitiveComparer that is associated with the Thread.CurrentCulture of the current thread and that is always available.
DefaultInvariant (get) | Gets an instance of CaseInsensitiveComparer that is associated with CultureInfo.InvariantCulture and that is always available.

Remarks

This class cannot be instantiated. To access the defined properties use the class name. Set c = CaseInsensitiveComparer.Default

See Also

Project CorLib Overview

Class CaseInsensitiveComparerStatic Overview

CaseInsensitiveComparer


CaseInsensitiveComparerStatic: Default (get)

Default

Gets an instance of CaseInsensitiveComparer that is associated with the Thread.CurrentCulture of the current thread and that is always available.

 Public Property Get Default ( ) As CaseInsensitiveComparer

Return Values

CaseInsensitiveComparer - An instance of CaseInsensitiveComparer that is associated with CultureInfo.InvariantCulture.

Read Only.

See Also

Project CorLib Overview

Class CaseInsensitiveComparerStatic Overview


CaseInsensitiveComparerStatic: DefaultInvariant (get)

DefaultInvariant

Gets an instance of CaseInsensitiveComparer that is associated with CultureInfo.InvariantCulture and that is always available.

 Public Property Get DefaultInvariant ( ) As CaseInsensitiveComparer

Return Values

CaseInsensitiveComparer - An instance of CaseInsensitiveComparer that is associated with CultureInfo.InvariantCulture.

Read Only.

See Also

Project CorLib Overview

Class CaseInsensitiveComparerStatic Overview


Char

Char

Provides methods for inspecting and manipulating Unicode characters.

Public:

Properties:

Name | Description
MaxValue (get) | Represents the largest possible value of a Char.
MinValue (get) | Represents the smallest possible value of a Char.

Methods:

Name | Description
Compare | Compares two character code units.
ConvertFromInt32 | Converts a 32-bit signed integer value to a 16-bit signed integer as a character.
ConvertFromUtf32 | Converts the specified Unicode code point into a UTF-16 encoded string.
ConvertToInt32 | Converts the character value to a 32-bit signed integer.
ConvertToUtf32 | Converts the value of a UTF-16 encoded surrogate pair into a Unicode code point.
ConvertToUtf32Str | Converts the value of a UTF-16 encoded character or surrogate pair at a specified position in a string into a Unicode code point.
Equals | Evaluates two character code units for equality.
IsHighSurrogate | Indicates whether the specified character has a high surrogate code unit.
IsHighSurrogateStr | Indicates where the character in the string at the specified index is a high surrogate code unit.
IsLowSurrogate | Indicates whether the specified character has a low surrogate code unit.
IsLowSurrogateStr | Indicates where the character in the string at the specified index is a low surrogate code unit.
IsSurrogate | Indicates whether the specified character has a surrogate code unit.
IsSurrogateStr | Indicates whether the character at the specified position in a specified string has a surrogate code unit.
IsWhiteSpace | Indicates if a character is white space.
IsWhiteSpaceStr | Indicates if the specified character in a string is white space.

Remarks

A character is represented as a Unicode code point as a UTF-16 code unit from U+0000 to U+FFFF. Because Visual Basic does not contain an unsigned 16-bit integer type, VBCorLib utilizes the Integer type. The two types have the same binary representation, but have different numeric ranges. This leads to some difficulties when needing to compare characters for sort order.

If characters with the high bit set need to be compared then use the Char.Equals and Char.Compare methods to ensure correct results.

See Also

Project CorLib Overview

Class Char Overview

Equals

Compare

ConvertToInt32

ConvertFromInt32


Char: Compare

Compare

Compares two character code units.

 Public Function Compare(
      ByVal a As Long,
      ByVal b As Long ) As Long

Parameters

a
[ByVal] Long. A character to compare with.
b
[ByVal] Long. A character to compare with.

Return Values

Long - A signed number indicating the position of a parameter in the sort order in relation to the b parameter.
Return Value | Description
Less than zero | a precedes b.
Zero | a has the same position in the sort order as b
Greater than zero | a follows b in the sort order.

Remarks

The range of Unicode code points that represent a character in Visual Basic is U+0000 to U+FFFF (0 to 65535). VBCorLib internally represents characters using the Integer type which has a range from -32768 to 32767. This usually does not present an issue, however, when the need to compare two characters occurs the characters must be converted to correctly handle the 16 bit representation. For instance an Integer value of -1 is Unicode code point U+FFFF which should be the largest code point value during a comparison. In order to correctly compare two characters they are converted to a Long type then ANDed with 0x0000FFFF in order to get a correct ordered representation. The result has an identical 16 bit representation that can be compared correctly.

This method handles character code range -32768 to 65535. A bitwise AND is performed to convert the negative values to their corrisponding positive values. For example -1 is converted to 65535 (U+FFFF) using the bitwise AND operation with a Long type using value = value And &H0000FFFF&.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | a is outside of the valid range -32768 to 65535. -or- b is outside of the valid range -32768 to 65535.

Examples

The following example compares several Integer to Long character values demonstrating 16 bit comparisons.

Public Sub Main()
    ShowComparison 32767, -1
    ShowComparison -1, 65535
    ShowComparison -32768, 1
End Sub

Private Sub ShowComparison(ByVal a As Integer, ByVal b As Long)
    Dim Relation As String

    Select Case Char.Compare(a, b)
        Case Is < 0
            Relation = "<"
        Case Is > 0
            Relation = ">"
        Case Else
            Relation = "="
    End Select

    Debug.Print CorString.Format("{0,7}({0:X4}) {1} {2,7}({2:X8})", a, Relation, b)
End Sub

' This code produces the following output.
'
'     32767(7FFF) <      -1(FFFFFFFF)
'        -1(FFFF) =   65535(0000FFFF)
'    -32768(8000) >       1(00000001)

See Also

Project CorLib Overview

Class Char Overview

ConvertToInt32

ConvertFromInt32


Char: ConvertFromInt32

ConvertFromInt32

Converts a 32-bit signed integer value to a 16-bit signed integer as a character.

 Public Function ConvertFromInt32(
      ByVal Value As Long ) As Integer

Parameters

Value
[ByVal] Long. The 32-bit signed integer value to be converted to a corrisponding 16-bit integer character.

Return Values

Integer - A 16-bit signed integer character.

Remarks

The 16-bit result will be a binary equivalent of the first 16 bits of the Value parameter.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Value is outside the valid range of -32768 to 65535.

Examples

The following example demonstrates converting a range of 32-bit signed integer values to their corrisponding character represented by a 16-bit signed integer using ConvertFromInt32.

Public Sub Main()
    Convert 65
    Convert -1
    Convert 65535
    Convert -32768
    Convert 32768
End Sub

Private Sub Convert(ByVal c As Long)
    Dim Ch As Integer

    Ch = Char.ConvertFromInt32(c)

    Debug.Print CorString.Format("{0,6}(&h{0:X8}) converts to {1,6}(&h{1:X4})", c, Ch)
End Sub

' The example code produces the following output.
'
'        65(&h00000041) converts to     65(&h0041)
'        -1(&hFFFFFFFF) converts to     -1(&hFFFF)
'     65535(&h0000FFFF) converts to     -1(&hFFFF)
'    -32768(&hFFFF8000) converts to -32768(&h8000)
'     32768(&h00008000) converts to -32768(&h8000)

See Also

Project CorLib Overview

Class Char Overview

ConvertToInt32


Char: ConvertFromUtf32

ConvertFromUtf32

Converts the specified Unicode code point into a UTF-16 encoded string.

 Public Function ConvertFromUtf32(
      ByVal UTF32 As Long ) As String

Parameters

UTF32
[ByVal] Long. A 21-bit Unicode code point.

Return Values

String - A string consisting of one character or a surrogate pair of characters equivalent to the code point specified by the Utf32 parameter.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Utf32 is not a valid 21-bit Unicode code point ranging from U+0 through U+10FFFF, excluding the surrogate pair range from U+D800 through U+DFFF.

See Also

Project CorLib Overview

Class Char Overview

ConvertToUtf32

ConvertToUtf32Str


Char: ConvertToInt32

ConvertToInt32

Converts the character value to a 32-bit signed integer.

 Public Function ConvertToInt32(
      ByVal c As Integer ) As Long

Parameters

c
[ByVal] Integer. The character to be converted.

Return Values

Long - A 32-bit signed integer representing the numeric value of the character.

Remarks

In VBCorLib characters are represented with 16-bit signed integers. In order to represent all characters, the numeric value may be represented with a negative value.

If the numeric value is negative, converted positive value will have the same 16-bit binary representation.

A character value of -1(&HFFFF) is converted to 65535(&HFFFF&). Both values have the same 16-bit binary representation.

The converted value will represent a value that can be correctly used for sort order. If characters need to be compared for sorting, consider using Char.Compare to make comparisons.

Examples

This example demonstrates converting a character represented as a 16-bit signed integer to a positive 32-bit signed integer using the ConvertToInt32 method.

Public Sub Main()
    Convert 65
    Convert -1
    Convert -32768
    Convert 32767
End Sub

Private Sub Convert(ByVal c As Integer)
    Dim Ch As Long

    Ch = Char.ConvertToInt32(c)

    Debug.Print CorString.Format("{0,6}(&h{0:X4}) converts to {1,6}(&h{1:X8})", c, Ch)
End Sub

' The example code produces the following output.
'
'        65(&h0041) converts to     65(&h00000041)
'        -1(&hFFFF) converts to  65535(&h0000FFFF)
'    -32768(&h8000) converts to  32768(&h00008000)
'     32767(&h7FFF) converts to  32767(&h00007FFF)

See Also

Project CorLib Overview

Class Char Overview

ConvertFromInt32

Compare

Equals


Char: ConvertToUtf32

ConvertToUtf32

Converts the value of a UTF-16 encoded surrogate pair into a Unicode code point.

 Public Function ConvertToUtf32(
      ByVal HighSurrogate As Long,
      ByVal LowSurrogate As Long ) As Long

Parameters

HighSurrogate
[ByVal] Long. A high surrogate code unit (that is, a code unit ranging from U+D800 through U+DBFF).
LowSurrogate
[ByVal] Long. A low surrogate code unit (that is, a code unit ranging from U+DC00 through U+DFFF).

Return Values

Long - The 21-bit Unicode code point represented by the highSurrogate and lowSurrogate parameters.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | HighSurrogate is not in the range U+D800 through U+DBFF, or LowSurrogate is not in the range U+DC00 through U+DFFF.

See Also

Project CorLib Overview

Class Char Overview

ConvertToUtf32Str

ConvertFromUtf32


Char: ConvertToUtf32Str

ConvertToUtf32Str

Converts the value of a UTF-16 encoded character or surrogate pair at a specified position in a string into a Unicode code point.

 Public Function ConvertToUtf32Str(
      ByRef s As String,
      ByVal Index As Long ) As Long

Parameters

s
[ByRef] String. A string that contains a character or surrogate pair.
Index
[ByVal] Long. The index position of the character or surrogate pair in s.

Return Values

Long - The 21-bit Unicode code point represented by the character or surrogate pair at the position in the s parameter specified by the index parameter.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is not a position within s.
ArgumentException | The specified index position contains a surrogate pair, and either the first character in the pair is not a valid high surrogate or the second character in the pair is not a valid low surrogate.

See Also

Project CorLib Overview

Class Char Overview

ConvertToUtf32

ConvertFromUtf32


Char: Equals

Equals

Evaluates two character code units for equality.

 Public Function Equals(
      ByVal a As Long,
      ByVal b As Long ) As Boolean

Parameters

a
[ByVal] Long. A character to compare with.
b
[ByVal] Long. A character to compare with.

Return Values

Boolean - True if a equals b; otherwise False.

Remarks

The range of Unicode code points that represent a character in Visual Basic is U+0000 to U+FFFF (0 to 65535). VBCorLib internally represents characters using the Integer type which has a range from -32768 to 32767. This usually does not present an issue, however, when the need to compare two characters occurs the characters must be converted to correctly handle the 16 bit representation. For instance an Integer value of -1 is Unicode code point U+FFFF which should be the largest code point value during a comparison. In order to correctly compare two characters they are converted to a Long type then ANDed with 0x0000FFFF in order to get a correct ordered representation. The result has an identical 16 bit representation that can be compared correctly.

This method handles character code range -32768 to 65535. A bitwise AND is performed to convert the negative values to their corrisponding positive values. For example -1 is converted to 65535 (U+FFFF) using the bitwise AND operation with a Long type using value = value And &H0000FFFF&.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | a is outside of the valid range -32768 to 65535. -or- b is outside of the valid range -32768 to 65535.

Examples

The following example compares several Integer to Long character values demonstrating 16 bit comparisons

Public Sub Main()
    ShowComparison 32767, -32768
    ShowComparison -1, 65535
    ShowComparison -32768, 32768
End Sub

Private Sub ShowComparison(ByVal a As Integer, ByVal b As Long)
    Dim Relation As String

    If Char.Equals(a, b) Then
        Relation = "="
    Else
        Relation = "<>"
    End If

    Debug.Print CorString.Format("{0,7}({0:X4}) {1} {2,7}({2:X8})", a, Relation, b)
End Sub

' This code produces the following output.
'
'     32767(7FFF) <>  -32768(FFFF8000)
'        -1(FFFF) =   65535(0000FFFF)
'    -32768(8000) =   32768(00008000)

See Also

Project CorLib Overview

Class Char Overview

ConvertToInt32

ConvertFromInt32


Char: IsHighSurrogate

IsHighSurrogate

Indicates whether the specified character has a high surrogate code unit.

 Public Function IsHighSurrogate(
      ByVal c As Long ) As Boolean

Parameters

c
[ByVal] Long. The Unicode character to evaluate.

Return Values

Boolean - True if the value of c parameter ranges from U+D800 to U+DBFF; otherwise, False.

Remarks

This method handles the discrepancy between integers and longs particularly when dealing with negative integer values that should map to positive long values.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | c is outside of the valid range -32768 to 65535.

See Also

Project CorLib Overview

Class Char Overview

IsHighSurrogateStr

IsLowSurrogate

IsLowSurrogateStr

IsSurrogate

IsSurrogateStr


Char: IsHighSurrogateStr

IsHighSurrogateStr

Indicates where the character in the string at the specified index is a high surrogate code unit.

 Public Function IsHighSurrogateStr(
      ByRef s As String,
      ByVal Index As Long ) As Boolean

Parameters

s
[ByRef] String. A string.
Index
[ByVal] Long. The position of the character to evaluate in s.

Return Values

Boolean - True if the value of c parameter ranges from U+D800 to U+DBFF; otherwise, False.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is not a position within s.

See Also

Project CorLib Overview

Class Char Overview

IsHighSurrogate

IsLowSurrogate

IsLowSurrogateStr

IsSurrogate

IsSurrogateStr


Char: IsLowSurrogate

IsLowSurrogate

Indicates whether the specified character has a low surrogate code unit.

 Public Function IsLowSurrogate(
      ByVal c As Long ) As Boolean

Parameters

c
[ByVal] Long. The Unicode character to evaluate.

Return Values

Boolean - True if the value of c parameter ranges from U+DC00 to U+DFFF; otherwise, False.

Remarks

This method handles the discrepancy between integers and longs particularly when dealing with negative integer values that should map to positive long values.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | c is outside of the valid range -32768 to 65535.

See Also

Project CorLib Overview

Class Char Overview

IsLowSurrogateStr

IsHighSurrogate

IsHighSurrogateStr

IsSurrogate

IsSurrogateStr


Char: IsLowSurrogateStr

IsLowSurrogateStr

Indicates where the character in the string at the specified index is a low surrogate code unit.

 Public Function IsLowSurrogateStr(
      ByRef s As String,
      ByVal Index As Long ) As Boolean

Parameters

s
[ByRef] String. A string.
Index
[ByVal] Long. The position of the character to evaluate in s.

Return Values

Boolean - True if the specified character in the s parameter ranges from U+DC00 to U+DFFF; otherwise, False.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Index is not a position within s.

See Also

Project CorLib Overview

Class Char Overview

IsLowSurrogate

IsHighSurrogate

IsHighSurrogateStr

IsSurrogate

IsSurrogateStr


Char: IsSurrogate

IsSurrogate

Indicates whether the specified character has a surrogate code unit.

 Public Function IsSurrogate(
      ByVal c As Long ) As Boolean

Parameters

c
[ByVal] Long. The Unicode character to evaluate.

Return Values

Boolean - True if c is either a high surrogate or a low surrogate; otherwise, False.

Remarks

A surrogate is a Char with a UTF-16 code unit in the range from U+D800 to U+DFFF. The individual surrogate code unit has no interpretation of its own, but has meaning only when used as part of a surrogate pair.

For more information about surrogate pairs, see the Unicode Standard at the OnlineUnicode home page.

This method handles the discrepancy between integers and longs particularly when dealing with negative integer values that should map to positive long values.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | c is outside of the valid range -32768 to 65535.

See Also

Project CorLib Overview

Class Char Overview

IsSurrogateStr

IsHighSurrogate

IsHighSurrogateStr

IsLowSurrogate

IsLowSurrogateStr


Char: IsSurrogateStr

IsSurrogateStr

Indicates whether the character at the specified position in a specified string has a surrogate code unit.

 Public Function IsSurrogateStr(
      ByRef s As String,
      ByVal Index As Long ) As Boolean

Parameters

s
[ByRef] String. A string.
Index
[ByVal] Long. The position of the character to evaluate in s.

Return Values

Boolean - True if c is either a high surrogate or a low surrogate; otherwise, False.

Remarks

The Index parameter is zero-based where as VisualBasic is one-based.

A surrogate is a Char object with a UTF-16 code unit in the range from U+D800 to U+DFFF. The individual surrogate code unit has no interpretation of its own, but has meaning only when used as part of a surrogate pair.

For more information about surrogate pairs, see the Unicode Standard at the OnlineUnicode home page.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Index is not a position within s.

See Also

Project CorLib Overview

Class Char Overview

IsSurrogate

IsHighSurrogate

IsHighSurrogateStr

IsLowSurrogate

IsLowSurrogateStr


Char: IsWhiteSpace

IsWhiteSpace

Indicates if a character is white space.

 Public Function IsWhiteSpace(
      ByVal c As Long ) As Boolean

Parameters

c
[ByVal] Long. An integer to check if is white space.

Return Values

Boolean - True if the character is considered white space; otherwise False.

Remarks

White space characters are the following Unicode characters:

  • Members of the SpaceSeparator category, which includes the characters SPACE (U+0020), NO-BREAK SPACE (U+00A0), OGHAM SPACE MARK (U+1680), EN QUAD (U+2000), EM QUAD (U+2001), EN SPACE (U+2002), EM SPACE (U+2003), THREE-PER-EM SPACE (U+2004), FOUR-PER-EM SPACE (U+2005), SIX-PER-EM SPACE (U+2006), FIGURE SPACE (U+2007), PUNCTUATION SPACE (U+2008), THIN SPACE (U+2009), HAIR SPACE (U+200A), NARROW NO-BREAK SPACE (U+202F), MEDIUM MATHEMATICAL SPACE (U+205F), and IDEOGRAPHIC SPACE (U+3000).
  • Members of the LineSeparator category, which consists solely of the LINE SEPARATOR character (U+2028).
  • Members of the ParagraphSeparator category, which consists solely of the PARAGRAPH SEPARATOR character (U+2029).
  • The characters CHARACTER TABULATION (U+0009), LINE FEED (U+000A), LINE TABULATION (U+000B), FORM FEED (U+000C), CARRIAGE RETURN (U+000D), and NEXT LINE (U+0085).

This method handles the discrepancy between integers and longs particularly when dealing with negative integer values that should map to positive long values.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | c is outside of the valid range -32768 to 65535.

See Also

Project CorLib Overview

Class Char Overview

IsWhiteSpaceStr


Char: IsWhiteSpaceStr

IsWhiteSpaceStr

Indicates if the specified character in a string is white space.

 Public Function IsWhiteSpaceStr(
      ByRef s As String,
      ByVal Index As Long ) As Boolean

Parameters

s
[ByRef] String. A string.
Index
[ByVal] Long. The position of the character to evaluate in s.

Return Values

Boolean - true if the character is considered white space; otherwise false.

Remarks

The Index parameter is zero-based where as VisualBasic is one-based.

White space characters are the following Unicode characters:

  • Members of the SpaceSeparator category, which includes the characters SPACE (U+0020), NO-BREAK SPACE (U+00A0), OGHAM SPACE MARK (U+1680), EN QUAD (U+2000), EM QUAD (U+2001), EN SPACE (U+2002), EM SPACE (U+2003), THREE-PER-EM SPACE (U+2004), FOUR-PER-EM SPACE (U+2005), SIX-PER-EM SPACE (U+2006), FIGURE SPACE (U+2007), PUNCTUATION SPACE (U+2008), THIN SPACE (U+2009), HAIR SPACE (U+200A), NARROW NO-BREAK SPACE (U+202F), MEDIUM MATHEMATICAL SPACE (U+205F), and IDEOGRAPHIC SPACE (U+3000).
  • Members of the LineSeparator category, which consists solely of the LINE SEPARATOR character (U+2028).
  • Members of the ParagraphSeparator category, which consists solely of the PARAGRAPH SEPARATOR character (U+2029).
  • The characters CHARACTER TABULATION (U+0009), LINE FEED (U+000A), LINE TABULATION (U+000B), FORM FEED (U+000C), CARRIAGE RETURN (U+000D), and NEXT LINE (U+0085).

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Index is less than zero or greater than or equal to the length of s.

See Also

Project CorLib Overview

Class Char Overview

IsWhiteSpace


Char: MaxValue (get)

MaxValue

Represents the largest possible value of a Char.

 Public Property Get MaxValue ( ) As Integer

Return Values

Integer - The constant value -1 (&HFFFF)

Remarks

A character is represented as a Unicode code point as a UTF-16 code unit from U+0000 to U+FFFF. Because Visual Basic does not contain an unsigned 16-bit integer type, VBCorLib utilizes the Integer type. The two types have the same binary representation, but have different numeric ranges. This leads to some difficulties when needing to compare characters for sort order.

The maximum character value would normally be U+FFFF(65535), however, when using the Integer type, the maximum character value becomes U+FFFF(-1). Even though they are the same with their binary representation, they cannot be directly compared for sort order.

If characters with the high bit set need to be compared then use the Char.Equals and Char.Compare methods to ensure correct results.

Read Only.

See Also

Project CorLib Overview

Class Char Overview

Equals

Compare

ConvertToInt32

ConvertFromInt32


Char: MinValue (get)

MinValue

Represents the smallest possible value of a Char.

 Public Property Get MinValue ( ) As Integer

Return Values

Integer - The constant value zero (&H0000).

Remarks

A character is represented as a Unicode code point as a UTF-16 code unit from U+0000 to U+FFFF.

Read Only.

See Also

Project CorLib Overview

Class Char Overview

Equals

Compare

ConvertToInt32

ConvertFromInt32


CharEnumerator

CharEnumerator

Used to enumerate the characters in a string from start to end.

Implements:

ICloneable
IEnumerator
IObject

Public:

Properties:

Name | Description
Current (get) | This returns the current item of the enumeration. The current item is called after a successful MoveNext.

Methods:

Name | Description
Clone | Returns a clone of this instance of the enumerator.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
MoveNext | Requests the enumerator moves to the next item being enumerated. Returns True on success, False otherwise. This is called prior to Current. If this is successful, Current will be called.
Reset | Requests the enumerator resets itself to begin enumerating from the beginning.
ToString | Returns a string representation of this object instance.

Remarks

Each character in the string is treated as an Integer value. This equates to using AscW for each character. There is no Unicode conversion using a Code Page.

The return value is a 16-bit signed Integer. This means that characters above &H7fff (32767) with be negative. To change this to the corrisponding positive value, add &H10000 (65536) to the value.

Examples

 Dim n As Variant
 Dim s As String

 s = "Hello"

 ' Iterate over a String using For..Each
 For Each n In NewCharEnumerator(s)
     Debug.Print n
 Next n
 ' output
 ' 72
 ' 101
 ' 108
 ' 108
 ' 111

 ' Iterate over a String manually
 Dim e As CharEnumerator
 Set e = NewCharEnumerator(s)

 Do While e.MoveNext
     Debug.Print e.Current
 Loop
 ' output
 ' 72
 ' 101
 ' 108
 ' 108
 ' 111

See Also

Project CorLib Overview

Class CharEnumerator Overview

Constructors

IEnumerator


CharEnumerator: Clone

Clone

Returns a clone of this instance of the enumerator.

 Public Function Clone ( ) As CharEnumerator

Return Values

CharEnumerator - A clone of the CharEnumerator.

Remarks

The cloned enumerator will begin enumerating at the location the original enumerator was at when the clone was created.

The original string will always be copied when a clone is created.

See Also

Project CorLib Overview

Class CharEnumerator Overview


CharEnumerator: Current (get)

Current

This returns the current item of the enumeration. The current item is called after a successful MoveNext.

 Public Property Get Current ( ) As Integer

Return Values

Integer - Returns the raw Unicode value for the current character in the string.

Remarks

The return value is a 16-bit signed Integer. This means that characters above &H7fff (32767) with be negative. To change this to the corrisponding positive value, add &H10000 (65536) to the value.

Read Only.

See Also

Project CorLib Overview

Class CharEnumerator Overview


CharEnumerator: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class CharEnumerator Overview


CharEnumerator: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class CharEnumerator Overview


CharEnumerator: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class CharEnumerator Overview


CharEnumerator: IEnumerator

IEnumerator

 Implements IEnumerator

Return Values

IEnumerator -

See Also

Project CorLib Overview

Class CharEnumerator Overview


CharEnumerator: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class CharEnumerator Overview


CharEnumerator: MoveNext

MoveNext

Requests the enumerator moves to the next item being enumerated. Returns True on success, False otherwise. This is called prior to Current. If this is successful, Current will be called.

 Public Function MoveNext ( ) As Boolean

Return Values

Boolean - Indication if the move was successful.

See Also

Project CorLib Overview

Class CharEnumerator Overview


CharEnumerator: Reset

Reset

Requests the enumerator resets itself to begin enumerating from the beginning.

 Public Sub Reset ( )

See Also

Project CorLib Overview

Class CharEnumerator Overview


CharEnumerator: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class CharEnumerator Overview


Comparer

Comparer

Compares two values for equivalence, where string comparisons are case-sensitive.

Implements:

IComparer
IObject

Public:

Methods:

Name | Description
Compare | Performs a case-sensitive comparison of two values of the same type and returns a value indicating whether one is less than, equal to, or greater than the other.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
ToString | Returns a string representation of this object instance.

Remarks

This class is the default implementation of the IComparer interface. The CaseInsensitiveComparer class is the implementation of the IComparer interface that performs case-insensitive string comparisons.

Comparison procedures use the Thread.CurrentCulture of the current thread unless otherwise specified. String comparisons might have different results depending on the culture.

Examples

The following code example shows how Compare returns different values depending on the culture associated with the Comparer.

Public Sub Main()
    Const Str1 As String = "Apple"
    Const Str2 As String = "Æble"

    Debug.Print CorString.Format("Comparing ""{0}"" and ""{1}"" ...", Str1, Str2)

    Debug.Print CorString.Format("          Invariant Comparer: {0}", Comparer.DefaultInvariant.Compare(Str1, Str2))

    Dim CompUS As Comparer
    Set CompUS = NewComparer(NewCultureInfo("en-US", False))
    Debug.Print CorString.Format("English (United States) Sort: {0}", CompUS.Compare(Str1, Str2))

    Dim CompDK As Comparer
    Set CompDK = NewComparer(NewCultureInfo("da-DK", False))
    Debug.Print CorString.Format("        dansk (Danmark) Sort: {0}", CompDK.Compare(Str1, Str2))

End Sub

' This code produces the following output.
'
'    Comparing "Apple" and "Æble" ...
'              Invariant Comparer: 1
'    English (United States) Sort: 1
'            dansk (Danmark) Sort: -1

See Also

Project CorLib Overview

Class Comparer Overview

ComparerStatic

Constructors

IComparer

IComparable

CaseInsensitiveComparer

ThreadStatic


Comparer: Compare

Compare

Performs a case-sensitive comparison of two values of the same type and returns a value indicating whether one is less than, equal to, or greater than the other.

 Public Function Compare(
      ByRef a As Variant,
      ByRef b As Variant ) As Long

Parameters

a
[ByRef] Variant. The left-hand-side of the equation.
b
[ByRef] Variant. the right-hand-side of the equation.

Return Values

Long - A signed integer that indicates the relative values of a and b, as shown in the following table.
Value | Meaning
Less than zero | a is less than b.
Zero | a equals b.
Greater than zero | a is greater than b.

Remarks

If a implements IComparable, then a.CompareTo(b) is returned; otherwise, if b implements IComparable, then the negated result of b.CompareTo(a) is returned.

String comparisons might have different results depending on the culture.

Exceptions

Exception | Condition
ArgumentException | Neither a nor b implements the IComparable interface. -or- a and b are of different types and cannot be compared.

Examples

The following code example shows how Compare returns different values depending on the culture associated with the Comparer.

Public Sub Main()
    Const Str1 As String = "Apple"
    Const Str2 As String = "Æble"

    Debug.Print CorString.Format("Comparing ""{0}"" and ""{1}"" ...", Str1, Str2)

    Debug.Print CorString.Format("          Invariant Comparer: {0}", Comparer.DefaultInvariant.Compare(Str1, Str2))

    Dim CompUS As Comparer
    Set CompUS = NewComparer(NewCultureInfo("en-US", False))
    Debug.Print CorString.Format("English (United States) Sort: {0}", CompUS.Compare(Str1, Str2))

    Dim CompDK As Comparer
    Set CompDK = NewComparer(NewCultureInfo("da-DK", False))
    Debug.Print CorString.Format("        dansk (Danmark) Sort: {0}", CompDK.Compare(Str1, Str2))

End Sub

' This code produces the following output.
'
'    Comparing "Apple" and "Æble" ...
'              Invariant Comparer: 1
'    English (United States) Sort: 1
'            dansk (Danmark) Sort: -1

See Also

Project CorLib Overview

Class Comparer Overview

IComparable

CultureInfo


Comparer: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class Comparer Overview


Comparer: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class Comparer Overview


Comparer: IComparer

IComparer

 Implements IComparer

Return Values

IComparer -

See Also

Project CorLib Overview

Class Comparer Overview


Comparer: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class Comparer Overview


Comparer: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class Comparer Overview


ComparerStatic

ComparerStatic

Provides static functions to access the default comparer.

Public:

Properties:

Name | Description
Default (get) | Gets an instance of Comparer that is associated with the Thread.CurrentCulture of the current thread and that is always available.
DefaultInvariant (get) | Represents an instance of Comparer that is associated with CultureInfo.InvariantCulture.

Remarks

To access the default comparer through the ComparerStatic class use the Comparer namespace.

 Set Comparer = Comparer.Default
This will return the default system comparer.

See Also

Project CorLib Overview

Class ComparerStatic Overview

Comparer

Constructors


ComparerStatic: Default (get)

Default

Gets an instance of Comparer that is associated with the Thread.CurrentCulture of the current thread and that is always available.

 Public Property Get Default ( ) As Comparer

Return Values

Comparer - An instance of Comparer that is associated with CultureInfo.InvariantCulture.

Read Only.

See Also

Project CorLib Overview

Class ComparerStatic Overview


ComparerStatic: DefaultInvariant (get)

DefaultInvariant

Represents an instance of Comparer that is associated with CultureInfo.InvariantCulture.

 Public Property Get DefaultInvariant ( ) As Comparer

Return Values

Comparer - An instance of Comparer that is associated with CultureInfo.InvariantCulture.

Read Only.

See Also

Project CorLib Overview

Class ComparerStatic Overview


Console

Console

Provides a mechanism for handling input and output for either a screen or Stream.

Public:

Types:

Name | Description
ConsoleBreakType | A list of break types returned by the console.
ConsoleColor | The set of colors used to foreground and background color settings of the console.

Properties:

Name | Description
BackgroundColor (get) | Returns the current background color.
BackgroundColor (let) | Sets the background color.
Break (get) | Returns if a break has been caused.
Break (let) | Sets the break flag.
BreakType (get) | Returns the cause of the break event in the console
BufferHeight (get) | Returns the current height of the underlying screen buffer in characters.
BufferHeight (let) | Sets the height of the underlying screen buffer in characters.
BufferWidth (get) | Returns the current width of the underlying screen buffer in characters.
BufferWidth (let) | Sets the width of the underlying screen buffer in characters.
CapsLock (get) | Returns the state of the Caps-Lock key.
CursorLeft (get) | Returns the left coordinate of the cursor position.
CursorLeft (let) | Sets the left coordinate of the cursor position.
CursorSize (get) | Returns the size (height) of the cursor.
CursorSize (let) | Sets the size (height) of the cursor.
CursorTop (get) | Returns the top coordinate of the cursor position.
CursorTop (let) | Sets the top coordinate for the cursor position
CursorVisible (get) | Returns whether or not the cursor is currently invisible.
CursorVisible (let) | Sets if the cursor is visible or not.
Error (get) | Returns the Error output currently being used by the Console.
ForegroundColor (get) | Returns the current foreground color.
ForegroundColor (let) | Sets the foreground color.
In_ (get) | Returns the input source currently used by the Console.
InputEncoding (get) | Returns the encoding used for the input from the console.
InputEncoding (set) | Sets the encoding used during input from the console.
KeyAvailable (get) | Returns if a key has been pressed and is available to be read in using one of the read methods.
LargestWindowHeight (get) | Returns the largest height the viewable window could be set to.
LargestWindowWidth (get) | Returns the largest width the viewable window could be set to.
NumLock (get) | Returns the state of the Num-Lock key.
Out (get) | Returns the output writer currently being used by the Console.
OutputEncoding (get) | Returns the encoding for the current console output.
OutputEncoding (set) | Sets the encoding for the console output.
Title (get) | Returns the console title of the current process.
Title (let) | Sets the title for the console of the current process.
TreatControlCAsInput (get) | Returns if the Control+C combination is managed by the system or returned as keyboard input.
TreatControlCAsInput (let) | Sets if the Control+C combination is managed by the system or returned as keyboard input.
WindowHeight (get) | Returns the height of the viewable window in the screen buffer.
WindowHeight (let) | Sets the height of the viewable window in the screen buffer.
WindowLeft (get) | Returns the left coordinate of the console window within the screen buffer in character columns.
WindowLeft (let) | Sets the left coordinate of the console window within the screen buffer in character columns.
WindowTop (get) | Returns the top of the viewable window within the screen buffer.
WindowTop (let) | Sets the top of the viewable windwo within the screen buffer.
WindowWidth (get) | Returns the width of the window in characters.
WindowWidth (let) | Sets the width of the viewable window within the screen buffer.

Methods:

Name | Description
Beep | Produces a beep through the console.
Clear | Clears the console screen and window.
ClearBufferArea | Clears a specificed region in the screen buffer.
FillBufferArea | Fills a specified region in the screen buffer with a character and color attributes.
MoveBufferArea | Moves one section of the screen buffer to another location within the screen buffer.
OpenStandardError | Returns the standard error stream.
OpenStandardInput | Returns the standard input stream.
OpenStandardOutput | Returns the standard output stream.
Read | Reads a character from the current input source.
ReadKey | Reads a single key from the console input.
ReadLine | Reads all of the characters from the current input source until a NewLine break is reached.
ResetColor | Restores the foreground and background colors to their original values.
SetBufferSize | Sets the size of the underlying screen buffer.
SetCursorPosition | Sets the position of the cursor within the screen buffer.
SetError | Sets the Console error output stream to the supplied TextWriter object.
SetIn | Sets the Console input source to a new TextReader object.
SetOut | Sets the Console output to a new output TextWriter object.
SetWindowPosition | Sets the position of the viewing window within the console screen buffer.
SetWindowSize | Sets the size of the viewable window area for the console buffer.
WriteLine | Writes a value to the current output stream.
WriteValue | Writes a string to the Console output stream without a NewLine break.

Remarks

Using the Console class allows input and output to a console window. By default, a VB6 application will create a new console window for the Console class to use. Most times it is desired to run an application in an already open console window. If a VB6 application is run from within an existing console window, a new window will be created again. To have the VB6 application to use the console window from which is it run, the EXE needs to be converted to a console application. This can be accomplished by hand using the Link program that is included with Visual Basic 6. In a console window use the following command:

link /edit /subsystem:console Application Name

Be sure the Link and application are both in paths the console window can find. Once the command has been executed, the VB6 application will run inside the console window from which it was run. If no window existed, then a new one will be created.

The Console can be used to display text on the screen, and retrieve user input from a keyboard. The input and output can be redirected to a new source to allow for reading and writing from a specified Stream.

WARNING: Do not close the console through with Close Window button while working in the IDE. This will cause the IDE to crash and all data will be lost.

 Console.BackgroundColor = Blue
 Console.WriteLine "hello"
 Console.ResetColor

See Also

Project CorLib Overview

Class Console Overview

ConsoleKeyInfo


Console: BackgroundColor (get)

BackgroundColor

Returns the current background color.

 Public Property Get BackgroundColor ( ) As ConsoleColor

Return Values

ConsoleColor - The current background color for text.

Remarks

The background color is painted individually for each text characters displayed. This is not the same as the entire window background color.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: BackgroundColor (let)

BackgroundColor

Sets the background color.

 Public Property Let BackgroundColor(
      ByVal Value As ConsoleColor )

Parameters

Value
[ByVal] ConsoleColor. The new background color.

Remarks

The new background color will only affect text displayed after the changing of the background color.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: Beep

Beep

Produces a beep through the console.

 Public Sub Beep(
      Optional ByVal Frequency As Long = 800,
      Optional ByVal Duration As Long = 200 )

Parameters

Frequency
[ByVal] Optional. Long. The frequency the beep will play at (default 800hz).

Default: 800

Duration
[ByVal] Optional. Long. The milliseconds the beep should play for (default 200ms).

Default: 200

See Also

Project CorLib Overview

Class Console Overview


Console: Break (get)

Break

Returns if a break has been caused.

 Public Property Get Break ( ) As Boolean

Return Values

Boolean - If a break has been caused in the console.

Remarks

This property will be set to true when one of several actions occurs. The actions are defined by the enumeration ConsoleBreakType. No DoEvents need to be called for this property to be set. Simply check this property when necessary to respond to any of the events.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: Break (let)

Break

Sets the break flag.

 Public Property Let Break(
      ByVal Value As Boolean )

Parameters

Value
[ByVal] Boolean. The break flag value.

Remarks

Set Break to false once it has been handled so the next console break can set it to true and be detected.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: BreakType (get)

BreakType

Returns the cause of the break event in the console

 Public Property Get BreakType ( ) As ConsoleBreakType

Return Values

ConsoleBreakType - The type of break that caused the interuption.

Read Only.

See Also

Project CorLib Overview

Class Console Overview


Console: BufferHeight (get)

BufferHeight

Returns the current height of the underlying screen buffer in characters.

 Public Property Get BufferHeight ( ) As Long

Return Values

Long - The height of the screen buffer.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: BufferHeight (let)

BufferHeight

Sets the height of the underlying screen buffer in characters.

 Public Property Let BufferHeight(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new height of the screen buffer.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: BufferWidth (get)

BufferWidth

Returns the current width of the underlying screen buffer in characters.

 Public Property Get BufferWidth ( ) As Long

Return Values

Long - The width of the screen buffer.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: BufferWidth (let)

BufferWidth

Sets the width of the underlying screen buffer in characters.

 Public Property Let BufferWidth(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new width of the screen buffer.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: CapsLock (get)

CapsLock

Returns the state of the Caps-Lock key.

 Public Property Get CapsLock ( ) As Boolean

Return Values

Boolean - CapsLock On = True, otherwise False.

Remarks

The CapsLock key is a toggle key, so this property returns the current state, not if it is currently being pressed or not, only if it is on or off.

Read Only.

See Also

Project CorLib Overview

Class Console Overview


Console: Clear

Clear

Clears the console screen and window.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class Console Overview


Console: ClearBufferArea

ClearBufferArea

Clears a specificed region in the screen buffer.

 Public Sub ClearBufferArea(
      ByVal Left As Long,
      ByVal Top As Long,
      ByVal Width As Long,
      ByVal Height As Long,
      Optional ByVal Forecolor As ConsoleColor = ConsoleColor. CurrentColor,
      Optional ByVal BackColor As ConsoleColor = ConsoleColor. CurrentColor )

Parameters

Left
[ByVal] Long. The left position in the screen buffer to start clearing from.
Top
[ByVal] Long. The top position in the screen buffer to start clearing from.
Width
[ByVal] Long. The width of the area to be cleared.
Height
[ByVal] Long. The height of the area to be cleared.
Forecolor
[ByVal] Optional. ConsoleColor. The color to set the text foreground color to in the cleared area.

Default: ConsoleColor . CurrentColor

BackColor
[ByVal] Optional. ConsoleColor. The color to set the text background color to in the cleared area.

Default: ConsoleColor . CurrentColor

See Also

Project CorLib Overview

Class Console Overview


Console: ConsoleBreakType

ConsoleBreakType

A list of break types returned by the console.

 Public Enum ConsoleBreakType

Values

ControlC = 0
The CTRL+C key combination was pressed.
ControlBreak = 1
The CTRL+Break key combination was pressed.
CloseWindow = 2
The window is being closed.
LogOffUser = 5
The user is logging off the system.
ShutDownSystem = 6
The system is being shut down.

See Also

Project CorLib Overview

Class Console Overview


Console: ConsoleColor

ConsoleColor

The set of colors used to foreground and background color settings of the console.

 Public Enum ConsoleColor

Values

CurrentColor = - 1
Used to indicate to use the current color settings.
Black = 0
DarkBlue = 1
DarkGreen = 2
DarkCyan = 3
DarkRed = 4
DarkMagenta = 5
DarkYellow = 6
Gray = 7
DarkGray = 8
Blue = 9
Green = 10
Cyan = 11
Red = 12
Magenta = 13
Yellow = 14
White = 15

See Also

Project CorLib Overview

Class Console Overview


Console: CursorLeft (get)

CursorLeft

Returns the left coordinate of the cursor position.

 Public Property Get CursorLeft ( ) As Long

Return Values

Long - The left coordinate.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: CursorLeft (let)

CursorLeft

Sets the left coordinate of the cursor position.

 Public Property Let CursorLeft(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new left coordinate.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: CursorSize (get)

CursorSize

Returns the size (height) of the cursor.

 Public Property Get CursorSize ( ) As Long

Return Values

Long - The size of the cursor.

Remarks

the size of the cursor is a value 1 to 100, 1 being 1% the full block, and 100 beign 100% a full block.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: CursorSize (let)

CursorSize

Sets the size (height) of the cursor.

 Public Property Let CursorSize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new cursor size.

Remarks

the size of the cursor is a value 1 to 100, 1 being 1% the full block, and 100 being 100% a full block.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: CursorTop (get)

CursorTop

Returns the top coordinate of the cursor position.

 Public Property Get CursorTop ( ) As Long

Return Values

Long - The top coordinate.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: CursorTop (let)

CursorTop

Sets the top coordinate for the cursor position

 Public Property Let CursorTop(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The top coordinate.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: CursorVisible (get)

CursorVisible

Returns whether or not the cursor is currently invisible.

 Public Property Get CursorVisible ( ) As Boolean

Return Values

Boolean - The visibility of the cursor.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: CursorVisible (let)

CursorVisible

Sets if the cursor is visible or not.

 Public Property Let CursorVisible(
      ByVal Value As Boolean )

Parameters

Value
[ByVal] Boolean. The visibility of the cursor.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: Error (get)

Error

Returns the Error output currently being used by the Console.

 Public Property Get Error ( ) As TextWriter

Return Values

TextWriter - An object that implements the TextWriter interface.

Remarks

The default Error writer writes to the Console error output.

Read Only.

See Also

Project CorLib Overview

Class Console Overview


Console: FillBufferArea

FillBufferArea

Fills a specified region in the screen buffer with a character and color attributes.

 Public Sub FillBufferArea(
      ByVal Left As Long,
      ByVal Top As Long,
      ByVal Width As Long,
      ByVal Height As Long,
      Optional ByVal FillChar As Variant = " ",
      Optional ByVal Forecolor As ConsoleColor = ConsoleColor. CurrentColor,
      Optional ByVal BackColor As ConsoleColor = ConsoleColor. CurrentColor )

Parameters

Left
[ByVal] Long. The left position in the screen buffer to start filling from.
Top
[ByVal] Long. The top position in the screen buffer to start filling from.
Width
[ByVal] Long. The width of the area to be filled.
Height
[ByVal] Long. The height of the area to be filled.
FillChar
[ByVal] Optional. Variant. The character to fill the area with.

Default: " "

Forecolor
[ByVal] Optional. ConsoleColor. The color of the fill character.

Default: ConsoleColor . CurrentColor

BackColor
[ByVal] Optional. ConsoleColor. The color of the background behind the fill character.

Default: ConsoleColor . CurrentColor

See Also

Project CorLib Overview

Class Console Overview


Console: ForegroundColor (get)

ForegroundColor

Returns the current foreground color.

 Public Property Get ForegroundColor ( ) As ConsoleColor

Return Values

ConsoleColor - The current foreground color for text.

Remarks

The foreground color is painted individually for each text characters displayed.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: ForegroundColor (let)

ForegroundColor

Sets the foreground color.

 Public Property Let ForegroundColor(
      ByVal Value As ConsoleColor )

Parameters

Value
[ByVal] ConsoleColor. The new foreground color.

Remarks

The new foreground color will only affect text that is displayed after the color has been changed.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: In_ (get)

In_

Returns the input source currently used by the Console.

 Public Property Get In_ ( ) As TextReader

Return Values

TextReader - Returns an object that implements the TextReader interface

Remarks

The default source of the input is the Keyboard. This can be changed by using the SetIn function.

Read Only.

See Also

Project CorLib Overview

Class Console Overview


Console: InputEncoding (get)

InputEncoding

Returns the encoding used for the input from the console.

 Public Property Get InputEncoding ( ) As Encoding

Return Values

Encoding - An encoding for the input from the console.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: InputEncoding (set)

InputEncoding

Sets the encoding used during input from the console.

 Public Property Set InputEncoding(
      ByVal Value As Encoding )

Parameters

Value
[ByVal] Encoding. The new encoding used for input from the console.

Remarks

This is only supported on Windows NT machines.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: KeyAvailable (get)

KeyAvailable

Returns if a key has been pressed and is available to be read in using one of the read methods.

 Public Property Get KeyAvailable ( ) As Boolean

Return Values

Boolean - Returns if a key is ready to be read in.

Read Only.

See Also

Project CorLib Overview

Class Console Overview


Console: LargestWindowHeight (get)

LargestWindowHeight

Returns the largest height the viewable window could be set to.

 Public Property Get LargestWindowHeight ( ) As Long

Return Values

Long - The largest possible window height.

Read Only.

See Also

Project CorLib Overview

Class Console Overview


Console: LargestWindowWidth (get)

LargestWindowWidth

Returns the largest width the viewable window could be set to.

 Public Property Get LargestWindowWidth ( ) As Long

Return Values

Long - The largest possible window width.

Read Only.

See Also

Project CorLib Overview

Class Console Overview


Console: MoveBufferArea

MoveBufferArea

Moves one section of the screen buffer to another location within the screen buffer.

 Public Sub MoveBufferArea(
      ByVal SourceLeft As Long,
      ByVal SourceTop As Long,
      ByVal SourceWidth As Long,
      ByVal SourceHeight As Long,
      ByVal TargetLeft As Long,
      ByVal TargetTop As Long,
      Optional ByVal SourceChar As Variant = " ",
      Optional ByVal SourceForeColor As ConsoleColor = ConsoleColor. Black,
      Optional ByVal SourceBackColor As ConsoleColor = CurrentColor )

Parameters

SourceLeft
[ByVal] Long. The left side of the area to be moved.
SourceTop
[ByVal] Long. The top side of the area to be moved.
SourceWidth
[ByVal] Long. The width of the area to be moved.
SourceHeight
[ByVal] Long. The height of the area to be moved.
TargetLeft
[ByVal] Long. The starting left position to move the area to.
TargetTop
[ByVal] Long. The starting top position to move the area to.
SourceChar
[ByVal] Optional. Variant. The character to fill the moved area in with. This can be a String or Ascii value.

Default: " "

SourceForeColor
[ByVal] Optional. ConsoleColor. The forecolor used when filling in the original moved area.

Default: ConsoleColor . Black

SourceBackColor
[ByVal] Optional. ConsoleColor. The backcolor used when filling in the original moved area.

Default: CurrentColor

See Also

Project CorLib Overview

Class Console Overview


Console: NumLock (get)

NumLock

Returns the state of the Num-Lock key.

 Public Property Get NumLock ( ) As Boolean

Return Values

Boolean - NumLock On = True, otherwise False.

Remarks

The NumLock key is a toggle key, so this property returns the current state, not if it is currently being pressed or not, only if it is on or off.

Read Only.

See Also

Project CorLib Overview

Class Console Overview


Console: OpenStandardError

OpenStandardError

Returns the standard error stream.

 Public Function OpenStandardError ( ) As Stream

Return Values

Stream - The standard error output stream that error data is written to.

Remarks

The standard error output is to the screen console.

See Also

Project CorLib Overview

Class Console Overview


Console: OpenStandardInput

OpenStandardInput

Returns the standard input stream.

 Public Function OpenStandardInput ( ) As Stream

Return Values

Stream - The standard input stream object to retrieve user input from.

Remarks

The standard input is from the keyboard console.

See Also

Project CorLib Overview

Class Console Overview


Console: OpenStandardOutput

OpenStandardOutput

Returns the standard output stream.

 Public Function OpenStandardOutput ( ) As Stream

Return Values

Stream - The standard output stream to write user data to.

Remarks

The standard output is the screen console.

See Also

Project CorLib Overview

Class Console Overview


Console: Out (get)

Out

Returns the output writer currently being used by the Console.

 Public Property Get Out ( ) As TextWriter

Return Values

TextWriter - Returns an object that implements the TextWriter interface.

Remarks

The default output for the Console is to a Console window displayed on the screen. The output can be redirected to a new Stream using SetOut.

Read Only.

See Also

Project CorLib Overview

Class Console Overview


Console: OutputEncoding (get)

OutputEncoding

Returns the encoding for the current console output.

 Public Property Get OutputEncoding ( ) As Encoding

Return Values

Encoding - An Encoding object for the current console output encoding.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: OutputEncoding (set)

OutputEncoding

Sets the encoding for the console output.

 Public Property Set OutputEncoding(
      ByVal Value As Encoding )

Parameters

Value
[ByVal] Encoding. The new encoding used for output to the console.

Remarks

This is only supported on Windows NT machines.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: Read

Read

Reads a character from the current input source.

 Public Function Read ( ) As Long

Return Values

Long - The next character read from the input source, or -1 if no more characters exists.

Remarks

The Read method does not return until the Return key is pressed. Once the function returns, it can be called repeatedly until all key presses upto the return key are retrieved. The return key is also returned as a carriage-return (13) followed by a line-feed (10).

Examples

This example shows how to read input from the console keyboard. The Read function will block and wait for the return key to be pressed before returning. If there are characters already in the input stream, the function does not block and returns the next character.

Private Sub Main()
    Dim ch As Long

    ' reads from the console keyboard. The function
    ' will block until the return key is pressed.
    ch = Console.Read

    ' we will loop through the characters typed into
    ' the console and exit the loop when CTRL+Z followed
    ' by Return is pressed.
    Do While ch &lt&gt 26
        Debug.Print Chr$(ch);
        DoEvents

        ' As long as there are characters remaining to be
        ' from the console keyboard, this function won't block.
        ch = Console.Read
    Loop
End Sub
As shown here, the loop just retrieves characters from the console keyboard one character at a time. If there are no more characters in the buffer, then the Read function will block and wait for the Return key to be pressed again. The key combination of CTRL+Z (26) is used as an exit from the loop. CRTL+Z is what is used to signal the end of a file on unix platforms.

See Also

Project CorLib Overview

Class Console Overview


Console: ReadKey

ReadKey

Reads a single key from the console input.

 Public Function ReadKey(
      Optional ByVal Intercept As Boolean = False ) As ConsoleKeyInfo

Parameters

Intercept
[ByVal] Optional. Boolean. Flags whether the pressed key should be displayed through the console output or not.

Default: False

Return Values

ConsoleKeyInfo - A ConsoleKeyInfo object containing information about the the key that was pressed and modifier key states.

Remarks

This method blocks the calling thread until a key is pressed.

Not all keys are read and returned. Modifier keys (Alt, Shift, Control) are not returned, but instead, included in the ConsoleKeyInfo object when a normal key is pressed. This allows the status of the modifier keys to be known during a keypress, such as a Shift-A key combination.

Keys that do not trigger this method to return are ALT, SHIFT, CONTROL, CAPS-LOCK, SCROLL-LOCK, and NUM-LOCK.

See Also

Project CorLib Overview

Class Console Overview


Console: ReadLine

ReadLine

Reads all of the characters from the current input source until a NewLine break is reached.

 Public Function ReadLine ( ) As String

Return Values

String - Returns all of the available characters upto a NewLine break, not including the NewLine characters.

Remarks

The ReadLine function will block and not return until a NewLine characters is pressed. This is usually the Return key.

Examples

This examples shows how to continually read a line of characters from the Console keyboard. The function will block and wait for a NewLine (Return Key) is reached. All characters are returned not including the the NewLine characters.

    Dim s As String

    ' Reads all of the characters upto a NewLine break.
    ' If there are no characters (including NewLine) in the
    ' buffer, then the function will block and wait.
    s = Console.ReadLine

    ' Exit the loop if an empty line is returned.
    Do While Len(s) > 0
        Debug.Print s
        DoEvents

        ' Continue reading an entire line at once. If no
        ' characters are available, then the function will
        ' block until the return key is pressed.
        s = Console.ReadLine
    Loop
As shown here, the loop continually reads in an entire line of characters until an empty line is returned. The function blocks when no characters remain to be read in from the console input. The NewLine characters are not returned with the line.

See Also

Project CorLib Overview

Class Console Overview


Console: ResetColor

ResetColor

Restores the foreground and background colors to their original values.

 Public Sub ResetColor ( )

Remarks

The backcolor will be set to ConsoleColor.Black, the forecolor will be set to ConsoleColor.Gray.

See Also

Project CorLib Overview

Class Console Overview


Console: SetBufferSize

SetBufferSize

Sets the size of the underlying screen buffer.

 Public Sub SetBufferSize(
      ByVal Width As Long,
      ByVal Height As Long )

Parameters

Width
[ByVal] Long. The width in characters of the buffer.
Height
[ByVal] Long. The height in characters of the buffer.

See Also

Project CorLib Overview

Class Console Overview


Console: SetCursorPosition

SetCursorPosition

Sets the position of the cursor within the screen buffer.

 Public Sub SetCursorPosition(
      ByVal Left As Long,
      ByVal Top As Long )

Parameters

Left
[ByVal] Long. The number of characters from the left of the screen buffer.
Top
[ByVal] Long. The number of characters from the top of the screen buffer.

Remarks

The positions start at 0,0 and go to BufferWidth - 1, BufferHeight - 1.

See Also

Project CorLib Overview

Class Console Overview


Console: SetError

SetError

Sets the Console error output stream to the supplied TextWriter object.

 Public Sub SetError(
      ByVal NewError As TextWriter )

Parameters

NewError
[ByVal] TextWriter. The TextWriter object the console error data is written to.

See Also

Project CorLib Overview

Class Console Overview


Console: SetIn

SetIn

Sets the Console input source to a new TextReader object.

 Public Sub SetIn(
      ByVal NewIn As TextReader )

Parameters

NewIn
[ByVal] TextReader. The TextReader object the console retrieves input from.

See Also

Project CorLib Overview

Class Console Overview


Console: SetOut

SetOut

Sets the Console output to a new output TextWriter object.

 Public Sub SetOut(
      ByVal NewOut As TextWriter )

Parameters

NewOut
[ByVal] TextWriter. The TextWriter object that console output will be written to.

See Also

Project CorLib Overview

Class Console Overview


Console: SetWindowPosition

SetWindowPosition

Sets the position of the viewing window within the console screen buffer.

 Public Sub SetWindowPosition(
      ByVal Left As Long,
      ByVal Top As Long )

Parameters

Left
[ByVal] Long. The left position in characters.
Top
[ByVal] Long. The top position in characters.

Remarks

The underlying screen buffer is not expanded to accomodate moving the window outside of the screen buffer.

See Also

Project CorLib Overview

Class Console Overview


Console: SetWindowSize

SetWindowSize

Sets the size of the viewable window area for the console buffer.

 Public Sub SetWindowSize(
      ByVal Width As Long,
      ByVal Height As Long )

Parameters

Width
[ByVal] Long. The width in characters.
Height
[ByVal] Long. The height in characters.

Remarks

The screen buffer is the virtual screen that is written to. The size of the buffer can be larger than the window inwhich it is being viewed through. The windows size can be changed to show a different size of the underlying screen buffer without altering the size of that buffer.

See Also

Project CorLib Overview

Class Console Overview


Console: Title (get)

Title

Returns the console title of the current process.

 Public Property Get Title ( ) As String

Return Values

String - The console title.

Remarks

This method support Unicode characters on NT platforms.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: Title (let)

Title

Sets the title for the console of the current process.

 Public Property Let Title(
      ByVal Value As String )

Parameters

Value
[ByVal] String. The title to set the console to.

Remarks

This method supports Unicode characters on NT platforms.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: TreatControlCAsInput (get)

TreatControlCAsInput

Returns if the Control+C combination is managed by the system or returned as keyboard input.

 Public Property Get TreatControlCAsInput ( ) As Boolean

Return Values

Boolean - The state of management for Control+C.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: TreatControlCAsInput (let)

TreatControlCAsInput

Sets if the Control+C combination is managed by the system or returned as keyboard input.

 Public Property Let TreatControlCAsInput(
      ByVal Value As Boolean )

Parameters

Value
[ByVal] Boolean. Flag indicating if the system should manage Control+C or not.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: WindowHeight (get)

WindowHeight

Returns the height of the viewable window in the screen buffer.

 Public Property Get WindowHeight ( ) As Long

Return Values

Long - The height of the window in characters.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: WindowHeight (let)

WindowHeight

Sets the height of the viewable window in the screen buffer.

 Public Property Let WindowHeight(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new window height in characters.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: WindowLeft (get)

WindowLeft

Returns the left coordinate of the console window within the screen buffer in character columns.

 Public Property Get WindowLeft ( ) As Long

Return Values

Long - The console window left coordinate in character columns.

Remarks

The underlying screen buffer can be larger than the console window itself. In order to see other portions of the screen buffer, the window must scroll around the buffer. If the screen buffer is wider than the window itself, then the window must be scrolled horizontally to view the screen buffer.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: WindowLeft (let)

WindowLeft

Sets the left coordinate of the console window within the screen buffer in character columns.

 Public Property Let WindowLeft(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new left position.

Remarks

The view window maitains the original size.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: WindowTop (get)

WindowTop

Returns the top of the viewable window within the screen buffer.

 Public Property Get WindowTop ( ) As Long

Return Values

Long - The top coordinate of the window.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: WindowTop (let)

WindowTop

Sets the top of the viewable windwo within the screen buffer.

 Public Property Let WindowTop(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new top position in characters, starting with 0.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: WindowWidth (get)

WindowWidth

Returns the width of the window in characters.

 Public Property Get WindowWidth ( ) As Long

Return Values

Long - The width of the viewable window.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: WindowWidth (let)

WindowWidth

Sets the width of the viewable window within the screen buffer.

 Public Property Let WindowWidth(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new width of the window in characters.

Read/Write.

See Also

Project CorLib Overview

Class Console Overview


Console: WriteLine

WriteLine

Writes a value to the current output stream.

 Public Sub WriteLine(
      ParamArray Values ( ) As Variant )

Parameters

Values
[ByRef] Variant. A set of zero or more parameters used to create a formatted string output.

Remarks

The first parameter is the string that will be written to the current output stream. All additional parameters will be used as formatting information in the first parameter. If no parameters are provided, then an empty string is written with a NewLine.

Examples

The following example demonstrates how to write output to the console using the WriteLine method. There are 3 ways to use the WriteLine method effectively, and they are shown below.

Private Sub Main()
    ' writes a NewLine to the console
    Console.WriteLine

    ' writes a string followed by a NewLine
    Console.WriteLine "Hello"

    ' writes a formatted string using the
    ' supplied parameters, followed by a NewLine
    Console.WriteLine "Hello, {0}", "Kelly"

    Console.WriteLine "Press Return"
    Console.ReadLine    ' waits for return key to continue
End Sub

' This example produces the following output.
' (Blank Line)
' Hello
' Hello, Kelly
' Press Return
As you can see, the WriteLine method accepts a variaty of parameters to create differently formatted outputs to the Console. The first parameter is the string to be written to the console, while any additional parameters are used by formatting information within the first parameter.

See Also

Project CorLib Overview

Class Console Overview


Console: WriteValue

WriteValue

Writes a string to the Console output stream without a NewLine break.

 Public Sub WriteValue(
      ByRef Value As Variant,
      ParamArray Args ( ) As Variant )

Parameters

Value
[ByRef] Variant. The value to write the string version of to the output stream.
Args
[ByRef] Variant. Values to be used in a formatted output.

Remarks

Values are converted to their string representation for text output. A formatted output can be created similar to cString.Format.

Examples

In this example, the WriteValue function is used to display a sequence of values. The values are all written to the same line because WriteValue does not include a NewLine character after writing a value. A NewLine character has to be manually added to advance to the next line.

Private Sub Main()
    Dim i As Long

    ' Writes out a sequence of digits. The digits are written on the same line.
    Console.WriteValue "Loop 1: "
    For i = 1 To 5
        Console.WriteValue i
    Next i

    ' Writes out a new line manually.
    Console.WriteValue vbCrLf

    ' Writes formatted values on the same line.
    Console.WriteValue "Loop 2: "
    For i = 1 To 5
        Console.WriteValue "i = {0}" & IIf(i < 5, ", ", ""), i
    Next i
End Sub

' This example produces the following output.
' Loop 1: 12345
' Loop 2: i = 1, i = 2, i = 3, i = 4, i = 5
As shown, the first loop writes 5 digits to the console, each digit following the previous digit on the same line. WriteValue does not include line-breaks. A manual line-break is written to achieve the effect of advancing to the next line. The second loop uses a formatted value output. The argument is substituted in the formatted value and then written to the output onto the same single line. A comma is added to distinguish each iteration though the loop.

See Also

Project CorLib Overview

Class Console Overview


ConsoleKeyInfo

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.

Implements:

IObject

Public:

Types:

Name | Description
ConsoleKey | A list of all the scankey codes.
ConsoleModifiers | Values that represent the specific modifier keys used to indicate different values for specific keys.

Properties:

Name | Description
Key (get) | Returns the scankey code of the pressed key.
KeyChar (get) | Returns the Unicode character of the pressed key.
Modifiers (get) | Returns the state of the key modifiers (Shift, Alt, Control) at the time of the key press.

Methods:

Name | Description
Equals | Gets a value indicating whether the specified ConsoleKeyInfo object is equal to the current ConsoleKeyInfo object.
GetHashCode | Returns the hash code for the current ConsoleKeyInfo object.
ToString | Returns a string representation of this object instance.

Remarks

When a key pressed on a console, a ConsoleKeyInfo object is generated by reading the pressed key using the ReadKey method. The generated object contains the key press information describing the event.

See Also

Project CorLib Overview

Class ConsoleKeyInfo Overview

Console


ConsoleKeyInfo: ConsoleKey

ConsoleKey

A list of all the scankey codes.

 Public Enum ConsoleKey

Values

AKey = 65
The A key.
AddKey = 107
The keypad plus key.
ApplicationsKey = 91
The application key (Microsoft Natual Keyboard)
AttentionKey = 246
The ATTN key.
BKey = 66
The B key.
BackSpaceKey = 8
The BackSpace key.
BrowserBackKey = 166
The Browser Back key (Windows 2000 or later)
BrowserFavoritesKey = 171
The Browser Favorites key (Windows 2000 or later)
BrowserForwardKey = 167
The Browser Forward key (Windows 2000 or later)
BrowserHomeKey = 172
The Browser Home key (Windows 2000 or later)
BrowserRefreshKey = 168
The Browser Refresh key (Windows 2000 or later)
BrowserSearchKey = 170
The Browser Search key (Windows 2000 or later)
BrowserStopKey = 169
The Browser Stop key (Windows 2000 or later)
CKey = 67
The C Key.
ClearKey = 12
The CLEAR key.
CrSelKey = 247
The CRSEL (CURSOR SELECT) key.
DKey = 68
The D key.
D0Key = 48
The 0 key.
D1Key = 49
The 1 key.
D2Key = 50
The 2 key.
D3Key = 51
The 3 key.
D4Key = 52
The 4 key.
D5Key = 53
The 5 key.
D6Key = 54
The 6 key.
D7Key = 55
The 7 key.
D8Key = 56
The 8 Key.
D9Key = 57
The 9 key.
DecimalKey = 110
The Decimal key.
DeleteKey = 46
The Delete key.
DivideKey = 111
The divide key.
DownArrowKey = 40
The DOWN ARROW key.
EKey = 69
The E key.
EndKey = 35
The END key.
EnterKey = 13
The Enter key.
EraseEndOfFileKey = 249
The ERASE EOF key.
EscapeKey = 27
The ESC (ESCAPE) key.
ExecuteKey = 43
The EXECUTE key.
ExSelKey = 248
The EXSEL (EXTEND SELECTION) key.
FKey = 70
The F key.
F1Key = 112
The F1 key.
F2Key = 113
The F2 key.
F3Key = 114
The F3 key.
F4Key = 115
The F4 key.
F5Key = 116
The F5 key.
F6Key = 117
The F6 key.
F7Key = 118
The F7 key.
F8Key = 119
The F8 key.
F9Key = 120
The F9 key.
F10Key = 121
The F10 key.
F11Key = 122
The F11 key.
F12Key = 123
The F12 key.
F13Key = 124
The F13 key.
F14Key = 125
The F14 key.
F15Key = 126
The F15 key.
F16Key = 127
The F16 key.
F17Key = 128
The F17 key.
F18Key = 129
The F18 key.
F19Key = 130
The F19 key.
F20Key = 131
The F20 key.
F21Key = 132
The F21 key.
F22Key = 133
The F22 key.
F23Key = 134
The F23 key.
F24Key = 135
The F24 key.
GKey = 71
The G key.
hKey = 72
The H key.
HelpKey = 47
The HELP key.
HomeKey = 36
The HOME key.
IKey = 73
The I key.
InsertKey = 45
The INS (INSERT) key.
JKey = 74
The J key.
KKey = 75
The K key.
LKey = 76
The L key.
LaunchApp1Key = 182
The Start Application 1 key (MS Natural keyboard, Windows 2000 or later)
LaunchApp2Key = 183
The Start Application 2 key (MS Natural keyboard, Windows 2000 or later)
LaunchMailKey = 180
The Start Mail key (MS Natural keyboard, Windows 2000 or later)
LaunchMediaSelectKey = 181
The Select Media key (MS Natural keyboard, Windows 2000 or later)
LeftArrowKey = 37
The LEFT ARROW key.
LeftWindowsKey = 91
The left Windows logo key.
mKey = 77
The M key.
MediaNextKey = 176
The Media Next Track key (MS Natural keyboard, Windows 2000 or later)
MediaPlayKey = 179
The Media Play Track key (MS Natural keyboard, Windows 2000 or later)
MediaPreviousKey = 177
The Media Previous Track key (MS Natural keyboard, Windows 2000 or later)
MediaStopKey = 178
The Media Stop key (MS Natural keyboard, Windows 2000 or later)
MultiplyKey = 106
The Multiply key.
NKey = 78
The N key.
NoNameKey = 252
A constant reserved for future use.
NumPad0Key = 96
The 0 key on the numeric keypad.
NumPad1Key = 97
The 1 key on the numeric keypad.
NumPad2Key = 98
The 2 key on the numeric keypad.
NumPad3Key = 99
The 3 key on the numeric keypad.
NumPad4Key = 100
The 4 key on the numeric keypad.
NumPad5Key = 101
The 5 key on the numeric keypad.
NumPad6Key = 102
The 6 key on the numeric keypad.
NumPad7Key = 103
The 7 key on the numeric keypad.
NumPad8Key = 104
The 8 key on the numeric keypad.
NumPad9Key = 105
The 9 key on the numeric keypad.
OKey = 79
The O key.
Oem1Key = 186
The OEM 1 key (OEM Specific)
Oem102Key = 226
The OEM 102 key (OEM Specific)
Oem2Key = 191
The OEM 2 key (OEM Specific)
Oem3Key = 192
The OEM 3 key (OEM Specific)
Oem4Key = 219
The OEM 4 key (OEM Specific)
Oem5Key = 220
The OEM 5 key (OEM Specific)
Oem6Key = 221
The OEM 6 key (OEM Specific)
Oem7Key = 222
The OEM 7 key (OEM Specific)
Oem8Key = 223
The OEM 8 key (OEM Specific)
OemClearKey = 254
The CLEAR key (OEM Specific)
OemCommaKey = 188
The Comma Key.
OemMinusKey = 189
The Minus key.
OemPeriodKey = 190
The Period key.
OemPlusKey = 187
The Plus key.
PKey = 80
The P key.
Pa1Key = 253
The PA1 key.
PacketKey = 231
The Packet key (used to pass unicode characters with keystrokes)
PageDownKey = 34
The PAGE DOWN key.
PageUpKey = 33
The PAGE UP key.
PauseKey = 19
The PAUSE key.
PlayKey = 250
The PLAY key.
PrintKey = 42
The PRINT key.
PrintScreenKey = 44
The PRINT SCREEN key.
ProcessKey = 229
The IME PROCESS key.
QKey = 81
The Q key.
RKey = 82
The R Key.
RightArrowKey = 39
The RIGHT ARROW key.
RightWindowsKey = 92
The right Windows logo key.
SKey = 83
The S key.
SelectKey = 41
The SELECT key.
SeparatorKey = 108
The Separator key.
SleepKey = 95
The Computer Sleep key.
SpaceBarKey = 32
The Space Bar key.
SubtractKey = 109
The Subtract key.
TKey = 84
The T key.
TabKey = 9
The TAB key.
UKey = 85
The U key.
UpArrowKey = 38
The UP ARROW key.
VKey = 86
The V key.
VolumeDownKey = 174
The Volume Down key.
VolumeMuteKey = 173
The Volume Mute key.
VolumeUpKey = 175
The Volume Up key.
WKey = 87
The W key.
XKey = 88
The X key.
YKey = 89
The Y key.
ZKey = 90
The Z key.
ZoomKey = 251
The ZOOM key.

See Also

Project CorLib Overview

Class ConsoleKeyInfo Overview


ConsoleKeyInfo: ConsoleModifiers

ConsoleModifiers

Values that represent the specific modifier keys used to indicate different values for specific keys.

 Public Enum ConsoleModifiers

Values

AltKey = 1
The left or right alt key is specified.
ShiftKey = 2
The left or right shift key is specified.
ControlKey = 4
The left or right control key is specified.

Remarks

A single key can have different meanings when used in combination with these modifiers.

See Also

Project CorLib Overview

Class ConsoleKeyInfo Overview


ConsoleKeyInfo: Equals

Equals

Gets a value indicating whether the specified ConsoleKeyInfo object is equal to the current ConsoleKeyInfo object.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. A value to compare to the current ConsoleKeyInfo object.

Return Values

Boolean - True if Value is equal to the current ConsoleKeyInfo object; otherwise, False.

See Also

Project CorLib Overview

Class ConsoleKeyInfo Overview


ConsoleKeyInfo: GetHashCode

GetHashCode

Returns the hash code for the current ConsoleKeyInfo object.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit signed integer hash code.

See Also

Project CorLib Overview

Class ConsoleKeyInfo Overview


ConsoleKeyInfo: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class ConsoleKeyInfo Overview


ConsoleKeyInfo: Key (get)

Key

Returns the scankey code of the pressed key.

 Public Property Get Key ( ) As ConsoleKey

Return Values

ConsoleKey - Scankey code.

Remarks

This is not the same code as a Unicode character.

Read Only.

See Also

Project CorLib Overview

Class ConsoleKeyInfo Overview


ConsoleKeyInfo: KeyChar (get)

KeyChar

Returns the Unicode character of the pressed key.

 Public Property Get KeyChar ( ) As Integer

Return Values

Integer - The Unicode character.

Read Only.

See Also

Project CorLib Overview

Class ConsoleKeyInfo Overview


ConsoleKeyInfo: Modifiers (get)

Modifiers

Returns the state of the key modifiers (Shift, Alt, Control) at the time of the key press.

 Public Property Get Modifiers ( ) As ConsoleModifiers

Return Values

ConsoleModifiers - Modifier keys state.

Read Only.

See Also

Project CorLib Overview

Class ConsoleKeyInfo Overview


ConsoleKeyInfo: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class ConsoleKeyInfo Overview


Constructors

Constructors

Functions used to create fully inititalized objects.

Public:

Methods:

Name | Description
CreateEnumerator | Creates a For..Each compatible wrapper around an IEnumerator interface.
NewApplicationException | Creates a new ApplicationException object.
NewArgumentException | Creates a new ArgumentException object.
NewArgumentNullException | Creates a new ArgumentNullException object.
NewArgumentOutOfRangeException | Creates a new ArgumentOutOfRangeException object.
NewArithmeticException | Initializes a new instance of the ArithmeticException class with a specified error message and a reference to the inner exception that is the cause of this exception.
NewArray | Creates an array of values.
NewArrayList | Creates a new ArrayList object with the specified settings.
NewArrayTypeMismatchException | Creates a new ArrayTypeMismatchException object.
NewBigInteger | Creates a new BigInteger instance.
NewBinaryReader | Returns a new BinaryReader that can read from the specified stream usind the specified encoding.
NewBinaryWriter | Returns a new BinaryWriter used to write to a Stream object.
NewBitArray | Creates a new BitArray object.
NewBooleans | Initializes a Boolean array with elements copied from Values.
NewBytes | Initializes a Byte array with elements copied from Values.
NewCaseInsensitiveComparer | Initializes a new instance of the CaseInsensitiveComparer class using the specified CultureInfo.
NewCharEnumerator | Creates an enumerator used to iterate over the Unicode characters of a String.
NewChars | Initializes an Integer array representing Unicode characters with elements copied from Values.
NewCollection | Initializes a Collection with elements copied from Values.
NewComparer | Initializes a new instance of the Comparer class using the specified CultureInfo.
NewConsoleKeyInfo | Initializes a new ConsoleKeyInfo object that represents the state of a key press.
NewCryptoAPIHash | Creates a new CryptoAPIHash object.
NewCryptographicException | Creates a new CryptographicException object.
NewCryptoStream | Creates a new CryptoStream object used to read or write transformed data to or from an underlying stream.
NewCspKeyContainerInfo | Creates a new CspKeyContainerInfo object.
NewCspParameters | Creates a new CspParameters object.
NewCultureInfo | Creates a new CultureInfo object for the specified culture.
NewCurrencies | Initializes a Currency array with elements copied from Values.
NewDate | Creates a new CorDateTime object from a VB Date.
NewDates | Initializes a Date array with elements copied from Values.
NewDateTime | Creates a new CorDateTime object set to the specified date.
NewDayLightTime | Creates a new DayLightTime object with the specified start and end times for daylight saving.
NewDecimals | Initializes a Decimal array with elements copied from Values.
NewDecoderFallbackException | Initializes a new instance of the DecoderFallbackException class. Parameters specify the error message and the inner exception that is the cause of this exception.
NewDecoderFallbackException2 | Initializes a new instance of the DecoderFallbackException class. Parameters specify the error message, the array of bytes being decoded, and the index of the byte that cannot be decoded.
NewDecoderReplacementFallback | Initializes a new instance of the DecoderReplacementFallback class using a specified replacement string.
NewDecoderReplacementFallbackBuffer | Initializes a new instance of the DecoderReplacementFallbackBuffer class using the value of a DecoderReplacementFallback object.
NewDictionaryEntry | Creates a new DictionaryEntry object initialized with Key and Value.
NewDirectoryInfo | Creates a new DirectoryInfo object that describes the specified path.
NewDirectoryNotFoundException | Creates a new DirectoryNotFoundException object with the specified message and optional exception.
NewDivideByZeroException | Initializes a new instance of the DivideByZeroException class with a specified error message and a reference to the inner exception that is the cause of this exception.
NewDoubles | Initializes a Double array with elements copied from Values.
NewDriveInfo | Initializes a new DriveInfo object used to inspect a drives information.
NewDriveNotFoundException | Initializes a new instance of the DriveNotFoundException class with the specified error message and a reference to the inner exception that is the cause of this exception.
NewDSACryptoServiceProvider | Creates a new DSACryptoServiceProvider object.
NewEncoderFallbackException | Initializes a new instance of the EncoderFallbackException class. Parameters specify the error message and the inner exception that is the cause of this exception.
NewEncoderFallbackException2 | Initializes a new instance of the EncoderFallbackException class. Parameters specify the error message, unknown character, and index.
NewEncoderFallbackException3 | Initializes a new instance of the EncoderFallbackException class. Parameters specify the error message, high surrogate, low surrogate, and Index.
NewEncoderReplacementFallback | Initializes a new instance of the EncoderReplacementFallback class using a specified replacement string.
NewEncoderReplacementFallbackBuffer | Initializes a new instance of the EncoderReplacementFallbackBuffer class using the value of a EncoderReplacementFallback object.
NewEndOfStreamException | Returns a new EndOfStreamException with the specified message and optional exception.
NewEnumeratorBase | Initializes a new instance of EnumeratorBase.
NewException | Creates a new Exception object.
NewExceptionBase | Creates a new ExceptionBase object that can be contained within an exception class.
NewExternalException | Creates a new ExternalException object.
NewFileInfo | Creates a new FileInfo object used to describe and manage a file.
NewFileNotFoundException | Creates a new FileNotFoundException with the specified FileName, Message, and InnerException.
NewFileStream | Returns a new FileStream to access an underyling file.
NewFileStreamWithHandle | Returns a new FileStream to access a file other than that on disk, such as pipes.
NewFormatException | Creates a new FormatException object.
NewFromBase64Transform | Creates a new FromBase64Transform object used to convert base64 characters to plain text.
NewGregorianCalendar | Creates a new instance of the GregorianCalendar class.
NewGuid | Initializes a new instance of the Guid object by using the specified array of bytes, string, or memory pointer.
NewHashAlgorithmBase | Creates a HashAlgorithmBase object used by hash algorithms.
NewHashtable | Initializes a new instance of the Hashtable class by copying the elements from the specified dictionary to the new Hashtable object. The new Hashtable object has an initial capacity equal to the number of elements copied, and uses the specified load factor and IEqualityComparer object.
NewHashtable2 | Initializes a new, empty instance of the Hashtable class using the specified initial capacity, load factor, and IEqualityComparer object.
NewHMACBase | Creates a HMACBase object that can be used as a base implementation of an HMAC class.
NewHMACMD5 | Creates a new HMACMD5 object.
NewHMACRIPEMD160 | Creates a new HMACRIPEMD160 object.
NewHMACSHA1 | Creates a new HMACSHA1 object.
NewHMACSHA256 | Creates a new HMACSHA256 object.
NewHMACSHA384 | Creates a new HMACSHA384 object.
NewHMACSHA512 | Creates a new HMACSHA512 object.
NewIndexOutOfRangeException | Creates a new IndexOutOfRangeException object.
NewIniFile | Initializes a new IniFile to manage an INI file.
NewIniResourceWriter | Initializes a new instance of IniResourceWriter with specified FileName and Section.
NewInt64 | Returns an initialized instance of Int64.
NewInt64s | Initializes an Int64 array with elements copied from Values.
NewIntegers | Initializes an Integer array with elements copied from Values.
NewInvalidCastException | Creates a new InvalidCaseException object.
NewInvalidOperationException | Creates a new InvalidOperationException object.
NewIOException | Creates a new IOException object with the specified Message, HResult, and InnerException.
NewKeySizes | Creates a new KeySizes object with the MinSize, MaxSize, and SkipSize properties defined.
NewLongs | Initializes a Long array with elements copied from Values.
NewMACTripleDES | Creates a new MACTripleDES object.
NewMemoryStream | Initializes a new instance of the MemoryStream class based on the specified region of a byte array, with the CanWrite property set as specified.
NewNotSupportedException | Creates a new NotSupportedException object.
NewObjectDisposedException | Returns a new ObjectDisposedException.
NewOperatingSystem | Returns a new OperatingSystem object with the specified Platform and Version.
NewOverflowException | Returns a new OverflowException with the specified message and exception.
NewPathTooLongException | Returns a new PathTooLongException object.
NewPictureResourceGroup | Creates a picture group object used to contain information about resources that are grouped together.
NewPictureResourceInfo | Initializes a new instance of the PictureResourceInfo class with the specified ResourceId and Resource.
NewPlatformNotSupportedException | Returns a new PlatformNotSupportedException with the specified Message and InnerException.
NewQueue | Creates a new Queue initialized with the elements in the collection.
NewRandom | Creates a new Random object initialized with the specified seed.
NewRankException | Creates a new RankException object.
NewResourceKey | Creates a new ResourceKey object used to uniquely identify a resource.
NewResourceManager | Creates a new ResourceManager for a specified .RES file.
NewResourceReader | Creates a new ResourceReader object.
NewResourceSet | Creates a new ResourceSet for a specific culture.
NewResourceWriter | Creates a new ResourceWriter object.
NewRfc2898DeriveBytes | Initializes a new instance of the Rfc2898DeriveBytes class using a password, a salt or salt size, and number of iterations to derive the key.
NewRNGCryptoServiceProvider | Creates a new RNGCryptoServiceProvider that uses a crypto service provider to generate random numbers.
NewRSACryptoServiceProvider | Creates a new RSACryptoServiceProvider object.
NewSafeFileHandle | Initializes a new instance of the SafeFileHandle class.
NewSafeHandle | Initializes a new instance of the SafeHandle class.
NewSecurityElement | Creates a new SecurityElement object.
NewSerializationException | Creates a new SerializationException object.
NewSingles | Initializes a Single array with elements copied from Values.
NewSortedList | Creates a new SortedList object with specific initialization options.
NewStack | Initializes a new instance of the Stack class that contains elements copied from the specified collection.
NewStreamReader | Creates a new StreamReader from either a FileName or an existing stream to read from.
NewStreamWriter | Creates a new StreamWriter with either a filename or other stream as a source to write to in the specified Encoding.
NewString | Initializes a new String to the value indicated by an array of Unicode characters, a starting character position within that array, and a length.
NewStringBuilder | Returns a new StringBuilder with user specified settings and starting string.
NewStringReader | Returns a new StringReader object.
NewStrings | Initializes a String array with elements copied from Values.
NewStringWriter | Returns a new StringWriter object.
NewSystemException | Creates a new SystemException object.
NewTicker | Creates a new Ticker.
NewTime | Initializes a new TimeSpan representing the time portion of a date.
NewTimeSpan | Creates a new TimeSpan object set to the specified amount of time.
NewUnauthorizedAccessException | Creates a new UnauthorizedAccessException object.
NewUnicodeEncoding | Returns a new UnicodeEncoding object with the specified settings.
NewUTF32Encoding | Initializes a new instance of the UTF32Encoding class. Parameters specify whether to use the big endian byte order, whether to provide a Unicode byte order mark, and whether to throw an exception when an invalid encoding is detected.
NewUTF7Encoding | Returns a new UTF7Encoding object.
NewUTF8Encoding | Returns a new UTF8Encoding object.
NewVariants | Initializes a Variant array with elements copied from Values.
NewVersion | Creates a new Version object with specified version information.
NewWinResourceReader | Creates a new WinResourceReader object.
NewXmlSyntaxException | Creates a new XmlSyntaxException object.

Remarks

This class is defined as Global-Multiuse. All of the functions can be called directly without needing to create a Constructors object.

The Cor accessor can be used to easily find and select the desired object to create. Using the Cor accessor provides IntelliSense to the available constructors, making object creation easier.

Examples

The example demonstrates instantiating a FileStream object using two methods.

Public Sub Main()
    Dim FS As FileStream

    ' open file using global method.
    Set FS = NewFileStream("MyFile.txt", FileMode.OpenExisting)

    ' open file using global Cor accessor.
    Set FS = Cor.NewFileStream("MyFile.txt", FileMode.OpenExisting)
End Sub

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: BInt

BInt

Attempts to convert a value to a valid BigInteger instance.

 Public Function BInt(
      ByRef Value As Variant ) As BigInteger

Parameters

Value
[ByRef] Variant. The value to be converted to BigInteger.

Return Values

BigInteger - A new BigInteger instance representing the converted value.

Remarks

The follow datatypes are supported:
vbString
vbLong
vbInteger
vbByte
vbDoube
vbSingle
vbCurrency
vbDecimal
vbByte Array
Int64 BigInteger (returns same instance)
Nothing (returns BigInteger.Zero)

 Dim b As BigInteger
 Set b = BInt(12345)

See Also

Project CorLib Overview

Class Constructors Overview

Build on Monday, March 23, 2020 by VBDOX
Copyright © 2000 - 2003 M.Stamenov


Constructors: CreateEnumerator

CreateEnumerator

Creates a For..Each compatible wrapper around an IEnumerator interface.

 Public Function CreateEnumerator(
      ByVal Obj As IEnumerator ) As IUnknown

Parameters

Obj
[ByVal] IEnumerator. The IEnumerator object that is to be called during For..Each.

Return Values

IUnknown - A For..Each compatible enumerator.

Remarks

VBCorLib allows for the building of custom enumerators to be used in a For..Each loop context.

To create a custom enumerator please refer to the IEnumerator interface.

In order for Visual Basic to utilize a custom IEnumerator object, it must be wrapped in an object that implements the IEnumVariant interface. This is the only interface that Visual Basic can use in a For..Each context. By passing in the custom enumerator into the CreateEnumerator function, a wrapper is applied and returned that is then returned in the typical NewEnum function of a class.

Examples

The following example shows a typical usage of CreateEnumerator within the NewEnum method that an enumerable class implements.

Public Function NewEnum() As IUnknown
    Dim en As New MyEnumerator
    en.Init Me
    Set NewEnum = CreateEnumerator(en)
End Function

See Also

Project CorLib Overview

Class Constructors Overview

IEnumerator


Constructors: NewApplicationException

NewApplicationException

Creates a new ApplicationException object.

 Public Function NewApplicationException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As ApplicationException

Parameters

Message
[ByRef] String. A human-readable message explaining the exception.
InnerException
[ByVal] Optional. Exception. An exception that caused this exception.

Return Values

ApplicationException - A fully created ApplicationException object.

See Also

Project CorLib Overview

Class Constructors Overview

ApplicationException


Constructors: NewArgumentException

NewArgumentException

Creates a new ArgumentException object.

 Public Function NewArgumentException(
      ByRef Message As String,
      Optional ByRef ParamName As String,
      Optional ByVal InnerException As Exception ) As ArgumentException

Parameters

Message
[ByRef] String. A human-readable message explaining the exception.
ParamName
[ByRef] Optional. String. The parameter that caused the exception.
InnerException
[ByVal] Optional. Exception. An exception that caused this exception.

Return Values

ArgumentException - A fully created ArgumentException object.

Remarks

When throwing an ArgumentException a meaningful error message describing the invalid argument, the name of the argument, as well as the expected range of values for the argument should be defined.

Examples

The example demonstrates various methods for creating and throwing an ArgumentException object.

Public Sub Main()
    ' Throws a default ArgumentException object
    Throw New ArgumentException

    ' Throws an ArgumentException with a custom message and parameter name
    Throw Cor.NewArgumentException("The argument is incorrect.", "MyParam")

    ' Throws an ArgumentException with a custom message and error code and parameter name
    Dim ex As ArgumentException
    Set ex = Cor.NewArgumentException("The argument is incorrect.", "MyParam")
    ex.HResult = 123
    Throw ex
End Sub

See Also

Project CorLib Overview

Class Constructors Overview

ArgumentException


Constructors: NewArgumentNullException

NewArgumentNullException

Creates a new ArgumentNullException object.

 Public Function NewArgumentNullException(
      Optional ByRef ParamName As String,
      Optional ByRef Message As String,
      Optional ByVal InnerException As Exception ) As ArgumentNullException

Parameters

ParamName
[ByRef] Optional. String. The parameter that caused the exception.
Message
[ByRef] Optional. String. A human-readable message explaining the exception.
InnerException
[ByVal] Optional. Exception. An exception that caused this exception.

Return Values

ArgumentNullException - A fully created ArgumentNullException object.

Remarks

When throwing an ArgumentNullException a meaningful error message describing the invalid argument and the name of the argument should be defined.

Examples

 ' Throws a default ArgumentNullException object
 Throw New ArgumentNullException

 ' Throws an ArgumentNullException with a custom message and parameter name
 Throw Cor.NewArgumentNullException("MyParam", "A valid object is required.")

 ' Throws an ArgumentNullException with a custom message and error code and parameter name
 Dim ex As ArgumentNullException
 Set ex = Cor.NewArgumentNullException("MyParam", "A valid object is required.")
 ex.HResult = 123
 Throw ex

This example shows how to throw three different variations of the same ArgumentNullException object.

See Also

Project CorLib Overview

Class Constructors Overview

ArgumentNullException


Constructors: NewArgumentOutOfRangeException

NewArgumentOutOfRangeException

Creates a new ArgumentOutOfRangeException object.

 Public Function NewArgumentOutOfRangeException(
      Optional ByRef ParamName As String,
      Optional ByRef Message As String,
      Optional ByRef ActualValue As Variant,
      Optional ByVal InnerException As Exception,
      Optional Method As InvocationMethod ) As ArgumentOutOfRangeException

Parameters

ParamName
[ByRef] Optional. String. The parameter that caused the exception.
Message
[ByRef] Optional. String. A human-readable message explaining the exception.
ActualValue
[ByRef] Optional. Variant. The value of the parameter that caused the exception.
InnerException
[ByVal] Optional. Exception. An exception that caused this exception.
Method
[ByRef] Optional. InvocationMethod. Describes the type of method being executed which caused the exception.

Return Values

ArgumentOutOfRangeException - A fully created ArgumentOutOfRangeException object.

See Also

Project CorLib Overview

Class Constructors Overview

ArgumentOutOfRangeException


Constructors: NewArithmeticException

NewArithmeticException

Initializes a new instance of the ArithmeticException class with a specified error message and a reference to the inner exception that is the cause of this exception.

 Public Function NewArithmeticException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As ArithmeticException

Parameters

Message
[ByRef] String. The error message that explains the reason for the exception.
InnerException
[ByVal] Optional. Exception. The exception that is the cause of the current exception.

Return Values

ArithmeticException - A new instance of ArithmeticException.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewArray

NewArray

Creates an array of values.

 Public Function NewArray(
      ByVal ElementType As VbVarType,
      ParamArray ArrayElements ( ) As Variant ) As Variant

Parameters

ElementType
[ByVal] VbVarType. The target datatype of the resultant array and the values to be converted to.
ArrayElements
[ByRef] Variant. The values to be put into the new array.

Return Values

Variant - An array of the specified datatype and containing the array elements with conversion, or an empty array if no elements are defined.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewArrayList

NewArrayList

Creates a new ArrayList object with the specified settings.

 Public Function NewArrayList(
      Optional ByVal Comparer As IComparer,
      Optional ByRef Source As Variant ) As ArrayList

Parameters

Comparer
[ByVal] Optional. IComparer. A comparer to be used for searching and sorting items in the list.
Source
[ByRef] Optional. Variant. A collection to initialize the list with. Count will reflect the number of items added.

Return Values

ArrayList - A new ArrayList object.

Remarks

Sometimes the comparison of two items in the list cannot be accomplished by the default comparer that ArrayList uses. Cases like this may be when using different datatypes, UDTs, or objects that do not implement IComparable. In cases such as these, a custom comparer object may be supplied during the construction of an ArrayList. This comparer will be used as the default comparer for methods that require comparing items.

An ArrayList can be initialized with a default set of items. This is the same as creating a new ArrayList and using AddRange to add the items.

ArrayList accepts a VBA.Collection, ICollection, and an array as a list of items to initialize the new ArrayList to.

Example

 Dim MyItems(10) As Long

 Set list = NewArrayList(New MyComparer, MyItems)
This will create a new ArrayList that uses MyComparer as the default comparer for the items. The ArrayList is also initialized with an array of Longs. The fully initialized ArrayList will have a count of 11 items, each item being a Long datatype with the value of 0.

See Also

Project CorLib Overview

Class Constructors Overview

ArrayList

IComparer


Constructors: NewArrayTypeMismatchException

NewArrayTypeMismatchException

Creates a new ArrayTypeMismatchException object.

 Public Function NewArrayTypeMismatchException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As ArrayTypeMismatchException

Parameters

Message
[ByRef] String. A human-readable message explaining the exception.
InnerException
[ByVal] Optional. Exception. An exception that caused this exception.

Return Values

ArrayTypeMismatchException - A fully created ArrayTypeMismatchException object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewBigInteger

NewBigInteger

Creates a new BigInteger instance.

 Public Function NewBigInteger(
      ByRef Value As Variant ) As BigInteger

Parameters

Value
[ByRef] Variant. The value to intialize a new instance of BigInteger to.

Return Values

BigInteger - A new BigInteger instance containing the specified value.

Remarks

The follow datatypes are supported.

  • vbLong
  • vbInteger
  • vbByte
  • vbDoube
  • vbSingle
  • vbCurrency
  • vbDecimal
  • vbByte Array
  • Int64

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewBinaryReader

NewBinaryReader

Returns a new BinaryReader that can read from the specified stream usind the specified encoding.

 Public Function NewBinaryReader(
      ByVal InputStream As Stream,
      Optional ByVal Encoding As Encoding,
      Optional ByVal LeaveOpen As Boolean ) As BinaryReader

Parameters

InputStream
[ByVal] Stream. The stream to read the data from.
Encoding
[ByVal] Optional. Encoding. The encoding system to be used to decode the bytes from the stream.
LeaveOpen
[ByVal] Optional. Boolean. The stream can optionally be left open after the reader has been closed.

Return Values

BinaryReader - The new BinaryReader with the specified stream and encoding.

Remarks

If Encoding is not specified, then the reader is created using UTF8Encoding.

Exceptions

Exception | Condition
ArgumentNullException | InputStream is Nothing.
ArgumentException | The stream does not support reading, or is already closed.

Examples

The following example demonstrates the two ways to create a BinaryReader object using the NewBinaryReader constructor method.

Public Sub Main()
    Dim Source As FileStream
    Dim Reader As BinaryReader

    Set Source = File.OpenFile("MyFile.txt", FileMode.OpenExisting)

    ' method one
    Set Reader = NewBinaryReader(Source)

    ' method two
    Set Reader = Cor.NewBinaryReader(Source)

End Sub

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewBinaryWriter

NewBinaryWriter

Returns a new BinaryWriter used to write to a Stream object.

 Public Function NewBinaryWriter(
      ByVal Stream As Stream,
      Optional ByVal Encoding As Encoding ) As BinaryWriter

Parameters

Stream
[ByVal] Stream. The supplied stream.
Encoding
[ByVal] Optional. Encoding. The character encoding.

Return Values

BinaryWriter - The new BinaryWriter object.

Remarks

If Encoding is not supplied, then an encoding of Cor.NewUTF8Encoding(False, True) is used.
Exception | Condition
ArgumentException | The stream does not support writing, or the stream is already closed.
ArgumentNullException | Stream is Nothing.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewBitArray

NewBitArray

Creates a new BitArray object.

 Public Function NewBitArray(
      ByVal Length As Long,
      Optional ByVal Value As Boolean ) As BitArray

Parameters

Length
[ByVal] Long. The number of bits the object will represent.
Value
[ByVal] Optional. Boolean. The value to initialize all the bits to (True = 1, False = 0).

Return Values

BitArray - A new BitArray object set to the specified length with the specified value.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewBooleans

NewBooleans

Initializes a Boolean array with elements copied from Values.

 Public Function NewBooleans(
      ParamArray Values ( ) As Variant ) As Boolean ( )

Parameters

Values
[ByRef] Variant. The values to create the array from.

Return Values

Boolean() -

Remarks

The values need to be convertable to a Boolean or an exception will occur.

The array is zero-based.

If no values are passed in then an empty array is returned, not a null array.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewBytes

NewBytes

Initializes a Byte array with elements copied from Values.

 Public Function NewBytes(
      ParamArray Values ( ) As Variant ) As Byte ( )

Parameters

Values
[ByRef] Variant. The values to create the array from.

Return Values

Byte() -

Remarks

The values need to be convertable to a Byte or an exception will occur.

The array is zero-based.

If no values are passed in then an empty array is returned, not a null array.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewCaseInsensitiveComparer

NewCaseInsensitiveComparer

Initializes a new instance of the CaseInsensitiveComparer class using the specified CultureInfo.

 Public Function NewCaseInsensitiveComparer(
      ByVal Culture As CultureInfo ) As CaseInsensitiveComparer

Parameters

Culture
[ByVal] CultureInfo. The CultureInfo to use for the new CaseInsensitiveComparer.

Return Values

CaseInsensitiveComparer - A new instance of the CaseInsensitiveComparer class.

Exceptions

Exception | Condition
ArgumentNullException | Culture is Nothing.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewCharEnumerator

NewCharEnumerator

Creates an enumerator used to iterate over the Unicode characters of a String.

 Public Function NewCharEnumerator(
      ByRef s As String,
      Optional ByVal CopyString As Boolean ) As CharEnumerator

Parameters

s
[ByRef] String. The string to iterate each character of.
CopyString
[ByVal] Optional. Boolean. Indicates if the enumerator should create a copy of the passed in string, or use the existing string in memory.

Return Values

CharEnumerator - A CharEnumerator used to iterate over each character of a string.

Remarks

By default CharEnumerator makes a copy of the passed in string. The original string can be changed as normal.

If CopyString is set to False, then the original string must not change or go out of scope for the duration of the CharEnumerator objects life time.

By telling CharEnumerator to not make a copy of the original string, memory is not allocated for the string, which can be helpful for large strings.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewChars

NewChars

Initializes an Integer array representing Unicode characters with elements copied from Values.

 Public Function NewChars(
      ParamArray Values ( ) As Variant ) As Integer ( )

Parameters

Values
[ByRef] Variant. A series of characters or their Unicode code points.

Return Values

Integer() - An Integer array containing a set of Unicode characters.

Remarks

This is a convenience method to easily create an Integer array representing Unicode characters.

If a string with more than one character is processed, only the first character will be recognized. To convert an entire string to a character array use CorString.ToCharArray.

Examples

This example creates a new character array using both string and Unicode values then displays them.

Public Sub Main()
    Dim Chars() As Integer
    Dim Char As Variant

    Chars = NewChars("a", "b", 99, 100)

    Debug.Print "The set of characters."

    For Each Char In Chars
        Debug.Print CorString.Format("{0,3} = ""{0:$}""", Char)
    Next
End Sub

' This example code produces the following output.
'
'    The set of characters.
'     97 = "a"
'     98 = "b"
'     99 = "c"
'    100 = "d"

See Also

Project CorLib Overview

Class Constructors Overview

NewString

CorString


Constructors: NewCollection

NewCollection

Initializes a Collection with elements copied from Values.

 Public Function NewCollection(
      ParamArray Values ( ) As Variant ) As Collection

Parameters

Values
[ByRef] Variant. The values to initialize the collection with.

Return Values

Collection - Returns a collection containing items in Values parameter.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewComparer

NewComparer

Initializes a new instance of the Comparer class using the specified CultureInfo.

 Public Function NewComparer(
      ByVal Culture As CultureInfo ) As Comparer

Parameters

Culture
[ByVal] CultureInfo. The CultureInfo to use for the new Comparer.

Return Values

Comparer - A new instance of the Comparer class using the specified CultureInfo.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewConsoleKeyInfo

NewConsoleKeyInfo

Initializes a new ConsoleKeyInfo object that represents the state of a key press.

 Public Function NewConsoleKeyInfo(
      ByVal KeyChar As Integer,
      ByVal Key As ConsoleKey,
      ByVal Shift As Boolean,
      ByVal Alt As Boolean,
      ByVal Control As Boolean ) As ConsoleKeyInfo

Parameters

KeyChar
[ByVal] Integer. The Unicode character that corresponds to the Key parameter.
Key
[ByVal] ConsoleKey. The console key that corresponds to the KeyChar parameter.
Shift
[ByVal] Boolean. True to indicate that a SHIFT key was pressed; otherwise, False.
Alt
[ByVal] Boolean. True to indicate that a ALT key was pressed; otherwise, False.
Control
[ByVal] Boolean. True to indicate that a CTRL key was pressed; otherwise, False.

Return Values

ConsoleKeyInfo - A new ConsoleKeyInfo object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewCryptoAPIHash

NewCryptoAPIHash

Creates a new CryptoAPIHash object.

 Public Function NewCryptoAPIHash(
      ByVal HashAlg As Long,
      ByVal HashSize As Long ) As CryptoAPIHash

Parameters

HashAlg
[ByVal] Long. The algorithm of the hash to be used.
HashSize
[ByVal] Long. The size of the hash output.

Return Values

CryptoAPIHash - A new CryptoAPIHash object.

Remarks

A CryptoAPIHash object is an implementation of the IHashAlgorithm callback that uses the CryptoAPI hash routines.

See Also

Project CorLib Overview

Class Constructors Overview

CryptoAPIHash


Constructors: NewCryptographicException

NewCryptographicException

Creates a new CryptographicException object.

 Public Function NewCryptographicException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As CryptographicException

Parameters

Message
[ByRef] String. The message contained within the exception object.
InnerException
[ByVal] Optional. Exception. A reference to an exception that may have cause this exception to occur.

Return Values

CryptographicException - A new CryptoGraphicException object.

Remarks

Most of the exceptions that occur within the cryptography set of classes will be a CryptographicException.

See Also

Project CorLib Overview

Class Constructors Overview

CryptographicException


Constructors: NewCryptoStream

NewCryptoStream

Creates a new CryptoStream object used to read or write transformed data to or from an underlying stream.

 Public Function NewCryptoStream(
      ByVal Stream As Stream,
      ByVal Transform As ICryptoTransform,
      ByVal Mode As CryptoStreamMode ) As CryptoStream

Parameters

Stream
[ByVal] Stream. The stream on which to perform the cryptographic transformation.
Transform
[ByVal] ICryptoTransform. The cryptographic transformation that is to be performed on the stream.
Mode
[ByVal] CryptoStreamMode. One of the CryptoStreamMode values.

Return Values

CryptoStream - Initializes a CryptoStream object.

Exceptions

Exception | Condition
ArgumentNullException | Stream is Nothing -or- Transform is Nothing
ArgumentException | Mode is ReadMode and Stream is not readable. -or- Mode is WriteMode and Stream is not writable. -or- Mode is invalid.

See Also

Project CorLib Overview

Class Constructors Overview

CryptoStream


Constructors: NewCspKeyContainerInfo

NewCspKeyContainerInfo

Creates a new CspKeyContainerInfo object.

 Public Function NewCspKeyContainerInfo(
      ByVal Parameters As CspParameters ) As CspKeyContainerInfo

Parameters

Parameters
[ByVal] CspParameters. The parameters used to derive information from.

Return Values

CspKeyContainerInfo - A new CspKeyContainerInfo object.

Remarks

This object is usually created by crypto service provider. Instantiating an object directly may result in property throwing an exception when accessed.

Exceptions

Exception | Condition
ArgumentNullException | Parameters is Nothing.

See Also

Project CorLib Overview

Class Constructors Overview

CspKeyContainerInfo


Constructors: NewCspParameters

NewCspParameters

Creates a new CspParameters object.

 Public Function NewCspParameters(
      ByVal TypeIn As Long,
      Optional ByRef ProviderNameIn As String,
      Optional ByRef ContainerNameIn As String ) As CspParameters

Parameters

TypeIn
[ByVal] Long. The type code used to specify the kind of provider to create.
ProviderNameIn
[ByRef] Optional. String. The provider name.
ContainerNameIn
[ByRef] Optional. String. The provider container name.

Return Values

CspParameters - Returns a new CspParameters object with the specified parameters.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewCultureInfo

NewCultureInfo

Creates a new CultureInfo object for the specified culture.

 Public Function NewCultureInfo(
      ByRef NameOrLCID As Variant,
      Optional ByVal UseUserOverride As Boolean = True ) As CultureInfo

Parameters

NameOrLCID
[ByRef] Variant. The name or Locale ID of the culture to be created.
UseUserOverride
[ByVal] Optional. Boolean. A flag indicating if the local machine settings should be used instead of the stored setting. This only applies to the culture of the current machine.

Default: True

Return Values

CultureInfo - The newly created CultureInfo object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewCurrencies

NewCurrencies

Initializes a Currency array with elements copied from Values.

 Public Function NewCurrencies(
      ParamArray Values ( ) As Variant ) As Currency ( )

Parameters

Values
[ByRef] Variant. The values to create the array from.

Return Values

Currency() -

Remarks

The values need to be convertable to Currency or an exception will occur.

The array is zero-based.

If no values are passed in then an empty array is returned, not a null array.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewDate

NewDate

Creates a new CorDateTime object from a VB Date.

 Public Function NewDate(
      ByVal Value As Date,
      Optional ByVal Kind As DateTimeKind = UnspecifiedKind ) As CorDateTime

Parameters

Value
[ByVal] Date. The date.
Kind
[ByVal] Optional. DateTimeKind. Specifies whether the CorDateTime is a UTC, Local, or unspecified time type.

Default: UnspecifiedKind

Return Values

CorDateTime - A CorDateTime object.

Remarks

This is a short-hand method for calling CorDateTime.FromOADate(Value).

 Dim d As CorDateTime
 Set d = NewDate(#1/1/2001#)

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewDates

NewDates

Initializes a Date array with elements copied from Values.

 Public Function NewDates(
      ParamArray Values ( ) As Variant ) As Date ( )

Parameters

Values
[ByRef] Variant. The values to create the array from.

Return Values

Date() -

Remarks

The values need to be convertable to Date or an exception will occur.

The array is zero-based.

If no values are passed in then an empty array is returned, not a null array.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewDateTime

NewDateTime

Creates a new CorDateTime object set to the specified date.

 Public Function NewDateTime(
      Optional ByVal Year As Long,
      Optional ByVal Month As Long,
      Optional ByVal Day As Long,
      Optional ByVal Hour As Long,
      Optional ByVal Minute As Long,
      Optional ByVal Second As Long,
      Optional ByVal Millisecond As Long,
      Optional ByVal Calendar As Calendar,
      Optional ByVal Kind As DateTimeKind = UnspecifiedKind ) As CorDateTime

Parameters

Year
[ByVal] Optional. Long. The year (1 through 9999 or the number of years in Calendar).
Month
[ByVal] Optional. Long. The month (1 through 12 or the number of months in Calendar).
Day
[ByVal] Optional. Long. The day (1 through the number of days in Month).
Hour
[ByVal] Optional. Long. The hours (0 through 23).
Minute
[ByVal] Optional. Long. The minutes (0 through 59).
Second
[ByVal] Optional. Long. The seconds (0 through 59).
Millisecond
[ByVal] Optional. Long. The millisecond (0 through 999).
Calendar
[ByVal] Optional. Calendar. The calendar to use to create a CorDateTime for a specific culture.
Kind
[ByVal] Optional. DateTimeKind. Specifies whether the CorDateTime is a UTC, Local, or unspecified time type.

Default: UnspecifiedKind

Return Values

CorDateTime - A new CorDateTime object initialized to the specified date and time.

Remarks

The GregorianCalendar is used if Calendar is not specified.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewDayLightTime

NewDayLightTime

Creates a new DayLightTime object with the specified start and end times for daylight saving.

 Public Function NewDayLightTime(
      ByRef StartTime As Variant,
      ByRef EndTime As Variant,
      ByVal Delta As TimeSpan ) As DayLightTime

Parameters

StartTime
[ByRef] Variant. The starting of the daylight saving period.
EndTime
[ByRef] Variant. The ending of the daylight saving period.
Delta
[ByVal] TimeSpan. The time difference between daylight saving time and standard time.

Return Values

DayLightTime - A newly created DayLightTime object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewDecimals

NewDecimals

Initializes a Decimal array with elements copied from Values.

 Public Function NewDecimals(
      ParamArray Values ( ) As Variant ) As Variant ( )

Parameters

Values
[ByRef] Variant. The values to create the array from.

Return Values

Variant() -

Remarks

The values need to be convertable to a Decimal or an exception will occur.

The array is zero-based.

If no values are passed in then an empty array is returned, not a null array.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewDecoderFallbackException

NewDecoderFallbackException

Initializes a new instance of the DecoderFallbackException class. Parameters specify the error message and the inner exception that is the cause of this exception.

 Public Function NewDecoderFallbackException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As DecoderFallbackException

Parameters

Message
[ByRef] String. An error message.
InnerException
[ByVal] Optional. Exception. The exception that caused this exception.

Return Values

DecoderFallbackException - A new DecoderFallbackException instance.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewDecoderFallbackException2

NewDecoderFallbackException2

Initializes a new instance of the DecoderFallbackException class. Parameters specify the error message, the array of bytes being decoded, and the index of the byte that cannot be decoded.

 Public Function NewDecoderFallbackException2(
      ByRef Message As String,
      ByRef BytesUnknown ( ) As Byte,
      ByVal Index As Long ) As DecoderFallbackException

Parameters

Message
[ByRef] String. An error message.
BytesUnknown
[ByRef] Byte. The input byte array.
Index
[ByVal] Long. The index position in BytesUnknown of the byte that cannot be decoded.

Return Values

DecoderFallbackException - A new DecoderFallbackException instance.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewDecoderReplacementFallback

NewDecoderReplacementFallback

Initializes a new instance of the DecoderReplacementFallback class using a specified replacement string.

 Public Function NewDecoderReplacementFallback(
      ByRef Replacement As String ) As DecoderReplacementFallback

Parameters

Replacement
[ByRef] String. A string that is emitted in a decoding operation in place of an input byte sequence that cannot be decoded.

Return Values

DecoderReplacementFallback - An initialized DecoderReplacementFallback object.

Remarks

The Replacement parameter initializes the replacement string that is the value of the DecoderReplacementFallback object. A commonly used value is the Unicode "Replacement Character" (U+FFFD), which is specifically intended to replace an incoming character having a value that is unknown or unrepresentable in Unicode.

Exceptions

Exception | Condition
ArgumentException | Replacement contains an invalid surrogate pair. In other words, the surrogate pair does not consist of one high surrogate component followed by one low surrogate component.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewDecoderReplacementFallbackBuffer

NewDecoderReplacementFallbackBuffer

Initializes a new instance of the DecoderReplacementFallbackBuffer class using the value of a DecoderReplacementFallback object.

 Public Function NewDecoderReplacementFallbackBuffer(
      ByVal Fallback As DecoderReplacementFallback ) As DecoderReplacementFallbackBuffer

Parameters

Fallback
[ByVal] DecoderReplacementFallback. A DecoderReplacementFallback object that contains a replacement string.

Return Values

DecoderReplacementFallbackBuffer - An initialized DecoderReplacementFallbackBuffer object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewDictionaryEntry

NewDictionaryEntry

Creates a new DictionaryEntry object initialized with Key and Value.

 Public Function NewDictionaryEntry(
      ByRef Key As Variant,
      ByRef Value As Variant ) As DictionaryEntry

Parameters

Key
[ByRef] Variant. A value designated as the key of the pair.
Value
[ByRef] Variant. A value designated as the value of the pair.

Return Values

DictionaryEntry - A new DictionaryEntry containing a key/value pair.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewDirectoryInfo

NewDirectoryInfo

Creates a new DirectoryInfo object that describes the specified path.

 Public Function NewDirectoryInfo(
      ByRef Path As String ) As DirectoryInfo

Parameters

Path
[ByRef] String. The directory path this instance describes and manipulates.

Return Values

DirectoryInfo - The new object used to manage a directory path.

Remarks

When a DirectoryInfo object is created, there is no attempt at verifying the Path. Only when an attempt to manipulate the actual directory is the path validated.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewDirectoryNotFoundException

NewDirectoryNotFoundException

Creates a new DirectoryNotFoundException object with the specified message and optional exception.

 Public Function NewDirectoryNotFoundException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As DirectoryNotFoundException

Parameters

Message
[ByRef] String. A human-readable message describing the exception.
InnerException
[ByVal] Optional. Exception. The exception that caused this exception to be thrown.

Return Values

DirectoryNotFoundException - A new DirectoryNotFoundException object with the specified message and optional exception.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewDivideByZeroException

NewDivideByZeroException

Initializes a new instance of the DivideByZeroException class with a specified error message and a reference to the inner exception that is the cause of this exception.

 Public Function NewDivideByZeroException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As DivideByZeroException

Parameters

Message
[ByRef] String. The error message that explains the reason for the exception.
InnerException
[ByVal] Optional. Exception. The exception that is the cause of the current exception.

Return Values

DivideByZeroException - A new instance of DivideByZeroException.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewDoubles

NewDoubles

Initializes a Double array with elements copied from Values.

 Public Function NewDoubles(
      ParamArray Values ( ) As Variant ) As Double ( )

Parameters

Values
[ByRef] Variant. The values to create the array from.

Return Values

Double() -

Remarks

The values need to be convertable to a Double or an exception will occur.

The array is zero-based.

If no values are passed in then an empty array is returned, not a null array.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewDriveInfo

NewDriveInfo

Initializes a new DriveInfo object used to inspect a drives information.

 Public Function NewDriveInfo(
      ByRef Name As String ) As DriveInfo

Parameters

Name
[ByRef] String. A valid drive path or drive letter. This can be either uppercase or lowercase, a' to 'z'.

Return Values

DriveInfo - A DriveInfo object representing the specified drive.

Remarks

Use this class to obtain information on drives. The drive name must be either an uppercase or lowercase letter from a' to 'z'. You cannot use this method to obtain information on drive names that are null or use UNC (\\server\share) paths.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewDriveNotFoundException

NewDriveNotFoundException

Initializes a new instance of the DriveNotFoundException class with the specified error message and a reference to the inner exception that is the cause of this exception.

 Public Function NewDriveNotFoundException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As DriveNotFoundException

Parameters

Message
[ByRef] String. The error message that explains the reason for the exception.
InnerException
[ByVal] Optional. Exception. The exception that is the cause of the current exception. If the InnerException parameter is not Nothing, the current exception is raised in a Catch block that handles the inner exception.

Return Values

DriveNotFoundException -

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewDSACryptoServiceProvider

NewDSACryptoServiceProvider

Creates a new DSACryptoServiceProvider object.

 Public Function NewDSACryptoServiceProvider(
      Optional ByVal KeySize As Long,
      Optional ByVal Parameters As CspParameters ) As DSACryptoServiceProvider

Parameters

KeySize
[ByVal] Optional. Long. The key size in bits. This can be from 384bits to 1024bits.
Parameters
[ByVal] Optional. CspParameters. A CspParameters object used to specify custom service provider options.

Return Values

DSACryptoServiceProvider - A new DSACryptoServiceProvider object.

See Also

Project CorLib Overview

Class Constructors Overview

DSACryptoServiceProvider


Constructors: NewEncoderFallbackException

NewEncoderFallbackException

Initializes a new instance of the EncoderFallbackException class. Parameters specify the error message and the inner exception that is the cause of this exception.

 Public Function NewEncoderFallbackException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As EncoderFallbackException

Parameters

Message
[ByRef] String. An error message.
InnerException
[ByVal] Optional. Exception. The exception that caused this exception.

Return Values

EncoderFallbackException - A new instance of the EncoderFallbackException class.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewEncoderFallbackException2

NewEncoderFallbackException2

Initializes a new instance of the EncoderFallbackException class. Parameters specify the error message, unknown character, and index.

 Public Function NewEncoderFallbackException2(
      ByRef Message As String,
      ByVal CharUnknown As Long,
      ByVal Index As Long ) As EncoderFallbackException

Parameters

Message
[ByRef] String. An error message.
CharUnknown
[ByVal] Long. The unknown character that caused the exception.
Index
[ByVal] Long. The index the unknown character was encountered.

Return Values

EncoderFallbackException - A new instance of the EncoderFallbackException class.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewEncoderFallbackException3

NewEncoderFallbackException3

Initializes a new instance of the EncoderFallbackException class. Parameters specify the error message, high surrogate, low surrogate, and Index.

 Public Function NewEncoderFallbackException3(
      ByRef Message As String,
      ByVal CharUnknownHigh As Long,
      ByVal CharUnknownLow As Long,
      ByVal Index As Long ) As EncoderFallbackException

Parameters

Message
[ByRef] String. An error message.
CharUnknownHigh
[ByVal] Long. The high surrogate of the unknown character.
CharUnknownLow
[ByVal] Long. The low surrogate of the unknown character.
Index
[ByVal] Long. The index the unknown character was encountered.

Return Values

EncoderFallbackException - A new instance of the EncoderFallbackException class.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewEncoderReplacementFallback

NewEncoderReplacementFallback

Initializes a new instance of the EncoderReplacementFallback class using a specified replacement string.

 Public Function NewEncoderReplacementFallback(
      ByRef Replacement As String ) As EncoderReplacementFallback

Parameters

Replacement
[ByRef] String. A string that is converted in an encoding operation in place of an input character that cannot be encoded.

Return Values

EncoderReplacementFallback -

Remarks

The replacement parameter initializes the replacement string that is the value of this EncoderReplacementFallback object. Your application must provide a replacement value that contains only characters that can be encoded in the target encoding. Otherwise, a recursive fallback results, causing an ArgumentExceptionArgumentException. For example, the fallback provided for an ASCIIEncoding object cannot include the character "¿" (U+00BF) because that character is itself not a valid ASCII character.

As a result of this, U+FFFD, which is a good choice for a fallback string for DecoderExceptionFallback, is not generally a good choice for this class. Also, the null character (U+0000) cannot be used in the fallback string.

Exceptions

Exception | Condition
ArgumentException | Replacement contains an invalid surrogate pair. In other words, the surrogate does not consist of one high surrogate component followed by one low surrogate component.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewEncoderReplacementFallbackBuffer

NewEncoderReplacementFallbackBuffer

Initializes a new instance of the EncoderReplacementFallbackBuffer class using the value of a EncoderReplacementFallback object.

 Public Function NewEncoderReplacementFallbackBuffer(
      ByVal Fallback As EncoderReplacementFallback ) As EncoderReplacementFallbackBuffer

Parameters

Fallback
[ByVal] EncoderReplacementFallback. A EncoderReplacementFallback object.

Return Values

EncoderReplacementFallbackBuffer - A new instance of the EncoderReplacementFallbackBuffer class using the value of a EncoderReplacementFallback object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewEndOfStreamException

NewEndOfStreamException

Returns a new EndOfStreamException with the specified message and optional exception.

 Public Function NewEndOfStreamException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As EndOfStreamException

Parameters

Message
[ByRef] String. A human-readable message that describes the cause of the exception.
InnerException
[ByVal] Optional. Exception. The exception that caused this exception.

Return Values

EndOfStreamException - The new EndOfStreamException object.

Remarks

This exception can be thrown whenever an attempt to read passed the end of a stream is attempted. Such classes as BinaryReader may throw this exception if necessary.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewEnumeratorBase

NewEnumeratorBase

Initializes a new instance of EnumeratorBase.

 Public Function NewEnumeratorBase(
      ByVal StartIndex As Long,
      ByVal Length As Long,
      Optional ByVal Collection As IVersionable ) As EnumeratorBase

Parameters

StartIndex
[ByVal] Long. The starting position within a list of items to be enumerated.
Length
[ByVal] Long. The number of items to be enumerated from the starting position.
Collection
[ByVal] Optional. IVersionable. An object that implements IVersionable to track version changes of a collection.

Return Values

EnumeratorBase - A base class used to manage the iteration of an index.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewException

NewException

Creates a new Exception object.

 Public Function NewException(
      ByRef Message As String,
      Optional ByVal ErrorNumber As Long = vbInvalidProcedureCall,
      Optional ByVal InnerException As Exception ) As Exception

Parameters

Message
[ByRef] String. A human-readable message explaining the exception.
ErrorNumber
[ByVal] Optional. Long. Represents a VBA specific error number.

Default: vbInvalidProcedureCall

InnerException
[ByVal] Optional. Exception. An exception that caused this exception.

Return Values

Exception - The fully created Exception object.

Remarks

The default error number is 5-Invalid Procedure Call.

See Also

Project CorLib Overview

Class Constructors Overview

Exception


Constructors: NewExceptionBase

NewExceptionBase

Creates a new ExceptionBase object that can be contained within an exception class.

 Public Function NewExceptionBase(
      ByVal Subclass As Exception,
      Optional ByVal AppObject As Object ) As ExceptionBase

Parameters

Subclass
[ByVal] Exception. The containing exception class that will contain this object instance.
AppObject
[ByVal] Optional. Object. The App object of the application that contains the exception class.

Return Values

ExceptionBase - A new base class used for default handling of exception routines.

Remarks

Most exception classes simply contain this information to be retrieved for viewing. Few exception classes have additional requirements. This class can be used to handle the default set of information for an exception class. By containing this class inside the exception class, the exception class can delegate calls to this class for standard handling.

If additional values need to be maintained, then this class also supports the ability to set and get additional values using a string name as the key. TheArgumentException class uses this to hold the name of the parameter that caused the exception.

This class is persistable and will also attempt to persist the custom values that have been added to it. If the persistence fails, then an error will occur.

See Also

Project CorLib Overview

Class Constructors Overview

ExceptionBase


Constructors: NewExternalException

NewExternalException

Creates a new ExternalException object.

 Public Function NewExternalException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As ExternalException

Parameters

Message
[ByRef] String. A user-defined message specific to the exception.
InnerException
[ByVal] Optional. Exception. A reference to an exception that caused this exception.

Return Values

ExternalException - A new ExternalException object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewFileInfo

NewFileInfo

Creates a new FileInfo object used to describe and manage a file.

 Public Function NewFileInfo(
      ByRef FileName As String ) As FileInfo

Parameters

FileName
[ByRef] String. The name of the file to manage (may need path information as well.)

Return Values

FileInfo - The FileInfo object to manage a file.

Remarks

When a FileInfo object is first created, it does not verify the existence of the actual file. Once access to the file through the object is attempted, the file will be verified at that time. Portions of the object that doesnt directly interact with the file will not verify the existence of the file.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewFileNotFoundException

NewFileNotFoundException

Creates a new FileNotFoundException with the specified FileName, Message, and InnerException.

 Public Function NewFileNotFoundException(
      Optional ByRef FileName As String,
      Optional ByRef Message As String,
      Optional ByVal InnerException As Exception ) As FileNotFoundException

Parameters

FileName
[ByRef] Optional. String. The filename that caused the exception.
Message
[ByRef] Optional. String. A human-readable error message.
InnerException
[ByVal] Optional. Exception. The exception that caused this exception.

Return Values

FileNotFoundException - A new FileNotFoundException with the specified values.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewFileStream

NewFileStream

Returns a new FileStream to access an underyling file.

 Public Function NewFileStream(
      ByRef Path As String,
      ByVal Mode As FileMode,
      Optional ByVal Access As FileAccess,
      Optional ByVal Share As FileShare = FileShare. ReadShare,
      Optional ByVal BufferSize As Long = 4096,
      Optional ByVal UseAsync As Boolean = False ) As FileStream

Parameters

Path
[ByRef] String. The name of the file to manipulate.
Mode
[ByVal] FileMode. The method used to create or open a file.
Access
[ByVal] Optional. FileAccess. The access allowed to the file for this FileStream.
Share
[ByVal] Optional. FileShare. The access allowed to the file for other processes.

Default: FileShare . ReadShare

BufferSize
[ByVal] Optional. Long. The number of bytes used to cache reads and writes from the physical file.

Default: 4096

UseAsync
[ByVal] Optional. Boolean. Flag used to open the file in asyncronous mode (currently not supported).

Default: False

Return Values

FileStream - The new FileStream opened to the specified file.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewFileStreamWithHandle

NewFileStreamWithHandle

Returns a new FileStream to access a file other than that on disk, such as pipes.

 Public Function NewFileStreamWithHandle(
      ByVal Handle As SafeFileHandle,
      ByVal Access As FileAccess,
      Optional ByVal BufferSize As Long = 4096 ) As FileStream

Parameters

Handle
[ByVal] SafeFileHandle. A SafeFileHandle to the already opened filed.
Access
[ByVal] FileAccess. The access allowed to the file for this FileStream.
BufferSize
[ByVal] Optional. Long. The number of bytes used to cache reads and writes from the physical file.

Default: 4096

Return Values

FileStream - The new FileStream opened to the specified file.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewFormatException

NewFormatException

Creates a new FormatException object.

 Public Function NewFormatException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As FormatException

Parameters

Message
[ByRef] String. A human-readable message explaining the exception.
InnerException
[ByVal] Optional. Exception. An exception that caused this exception.

Return Values

FormatException - A fully created FormatException object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewFromBase64Transform

NewFromBase64Transform

Creates a new FromBase64Transform object used to convert base64 characters to plain text.

 Public Function NewFromBase64Transform(
      ByVal WhiteSpaces As FromBase64TransformMode ) As FromBase64Transform

Parameters

WhiteSpaces
[ByVal] FromBase64TransformMode. Determines how whitespace should be handled during the transformation process.

Return Values

FromBase64Transform - A new FromBase64Transfrom object.

See Also

Project CorLib Overview

Class Constructors Overview

FromBase64Transform


Constructors: NewGregorianCalendar

NewGregorianCalendar

Creates a new instance of the GregorianCalendar class.

 Public Function NewGregorianCalendar(
      ByVal CalendarType As GregorianCalendarTypes ) As GregorianCalendar

Parameters

CalendarType
[ByVal] GregorianCalendarTypes. The language type the calendar is set to.

Return Values

GregorianCalendar - A new instance of a GregorianCalendar class.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | CalendarType is not a member of the GregorianCalendarTypes enumeration.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewGuid

NewGuid

Initializes a new instance of the Guid object by using the specified array of bytes, string, or memory pointer.

 Public Function NewGuid(
      ByRef Value As Variant ) As Guid

Parameters

Value
[ByRef] Variant. An array of bytes, string, or memory pointer.

Return Values

Guid - A Guid initialized with values from Value.

Remarks

A new Guid can be initialized from a specified array of bytes, string, or memory pointer.

Data Type | Description
String

A string that contains a GUID in one of the following formats ("d" represents a hexadecimal digit whose case is ignored):

32 contiguous Digits:

dddddddddddddddddddddddddddddddd

-or-

Groups of 8, 4, 4, 4, and 12 digits with hyphens between the groups. The entire GUID can optionally be enclosed in matching braces or parentheses:

dddddddd -dddd - dddd - dddd - dddddddddddd

-or-

{dddddddd-dddd-dddd-dddd-dddddddddddd}

-or-

(dddddddd-dddd-dddd-dddd-dddddddddddd)

-or-

Groups of 8, 4, and 4 digits, and a subset of eight groups of 2 digits, with each group prefixed by "0x" or "0X", and separated by commas. The entire GUID, as well as the subset, is enclosed in matching braces:

{0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}

All braces, commas, and "0x" prefixes are required. All embedded spaces are ignored. All leading zeros in a group are ignored.
Byte Array | A 16-element byte array containing values with which to initialize the GUID.
Long | A pointer to a memory location to read 16 consecutive bytes with which to initialize the GUID.

Exceptions

Exception | Condition
ArgumentNullException | byte array is null.
ArgumentException | byte array is not 16 bytes long.
FormatException | string format is invalid.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewHashAlgorithmBase

NewHashAlgorithmBase

Creates a HashAlgorithmBase object used by hash algorithms.

 Public Function NewHashAlgorithmBase(
      ByVal Callback As IHashAlgorithm,
      Optional ByVal KeepWeakReference As Boolean,
      Optional ByVal UseBuffer As Boolean,
      Optional ByVal BlockSize As Long ) As HashAlgorithmBase

Parameters

Callback
[ByVal] IHashAlgorithm. Used to call back into the specifics of an algorithm implementation.
KeepWeakReference
[ByVal] Optional. Boolean. Indicates if the base class should maintain a weak reference to the Callback object to prevent a circular reference from occuring if the Callback object is the same object as the one instantiating this instance.
UseBuffer
[ByVal] Optional. Boolean. Indicates if the internal buffering mechanism in the base class should be used, or if all data should be passed to the Callback object to allow custom buffering.
BlockSize
[ByVal] Optional. Long. The size of the byte block that is processed at a time by the specific algorithm using this base class. This is to help with the buffering.

Return Values

HashAlgorithmBase - A new HashAlgorithmBase object.

Remarks

This base class can handle most hash algorithm implementation requirement except for the specifics of a hash algorithm. That is where the Callback is used.

See Also

Project CorLib Overview

Class Constructors Overview

HashAlgorithmBase


Constructors: NewHashtable

NewHashtable

Initializes a new instance of the Hashtable class by copying the elements from the specified dictionary to the new Hashtable object. The new Hashtable object has an initial capacity equal to the number of elements copied, and uses the specified load factor and IEqualityComparer object.

 Public Function NewHashtable(
      Optional ByVal d As IDictionary,
      Optional ByVal LoadFactor As Single = 1 !,
      Optional ByVal EqualityComparer As IEqualityComparer ) As Hashtable

Parameters

d
[ByVal] Optional. IDictionary. The IDictionary object containing keys and values to be added to the Hashtable.
LoadFactor
[ByVal] Optional. Single. A number in the range from 0.1 through 1.0 that is multiplied by the default value which provides the best performance. The result is the maximum ratio of elements to buckets.

Default: 1 !

EqualityComparer
[ByVal] Optional. IEqualityComparer. The IEqualityComparer object that defines the hash code provider and the comparer to use with the Hashtable object.

Return Values

Hashtable - A new Hashtable object with the specified parameters.

See Also

Project CorLib Overview

Class Constructors Overview

IEqualityComparer

Hashtable


Constructors: NewHashtable2

NewHashtable2

Initializes a new, empty instance of the Hashtable class using the specified initial capacity, load factor, and IEqualityComparer object.

 Public Function NewHashtable2(
      ByVal Capacity As Long,
      Optional ByVal LoadFactor As Single = 1 !,
      Optional ByVal EqualityComparer As IEqualityComparer ) As Hashtable

Parameters

Capacity
[ByVal] Long. The approximate number of elements that the Hashtable object can initially contain.
LoadFactor
[ByVal] Optional. Single. A number in the range from 0.1 through 1.0 that is multiplied by the default value which provides the best performance. The result is the maximum ratio of elements to buckets.

Default: 1 !

EqualityComparer
[ByVal] Optional. IEqualityComparer. The IEqualityComparer object that defines the hash code provider and the comparer to use with the Hashtable object.

Return Values

Hashtable - A new Hashtable object with the specified parameters.

See Also

Project CorLib Overview

Class Constructors Overview

IEqualityComparer

Hashtable


Constructors: NewHMACBase

NewHMACBase

Creates a HMACBase object that can be used as a base implementation of an HMAC class.

 Public Function NewHMACBase(
      ByVal HashAlgorithm As HashAlgorithm,
      ByVal KeySize As Long,
      Optional ByRef HashName As String,
      Optional ByRef Key As Variant ) As HMACBase

Parameters

HashAlgorithm
[ByVal] HashAlgorithm. An instance of an algorithm to be used for Hash Message Authentication Code.
KeySize
[ByVal] Long. The size of the key to be used for signing the message.
HashName
[ByRef] Optional. String. The name of the hash being used.
Key
[ByRef] Optional. Variant. The key used to sign the message.

Return Values

HMACBase - A new HMACBase object.

Remarks

This class implements many of the common routines used by HMAC classes.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewHMACMD5

NewHMACMD5

Creates a new HMACMD5 object.

 Public Function NewHMACMD5(
      ByRef Key ( ) As Byte ) As HMACMD5

Parameters

Key
[ByRef] Byte. The key used to sign the message.

Return Values

HMACMD5 - A new HMACMD5 object.

See Also

Project CorLib Overview

Class Constructors Overview

HMACMD5


Constructors: NewHMACRIPEMD160

NewHMACRIPEMD160

Creates a new HMACRIPEMD160 object.

 Public Function NewHMACRIPEMD160(
      ByRef Key ( ) As Byte ) As HMACRIPEMD160

Parameters

Key
[ByRef] Byte. The key used to sign the message.

Return Values

HMACRIPEMD160 - A new HMACRIPEMD160 object.

See Also

Project CorLib Overview

Class Constructors Overview

HMACRIPEMD160


Constructors: NewHMACSHA1

NewHMACSHA1

Creates a new HMACSHA1 object.

 Public Function NewHMACSHA1(
      ByRef Key ( ) As Byte,
      Optional ByVal UseManagedSha1 As Boolean = False ) As HMACSHA1

Parameters

Key
[ByRef] Byte. The key used to sign the message.
UseManagedSha1
[ByVal] Optional. Boolean. Indicates if the SHA1Managed or SHA1CryptoServiceProvider should be used.

Default: False

Return Values

HMACSHA1 - A new HMACSHA1 object.

See Also

Project CorLib Overview

Class Constructors Overview

HMACSHA1


Constructors: NewHMACSHA256

NewHMACSHA256

Creates a new HMACSHA256 object.

 Public Function NewHMACSHA256(
      ByRef Key ( ) As Byte ) As HMACSHA256

Parameters

Key
[ByRef] Byte. The key used to sign the message.

Return Values

HMACSHA256 - A new HMACSHA256 object.

See Also

Project CorLib Overview

Class Constructors Overview

HMACSHA256


Constructors: NewHMACSHA384

NewHMACSHA384

Creates a new HMACSHA384 object.

 Public Function NewHMACSHA384(
      ByRef Key ( ) As Byte ) As HMACSHA384

Parameters

Key
[ByRef] Byte. The key used to sign the message.

Return Values

HMACSHA384 - A new HMACSHA384 object.

See Also

Project CorLib Overview

Class Constructors Overview

HMACSHA384


Constructors: NewHMACSHA512

NewHMACSHA512

Creates a new HMACSHA512 object.

 Public Function NewHMACSHA512(
      ByRef Key ( ) As Byte ) As HMACSHA512

Parameters

Key
[ByRef] Byte. The key used to sign the message.

Return Values

HMACSHA512 - A new HMACSHA512 object.

See Also

Project CorLib Overview

Class Constructors Overview

HMACSHA512


Constructors: NewIndexOutOfRangeException

NewIndexOutOfRangeException

Creates a new IndexOutOfRangeException object.

 Public Function NewIndexOutOfRangeException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As IndexOutOfRangeException

Parameters

Message
[ByRef] String. A human-readable message explaining the exception.
InnerException
[ByVal] Optional. Exception. An exception that caused this exception.

Return Values

IndexOutOfRangeException - A fully created IndexOutOfRangeException object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewIniFile

NewIniFile

Initializes a new IniFile to manage an INI file.

 Public Function NewIniFile(
      ByRef FileName As String ) As IniFile

Parameters

FileName
[ByRef] String. The INI filename.

Return Values

IniFile - A new IniFile to manage an INI file.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewIniResourceWriter

NewIniResourceWriter

Initializes a new instance of IniResourceWriter with specified FileName and Section.

 Public Function NewIniResourceWriter(
      ByRef FileName As String,
      ByRef Section As String ) As IniResourceWriter

Parameters

FileName
[ByRef] String. The name of the ini file to be written to.
Section
[ByRef] String. The section within the ini file to be written to.

Return Values

 IniResourceWriter - A new instance of IniResourceWriter.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewInt64

NewInt64

Returns an initialized instance of Int64.

 Public Function NewInt64(
      ByVal LowPart As Long,
      ByVal HighPart As Long ) As Int64

Parameters

LowPart
[ByVal] Long. The least significant 32-bits of the integer value.
HighPart
[ByVal] Long. The most significant 32-bits of the integer value.

Return Values

Int64 - An Int64 integer value.

Remarks

To convert a value to an Int64 use the CInt64 conversion method.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewInt64s

NewInt64s

Initializes an Int64 array with elements copied from Values.

 Public Function NewInt64s(
      ParamArray Values ( ) As Variant ) As Int64 ( )

Parameters

Values
[ByRef] Variant. The values to create the array from.

Return Values

Int64() -

Remarks

The values need to be convertable to a Int64 or an exception will occur.

The array is zero-based.

If no values are passed in then an empty array is returned, not a null array.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewIntegers

NewIntegers

Initializes an Integer array with elements copied from Values.

 Public Function NewIntegers(
      ParamArray Values ( ) As Variant ) As Integer ( )

Parameters

Values
[ByRef] Variant. The values to create the array from.

Return Values

Integer() -

Remarks

The values need to be convertable to an Integer or an exception will occur.

The array is zero-based.

If no values are passed in then an empty array is returned, not a null array.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewInvalidCastException

NewInvalidCastException

Creates a new InvalidCaseException object.

 Public Function NewInvalidCastException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As InvalidCastException

Parameters

Message
[ByRef] String. A human-readable message explaining the exception.
InnerException
[ByVal] Optional. Exception. An exception that caused this exception.

Return Values

InvalidCastException - A fully created InvalidCastException object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewInvalidOperationException

NewInvalidOperationException

Creates a new InvalidOperationException object.

 Public Function NewInvalidOperationException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As InvalidOperationException

Parameters

Message
[ByRef] String. A human-readable message explaining the exception.
InnerException
[ByVal] Optional. Exception. An exception that caused this exception.

Return Values

InvalidOperationException - A fully created InvalidOperationException object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewIOException

NewIOException

Creates a new IOException object with the specified Message, HResult, and InnerException.

 Public Function NewIOException(
      ByRef Message As String,
      Optional ByVal HResult As Long = COR_E_IO,
      Optional ByVal ErrorCode As Long = vbDeviceIOError,
      Optional ByVal InnerException As Exception ) As IOException

Parameters

Message
[ByRef] String. A human-readable error message.
HResult
[ByVal] Optional. Long. The underlying error code.

Default: COR_E_IO

ErrorCode
[ByVal] Optional. Long. The VB error number.

Default: vbDeviceIOError

InnerException
[ByVal] Optional. Exception. The exception that caused this exception.

Return Values

IOException - A new IOException object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewKeySizes

NewKeySizes

Creates a new KeySizes object with the MinSize, MaxSize, and SkipSize properties defined.

 Public Function NewKeySizes(
      ByVal MinSize As Long,
      ByVal MaxSize As Long,
      ByVal SkipSize As Long ) As KeySizes

Parameters

MinSize
[ByVal] Long. The smallest key size defined by this KeySizes instance.
MaxSize
[ByVal] Long. The largest key size defined by this KeySizes instance.
SkipSize
[ByVal] Long. The step size from MinSize to MaxSize of legal key sizes between the smallest and largest legal key sizes in this instance.

Return Values

KeySizes - A new KeySizes object with the MinSize, MaxSize, and SkipSize properties defined.

Remarks

A KeySizes object represents a set of legal key sizes. It defines all the possible legal key sizes by defining the smallest and largest key sizes allows, then defining a step size used to calculate the additional legal key sizes between the smallest and largest key sizes.

If the smallest key size is 64 and the largest key size is 128 and a skip size of 32 is defined, then all possible legal key sizes are from 64 to 128 in increments of 32. In this case, the valid key sizes are 64, 96 and 128.

See Also

Project CorLib Overview

Class Constructors Overview

KeySizes


Constructors: NewLongs

NewLongs

Initializes a Long array with elements copied from Values.

 Public Function NewLongs(
      ParamArray Values ( ) As Variant ) As Long ( )

Parameters

Values
[ByRef] Variant. The values to create the array from.

Return Values

Long() -

Remarks

The values need to be convertable to a Long or an exception will occur.

The array is zero-based.

If no values are passed in then an empty array is returned, not a null array.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewMACTripleDES

NewMACTripleDES

Creates a new MACTripleDES object.

 Public Function NewMACTripleDES(
      ByRef RgbKey ( ) As Byte,
      Optional ByRef StrTripleDES As String ) As MACTripleDES

Parameters

RgbKey
[ByRef] Byte. The key to be used by the implementation of the TripleDES algorithm.
StrTripleDES
[ByRef] Optional. String. The name of the TripleDES implementation to be used. The default is "3DES".

Return Values

MACTripleDES - A new MACTripleDES object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewMemoryStream

NewMemoryStream

Initializes a new instance of the MemoryStream class based on the specified region of a byte array, with the CanWrite property set as specified.

 Public Function NewMemoryStream(
      ByRef Buffer ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant,
      Optional ByVal Writable As Boolean = True,
      Optional ByVal Mode As BufferMode = ShareMode ) As MemoryStream

Parameters

Buffer
[ByRef] Byte. The array of bytes from which to create this stream.
Index
[ByRef] Optional. Variant. The index in Buffer at which the stream begins. The default is lower bound of Buffer.
Count
[ByRef] Optional. Variant. The length of the stream in bytes. The default is Buffer length.
Writable
[ByVal] Optional. Boolean. The setting of the CanWrite property, which determines whether the stream supports writing.

Default: True

Mode
[ByVal] Optional. BufferMode. A BufferMode value specifying how Buffer is handled internally.

Default: ShareMode

Return Values

MemoryStream - The newly created MemoryStream containing the supplied byte buffer.

Remarks

The CanRead and CanSeek properties are both set to True. Capacity is set to Count.

The length of the stream cannot be set to a value greater than the initial length of the specified byte array; however, the stream can be truncated (see SetLength).

Exceptions

Exception | Condition
ArgumentNullException | Buffer is uninitialized.
ArgumentOutOfRangeException | Index or Count are negative.
ArgumentException | The buffer length minus Index is less than Count.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewNotSupportedException

NewNotSupportedException

Creates a new NotSupportedException object.

 Public Function NewNotSupportedException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As NotSupportedException

Parameters

Message
[ByRef] String. A human-readable message explaining the exception.
InnerException
[ByVal] Optional. Exception. An exception that caused this exception.

Return Values

NotSupportedException - A fully created NotSupportedException object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewObjectDisposedException

NewObjectDisposedException

Returns a new ObjectDisposedException.

 Public Function NewObjectDisposedException(
      ByRef ObjectName As String,
      Optional ByRef Message As String ) As ObjectDisposedException

Parameters

ObjectName
[ByRef] String. The name of the object that has been disposed of.
Message
[ByRef] Optional. String. A human-readable message.

Return Values

ObjectDisposedException - The newly created ObjectDisposedException object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewOperatingSystem

NewOperatingSystem

Returns a new OperatingSystem object with the specified Platform and Version.

 Public Function NewOperatingSystem(
      ByVal Platform As PlatformID,
      ByVal Version As Version,
      Optional ByRef ServicePack As String ) As OperatingSystem

Parameters

Platform
[ByVal] PlatformID. The platform the OS is.
Version
[ByVal] Version. The version of the specified platform.
ServicePack
[ByRef] Optional. String. A message describing a service pack.

Return Values

OperatingSystem - The new OperatingSystem object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewOverflowException

NewOverflowException

Returns a new OverflowException with the specified message and exception.

 Public Function NewOverflowException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As OverflowException

Parameters

Message
[ByRef] String. A human-readable message describing the exception.
InnerException
[ByVal] Optional. Exception. The exception that caused this exception.

Return Values

OverflowException - This exception is thrown when a value may not fit into an existing datatype.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewPathTooLongException

NewPathTooLongException

Returns a new PathTooLongException object.

 Public Function NewPathTooLongException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As PathTooLongException

Parameters

Message
[ByRef] String. A human-readable message.
InnerException
[ByVal] Optional. Exception. The exception that caused this exception.

Return Values

PathTooLongException - The new PathTooLongException.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewPictureResourceGroup

NewPictureResourceGroup

Creates a picture group object used to contain information about resources that are grouped together.

 Public Function NewPictureResourceGroup(
      ByVal GroupType As PictureGroupTypes ) As PictureResourceGroup

Parameters

GroupType
[ByVal] PictureGroupTypes. The type of resource the group represents.

Return Values

PictureResourceGroup - A group container for a specific resource type.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewPictureResourceInfo

NewPictureResourceInfo

Initializes a new instance of the PictureResourceInfo class with the specified ResourceId and Resource.

 Public Function NewPictureResourceInfo(
      ByVal ResourceId As Long,
      ByVal Resource As IPicture ) As PictureResourceInfo

Parameters

ResourceId
[ByVal] Long. The resource number used to identify this resource.
Resource
[ByVal] IPicture. The resource to be contained in the info.

Return Values

PictureResourceInfo - A new instance of the PictureResourceInfo.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewPlatformNotSupportedException

NewPlatformNotSupportedException

Returns a new PlatformNotSupportedException with the specified Message and InnerException.

 Public Function NewPlatformNotSupportedException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As PlatformNotSupportedException

Parameters

Message
[ByRef] String. A human-readable error message.
InnerException
[ByVal] Optional. Exception. The exception that caused this exception.

Return Values

PlatformNotSupportedException - The new PlatformNotSupportedException object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewQueue

NewQueue

Creates a new Queue initialized with the elements in the collection.

 Public Function NewQueue(
      ByRef Source As Variant ) As Queue

Parameters

Source
[ByRef] Variant. The elements to place in the queue upon creation.

Return Values

Queue - A Queue object with the elements placed in it.

Remarks

The Source parameter can be a VBA.Collection, ICollection object, or an array.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewRandom

NewRandom

Creates a new Random object initialized with the specified seed.

 Public Function NewRandom(
      ByVal seed As Long ) As Random

Parameters

seed
[ByVal] Long. The value used to initialize the random number generator with.

Return Values

Random - A new Random object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewRankException

NewRankException

Creates a new RankException object.

 Public Function NewRankException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As RankException

Parameters

Message
[ByRef] String. A human-readable message explaining the exception.
InnerException
[ByVal] Optional. Exception. An exception that caused this exception.

Return Values

RankException - A fully created RankException object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewResourceKey

NewResourceKey

Creates a new ResourceKey object used to uniquely identify a resource.

 Public Function NewResourceKey(
      ByRef ResourceName As Variant,
      ByRef ResourceType As Variant,
      ByVal LanguageID As Long ) As ResourceKey

Parameters

ResourceName
[ByRef] Variant. The name of the resource being identified.
ResourceType
[ByRef] Variant. The type of resource being identified.
LanguageID
[ByVal] Long. The Locale ID associated with the resource.

Return Values

ResourceKey - An object that can be used to uniquely identify a resource.

Remarks

ResourceName and ResourceType can be a string or number.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewResourceManager

NewResourceManager

Creates a new ResourceManager for a specified .RES file.

 Public Function NewResourceManager(
      ByRef Source As String ) As ResourceManager

Parameters

Source
[ByRef] String. The file name of the .RES file.

Return Values

ResourceManager - A new ResourceManager object.

Remarks

If a set of resource files is to be loaded into a resource manager then use the ResourceManager.CreateFileBasedResourceManager method.

See Also

Project CorLib Overview

Class Constructors Overview

ResourceManager

ResourceManagerStatic


Constructors: NewResourceReader

NewResourceReader

Creates a new ResourceReader object.

 Public Function NewResourceReader(
      ByRef Source As Variant ) As ResourceReader

Parameters

Source
[ByRef] Variant. The file name or stream to read from.

Return Values

ResourceReader - A ResourceReader used to enumerate resources.

Remarks

The ResourceReader reads the resources from a source with the same format as a .RES resource file.

Source should be either a file name or a Stream to a set of resources in a .RES resource file.

To read resources from a DLL or EXE use NewWinResourceReader.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewResourceSet

NewResourceSet

Creates a new ResourceSet for a specific culture.

 Public Function NewResourceSet(
      ByRef CultureID As Variant,
      ByRef Source As Variant ) As ResourceSet

Parameters

CultureID
[ByRef] Variant. The specific culture to retrieve resources for.
Source
[ByRef] Variant. A .RES filename, IResourceReader, or Stream object.

Return Values

ResourceSet - A new ResourceSet object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewResourceWriter

NewResourceWriter

Creates a new ResourceWriter object.

 Public Function NewResourceWriter(
      ByRef Source As Variant ) As ResourceWriter

Parameters

Source
[ByRef] Variant. A file name or stream to write to.

Return Values

ResourceWriter - A ResourceWriter used to write to a resource file.

Remarks

The ResourceWriter writes resources to a target in the same format as a .RES resource file.

Source should be either a file name or a Stream to a set of resources in a .RES resource file.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewRfc2898DeriveBytes

NewRfc2898DeriveBytes

Initializes a new instance of the Rfc2898DeriveBytes class using a password, a salt or salt size, and number of iterations to derive the key.

 Public Function NewRfc2898DeriveBytes(
      ByRef Password As Variant,
      ByRef Salt As Variant,
      Optional ByVal Iterations As Long = 1000 ) As Rfc2898DeriveBytes

Parameters

Password
[ByRef] Variant. The password used to derive the key. This can be a String or a Byte array.
Salt
[ByRef] Variant. The key salt used to derive the key. This can be a Byte array or a numeric value indicating the size of the salt to be generated.
Iterations
[ByVal] Optional. Long. The number of iterations for the operation.

Default: 1000

Return Values

Rfc2898DeriveBytes - A new instance of the Rfc2898DeriveBytes class.

Remarks

The salt size must be 8 bytes or larger and the iteration count must be greater than zero. The minimum recommended number of iterations is 1000.

RFC 2898 includes methods for creating a key and initialization vector (IV) from a password and salt. You can use PBKDF2, a password-based key derivation function, to derive keys using a pseudo-random function that allows keys of virtually unlimited length to be generated. The Rfc2898DeriveBytes class can be used to produce a derived key from a base key and other parameters. In a password-based key derivation function, the base key is a password and the other parameters are a salt value and an iteration count.

Exceptions

Exception | Condition
ArgumentException | The specified salt size is smaller than 8 bytes or the iteration count is less than 1.
ArgumentNullException | The password or salt is an unitialized array.

Examples

The following code example uses the Rfc2898DeriveBytes class to create two identical keys for the TripleDES class. It then encrypts and decrypts some data using the keys.

Public Sub Main()
    Const Pwd1 As String = "Simple Password"
    Dim Salt1(8) As Byte
    Dim RngCsp As New RNGCryptoServiceProvider

    RngCsp.GetBytes Salt1

    ' Data1 can be a string or contents of a file.
    Const Data1 As String = "Some test data"

    ' The default iteration count is 1000 so the two methods use the same iteration count.
    Const MyIterations As Long = 1000

    On Error GoTo Catch

    Dim K1 As Rfc2898DeriveBytes
    Dim K2 As Rfc2898DeriveBytes

    Set K1 = NewRfc2898DeriveBytes(Pwd1, Salt1, MyIterations)
    Set K2 = NewRfc2898DeriveBytes(Pwd1, Salt1)

    ' Encrypt the data.
    Dim EncAlg As TripleDES
    Dim EncryptionStream As New MemoryStream
    Dim Encrypt As CryptoStream
    Dim UtfD1() As Byte

    Set EncAlg = TripleDES.Create()
    EncAlg.Key = K1.GetBytes(16)
    Set Encrypt = NewCryptoStream(EncryptionStream, EncAlg.CreateEncryptor(), CryptoStreamMode.WriteMode)
    UtfD1 = NewUTF8Encoding(False).GetBytes(Data1)

    Encrypt.WriteBlock UtfD1, 0, CorArray.Length(UtfD1)
    Encrypt.FlushFinalBlock
    Encrypt.CloseStream

    Dim EData1() As Byte
    EData1 = EncryptionStream.ToArray()
    K1.Reset

    ' Try to decrypt, thus showing it can be round-tripped.
    Dim DecAlg As TripleDES
    Dim DecryptionStreamBacking As New MemoryStream
    Dim Decrypt As CryptoStream

    Set DecAlg = TripleDES.Create()
    DecAlg.Key = K2.GetBytes(16)
    DecAlg.IV = EncAlg.IV

    Set Decrypt = NewCryptoStream(DecryptionStreamBacking, DecAlg.CreateDecryptor(), CryptoStreamMode.WriteMode)
    Decrypt.WriteBlock EData1, 0, CorArray.Length(EData1)
    Decrypt.Flush
    Decrypt.CloseStream
    K2.Reset

    Dim Data2 As String
    Data2 = NewUTF8Encoding(False).GetString(DecryptionStreamBacking.ToArray())

    If Data1 <> Data2 Then
        Debug.Print "Error: The two values are not equal."
    Else
        Debug.Print "The two values are equal."
        Debug.Print CorString.Format("K1 iterations: {0}", K1.IterationCount)
        Debug.Print CorString.Format("K2 iterations: {0}", K2.IterationCount)
    End If

    Exit Sub

Catch:
    Dim Ex As Exception

    Catch Ex, Err
    Debug.Print Ex.ToString
End Sub

' This example code produces the following output.
'
'    The two values are equal.
'    K1 iterations: 1000
'    K2 iterations: 1000

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewRNGCryptoServiceProvider

NewRNGCryptoServiceProvider

Creates a new RNGCryptoServiceProvider that uses a crypto service provider to generate random numbers.

 Public Function NewRNGCryptoServiceProvider(
      ByVal CspParams As CspParameters ) As RNGCryptoServiceProvider

Parameters

CspParams
[ByVal] CspParameters. Parameters used to allow a specific crypto service provider to be used instead of the default.

Return Values

RNGCryptoServiceProvider - A new RNGCryptoServiceProvider object that generated random numbers using a crypto service provider.

Remarks

Crypto-service providers generally produce a more random set of numbers than the standard Windows API set of random number generators. This is because cryptography depends a great deal on random number generation to be effective.

The default provider will be one of Microsofts cryptography service providers such as "Microsoft Base Cryptographic Provider v1.0" or "Microsoft Enhanced Cryptographic Provider v1.0."

Using the CspParams allows for a specific or custom provider to be used instead of the Microsoft providers.

See Also

Project CorLib Overview

Class Constructors Overview

RNGCryptoServiceProvider


Constructors: NewRSACryptoServiceProvider

NewRSACryptoServiceProvider

Creates a new RSACryptoServiceProvider object.

 Public Function NewRSACryptoServiceProvider(
      Optional ByVal KeySize As Long,
      Optional ByVal Parameters As CspParameters ) As RSACryptoServiceProvider

Parameters

KeySize
[ByVal] Optional. Long. The size of the key used by the service provider.
Parameters
[ByVal] Optional. CspParameters. A CspParameters object used to specify custom service provider options.

Return Values

RSACryptoServiceProvider - A new RSACryptoServiceProvider.

Remarks

The key size can is 384bit to 512bit for non-high encryption machines and 384bit to 16384bit for high encryption machines.

See Also

Project CorLib Overview

Class Constructors Overview

RSACryptoServiceProvider


Constructors: NewSafeFileHandle

NewSafeFileHandle

Initializes a new instance of the SafeFileHandle class.

 Public Function NewSafeFileHandle(
      ByVal PreexistingHandle As Long,
      ByVal OwnsHandle As Boolean ) As SafeFileHandle

Parameters

PreexistingHandle
[ByVal] Long. An Long pointer that represents the pre-existing handle to use.
OwnsHandle
[ByVal] Boolean. True to reliably release the handle during the finalization phase; False to prevent reliable release (not recommended).

Return Values

SafeFileHandle - A new instance of the SafeFileHandle class.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewSafeHandle

NewSafeHandle

Initializes a new instance of the SafeHandle class.

 Public Function NewSafeHandle(
      ByVal PreexistingHandle As Long,
      ByVal OwnsHandle As Boolean,
      Optional ByVal ZeroIsInvalid = False ) As SafeHandle

Parameters

PreexistingHandle
[ByVal] Long. An Long pointer that represents the pre-existing handle to use.
OwnsHandle
[ByVal] Boolean. True to reliably release the handle during the finalization phase; False to prevent reliable release (not recommended).
ZeroIsInvalid
[ByVal] Optional. Variant. True if a handle of the value zero is considered an invalid handle; False otherwise.

Default: False

Return Values

SafeHandle - A new instance of the SafeHandle class.

Remarks

The SafeHandle class is used as base class through composition for managing specific handles.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewSecurityElement

NewSecurityElement

Creates a new SecurityElement object.

 Public Function NewSecurityElement(
      ByRef Tag As String,
      Optional ByRef Text As String ) As SecurityElement

Parameters

Tag
[ByRef] String. The name of the security element.
Text
[ByRef] Optional. String. The text within the element tags.

Return Values

SecurityElement - A new SecurityElement object.

Remarks

A SecurityElement is a simple version of an XML tag with attributes and text.

See Also

Project CorLib Overview

Class Constructors Overview

SecurityElement


Constructors: NewSerializationException

NewSerializationException

Creates a new SerializationException object.

 Public Function NewSerializationException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As SerializationException

Parameters

Message
[ByRef] String. A human-readable message explaining the exception.
InnerException
[ByVal] Optional. Exception. An exception that caused this exception.

Return Values

SerializationException - A fully created SerializationException object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewSingles

NewSingles

Initializes a Single array with elements copied from Values.

 Public Function NewSingles(
      ParamArray Values ( ) As Variant ) As Single ( )

Parameters

Values
[ByRef] Variant. The values to create the array from.

Return Values

Single() -

Remarks

The values need to be convertable to a Single or an exception will occur.

The array is zero-based.

If no values are passed in then an empty array is returned, not a null array.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewSortedList

NewSortedList

Creates a new SortedList object with specific initialization options.

 Public Function NewSortedList(
      Optional ByVal d As IDictionary,
      Optional ByVal Comparer As IComparer,
      Optional ByVal Capacity As Long ) As SortedList

Parameters

d
[ByVal] Optional. IDictionary. An object implementing IDictionary used to initialize the list from.
Comparer
[ByVal] Optional. IComparer. An object implementing IComparer used to search and sort keys in the list.
Capacity
[ByVal] Optional. Long. An initial list size.

Return Values

SortedList - A new SortedList object with the specific initializations.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewStack

NewStack

Initializes a new instance of the Stack class that contains elements copied from the specified collection.

 Public Function NewStack(
      ByRef Source As Variant ) As Stack

Parameters

Source
[ByRef] Variant. A collection of items copy elements from.

Return Values

Stack - A new Stack object containing the collection of values.

Remarks

Source can be a VBA.Collection, an object implementing ICollection, or an array.

Exceptions

Exception | Condition
ArgumentNullException | Source is Nothing or an uninitialized array.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewStreamReader

NewStreamReader

Creates a new StreamReader from either a FileName or an existing stream to read from.

 Public Function NewStreamReader(
      ByRef Source As Variant,
      Optional ByVal Encoding As Encoding,
      Optional ByVal DetermineEncodingFromByteOrderMarks As Boolean = True,
      Optional ByVal BufferSize As Long = 1024,
      Optional ByVal LeaveOpen As Boolean ) As StreamReader

Parameters

Source
[ByRef] Variant. A file name used to open an existing file as a FileStream, or an existing Stream object.
Encoding
[ByVal] Optional. Encoding. The encoding to be used when decoding bytes from the stream.
DetermineEncodingFromByteOrderMarks
[ByVal] Optional. Boolean. Requests that the reader attempt to determine what type of encoding is being used in the stream by reading the first few bytes.

Default: True

BufferSize
[ByVal] Optional. Long. The size of the internal cache used to improve performance.

Default: 1024

LeaveOpen
[ByVal] Optional. Boolean. A boolean flag indicating if the underlying stream is to be left open once the StreamReader instance has closed.

Return Values

StreamReader - A newly initialized StreamReader object.

Remarks

If a file name is specified, then an internal FileStream object is created using an initialization of Cor.NewFileStream(Source, FileMode.OpenExisting, FileAccess.ReadAccess, FileShare.ReadShare).

If DetermineEncodingFromByteOrderMarks is True, then up to 3 bytes are read from the stream upon the first attempt to read any data from the stream. The bytes are used to determine if a specific encoding has been used. There are 3 encoding signatures that are looked for.
BOM | Encoding
&HFE, &HFF | UnicodeEncoding with little-endian byte ordering is used.
&HFF, &HFE | UnicodeEncoding with big-endian byte ordering is used.
&HEF, &HBB, &HBF | UTF8Encoding is used.
If no encoding is identified, then Encoding.UTF8 is used.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewStreamWriter

NewStreamWriter

Creates a new StreamWriter with either a filename or other stream as a source to write to in the specified Encoding.

 Public Function NewStreamWriter(
      ByRef Source As Variant,
      Optional ByVal Append As Boolean = False,
      Optional ByVal Encoding As Encoding,
      Optional ByVal BufferSize As Long = 4096,
      Optional ByVal LeaveOpen As Boolean ) As StreamWriter

Parameters

Source
[ByRef] Variant. Either a file name or Stream object to write to.
Append
[ByVal] Optional. Boolean. Indicates if a file is to be appended to or overwritten.

Default: False

Encoding
[ByVal] Optional. Encoding. The encoding to be used when writing to the stream.
BufferSize
[ByVal] Optional. Long. The minimum size of the internal buffer used to cache writes.

Default: 4096

LeaveOpen
[ByVal] Optional. Boolean. True to leave the stream open after the StreamWriter object is disposed; otherwise, False.

Return Values

StreamWriter - A new StreamWriter ready to write to an underlying stream in the specified Encoding.

Remarks

If a file name is passed in, then a FileStream is created internally using either FileMode.Create or FileMode.Append depending on Append.

If Encoding is not supplied, then an encoding of NewUTF8Encoding(False, True) is used.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewString

NewString

Initializes a new String to the value indicated by an array of Unicode characters, a starting character position within that array, and a length.

 Public Function NewString(
      ByRef Value ( ) As Integer,
      Optional ByRef StartIndex As Variant,
      Optional ByRef Length As Variant ) As String

Parameters

Value
[ByRef] Integer. An array of Unicode characters.
StartIndex
[ByRef] Optional. Variant. The starting position within Value. Defaults to start of Value.
Length
[ByRef] Optional. Variant. The number of characters within Value to use. Defaults to using from StartIndex to end of array.

Return Values

String - A String initialized from the characters in Value.

Exceptions

Exception | Condition
ArgumentNullException | Value is Nothing.
ArgumentOutOfRangeException | StartIndex is less than the lower-bound of Value. -or- Length is less than zero. -or- The sum of StartIndex and Length is greater than the upper-bound of Value.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewStringBuilder

NewStringBuilder

Returns a new StringBuilder with user specified settings and starting string.

 Public Function NewStringBuilder(
      Optional ByRef s As String,
      Optional ByRef StartIndex As Variant,
      Optional ByRef Count As Variant,
      Optional ByVal Capacity As Long = 128 ) As StringBuilder

Parameters

s
[ByRef] Optional. String. A string to be inititially placed in the builder. If this is specified, then Capacity will be set to no less than Count.
StartIndex
[ByRef] Optional. Variant. The starting index in s to begin placing into the buffer.
Count
[ByRef] Optional. Variant. The number of characters in s to place into the buffer.
Capacity
[ByVal] Optional. Long. The capacity of the internal buffer. If this is less than Count, then Count will override this value.

Default: 128

Return Values

StringBuilder - A new StringBuilder with s already placed in the buffer.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewStringReader

NewStringReader

Returns a new StringReader object.

 Public Function NewStringReader(
      ByRef s As String,
      Optional ByVal CopyString As Boolean ) As StringReader

Parameters

s
[ByRef] String. The string to be read from.
CopyString
[ByVal] Optional. Boolean. Indicates that StringReader should copy the string or reference the original.

Return Values

StringReader - The new StringReader object.

Remarks

By default the parameter s is referenced internally. This requires the original holder of the string variable to remain valid until StringReader has been disposed. If the original string cannot be maintained, then passing True for CopyString will cause StringReader to make a copy of the source string to prevent any string deallocation issues.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewStrings

NewStrings

Initializes a String array with elements copied from Values.

 Public Function NewStrings(
      ParamArray Values ( ) As Variant ) As String ( )

Parameters

Values
[ByRef] Variant. The values to create the array from.

Return Values

String() -

Remarks

The values need to be convertable to a String or an exception will occur.

The array is zero-based.

If no values are passed in then an empty array is returned, not a null array.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewStringWriter

NewStringWriter

Returns a new StringWriter object.

 Public Function NewStringWriter(
      Optional ByVal sb As StringBuilder,
      Optional ByVal Provider As IFormatProvider ) As StringWriter

Parameters

sb
[ByVal] Optional. StringBuilder. A supplied StringBuilder object that is written to. This allows the StringWriter to start with an already created string.
Provider
[ByVal] Optional. IFormatProvider. An object that provides formatting information for numbers and dates.

Return Values

StringWriter - The new StringWriter object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewSystemException

NewSystemException

Creates a new SystemException object.

 Public Function NewSystemException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As SystemException

Parameters

Message
[ByRef] String. A human-readable message explaining the exception.
InnerException
[ByVal] Optional. Exception. An exception that caused this exception.

Return Values

SystemException - A fully created SystemException object.

See Also

Project CorLib Overview

Class Constructors Overview

SystemException

Exception


Constructors: NewTicker

NewTicker

Creates a new Ticker.

 Public Function NewTicker(
      ByVal Interval As Long,
      Optional ByRef Data As Variant,
      Optional ByVal AutoReset As Boolean = True,
      Optional ByVal AddressOfCallback As Long ) As Ticker

Parameters

Interval
[ByVal] Long. The delay between events in milliseconds.
Data
[ByRef] Optional. Variant. A user supplied value to be associated with the timer.
AutoReset
[ByVal] Optional. Boolean. True to have the timer event recur, False for one event.

Default: True

AddressOfCallback
[ByVal] Optional. Long. An address to a callback method that can be called when the timer has elapsed. Setting this to zero will stop the callback.

Return Values

Ticker - A new Ticker object.

Remarks

A callback method is used to allow a timer object to notify the function without having to use an Event. A function callback must have the following signature, or the application may crash.

 Public Sub TickerCallback(ByRef Ticker As Ticker, ByRef Data As Variant)
      do stuff
 End Sub
The two parameters must be declared as ByRef.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewTime

NewTime

Initializes a new TimeSpan representing the time portion of a date.

 Public Function NewTime(
      ByRef DateValue As Variant ) As TimeSpan

Parameters

DateValue
[ByRef] Variant. The date to retrieve the time portion of.

Return Values

TimeSpan - A TimeSpan object representing the time portion.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewTimeSpan

NewTimeSpan

Creates a new TimeSpan object set to the specified amount of time.

 Public Function NewTimeSpan(
      Optional ByVal Days As Long,
      Optional ByVal Hours As Long,
      Optional ByVal Minutes As Long,
      Optional ByVal Seconds As Long,
      Optional ByVal Milliseconds As Long ) As TimeSpan

Parameters

Days
[ByVal] Optional. Long. The number of days.
Hours
[ByVal] Optional. Long. The number of hours.
Minutes
[ByVal] Optional. Long. The number of minutes.
Seconds
[ByVal] Optional. Long. The number of seconds.
Milliseconds
[ByVal] Optional. Long. The number of milliseconds.

Return Values

TimeSpan - A TimeSpan with the specified time.

Remarks

The values can be both positive and negative.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewUnauthorizedAccessException

NewUnauthorizedAccessException

Creates a new UnauthorizedAccessException object.

 Public Function NewUnauthorizedAccessException(
      ByRef Message As String,
      Optional ByVal InnerException As Exception ) As UnauthorizedAccessException

Parameters

Message
[ByRef] String. A human-readable message explaining the exception.
InnerException
[ByVal] Optional. Exception. An exception that caused this exception.

Return Values

UnauthorizedAccessException - A fully created UnauthorizedAccessException object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewUnicodeEncoding

NewUnicodeEncoding

Returns a new UnicodeEncoding object with the specified settings.

 Public Function NewUnicodeEncoding(
      ByVal BigEndian As Boolean,
      ByVal ByteOrderMark As Boolean,
      Optional ByVal ThrowOnInvalidBytes As Boolean ) As UnicodeEncoding

Parameters

BigEndian
[ByVal] Boolean. True to use the big endian byte order (most significant byte first), or False to use the little endian byte order (least significant byte first).
ByteOrderMark
[ByVal] Boolean. True to specify that the GetPreamble method returns a Unicode byte order mark; otherwise, False. See the Remarks section for more information.
ThrowOnInvalidBytes
[ByVal] Optional. Boolean. True to specify that an exception should be thrown when an invalid encoding is detected; otherwise, False.

Return Values

UnicodeEncoding - The new UnicodeEncoding object.

Remarks

If ByteOrderMark is True then the GetPreamble will emit one of the following byte arrays.

BigEnding = True: &HFE, &HFF
BigEnding = False: &HFF, &HFE

If ByteOrderMark is False then GetPreamble will emit an empty array.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewUTF32Encoding

NewUTF32Encoding

Initializes a new instance of the UTF32Encoding class. Parameters specify whether to use the big endian byte order, whether to provide a Unicode byte order mark, and whether to throw an exception when an invalid encoding is detected.

 Public Function NewUTF32Encoding(
      ByVal BigEndian As Boolean,
      ByVal ByteOrderMark As Boolean,
      Optional ByVal ThrowOnInvalidBytes As Boolean ) As UTF32Encoding

Parameters

BigEndian
[ByVal] Boolean. True to use the big endian byte order (most significant byte first), or False to use the little endian byte order (least significant byte first).
ByteOrderMark
[ByVal] Boolean. True to specify that a Unicode byte order mark is provided; otherwise, False.
ThrowOnInvalidBytes
[ByVal] Optional. Boolean. True to specify that an exception should be thrown when an invalid encoding is detected; otherwise, False.

Return Values

UTF32Encoding - An initialized UTF32Encoding object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewUTF7Encoding

NewUTF7Encoding

Returns a new UTF7Encoding object.

 Public Function NewUTF7Encoding(
      ByVal AllowOptionals As Boolean ) As UTF7Encoding

Parameters

AllowOptionals
[ByVal] Boolean. True to specify that optional characters are allowed; otherwise, False.

Return Values

UTF7Encoding - The new UTF7Encoding object.

Remarks

If an instance allows optional characters, Unicode code points are encoded with a corresponding optional character instead of a modified base 64 character. The optional characters are exclamation point ("!"), backward slash ("\"), vertical line ("|"), double quote ("""), number sign ("#"), dollar sign ("$"), percent sign ("%"), ampersand ("&"), asterisk ("*"), semicolon (";"), left angle bracket ("<"), right angle bracket (">"), left curly bracket ("{"), right curly bracket ("}"), left square bracket ("["), right square bracket ("]"), equal sign ("="), at sign ("

"), Circumflex Accent ("

^"), underscore ("_"), and grave accent ("`").

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewUTF8Encoding

NewUTF8Encoding

Returns a new UTF8Encoding object.

 Public Function NewUTF8Encoding(
      ByVal ShouldEmitUTF8Identifier As Boolean,
      Optional ByVal ThrowOnInvalidBytes As Boolean ) As UTF8Encoding

Parameters

ShouldEmitUTF8Identifier
[ByVal] Boolean. True to specify that a Unicode byte order mark is provided; otherwise, False.
ThrowOnInvalidBytes
[ByVal] Optional. Boolean. True to specify that an exception be thrown when an invalid encoding is detected; otherwise, False.

Return Values

UTF8Encoding - The new UTF8Encoding object.

Remarks

If ThrowOnInvalidBytes is True, a method that detects an invalid byte sequence throws ArgumentException. Otherwise, the method does not throw an exception, and the invalid sequence is ignored.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewVariants

NewVariants

Initializes a Variant array with elements copied from Values.

 Public Function NewVariants(
      ParamArray Values ( ) As Variant ) As Variant ( )

Parameters

Values
[ByRef] Variant. The values to create the array from.

Return Values

Variant() -

Remarks

This is the same as using the Array function.

The array is zero-based.

If no values are passed in then an empty array is returned, not a null array.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewVersion

NewVersion

Creates a new Version object with specified version information.

 Public Function NewVersion(
      ByVal Major As Long,
      ByVal Minor As Long,
      Optional ByRef Build As Variant,
      Optional ByRef Revision As Variant ) As Version

Parameters

Major
[ByVal] Long. The number to describe an application level change.
Minor
[ByVal] Long. The number that describes a component level change.
Build
[ByRef] Optional. Variant. The number used to describe an integration compiling of the application.
Revision
[ByRef] Optional. Variant. Minor adjustments to the application.

Return Values

Version - A new Version object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewWinResourceReader

NewWinResourceReader

Creates a new WinResourceReader object.

 Public Function NewWinResourceReader(
      ByRef FileName As String ) As WinResourceReader

Parameters

FileName
[ByRef] String. The path and name of the EXE or DLL from which to read the resources.

Return Values

WinResourceReader - A new WinResourceReader object.

See Also

Project CorLib Overview

Class Constructors Overview


Constructors: NewXmlSyntaxException

NewXmlSyntaxException

Creates a new XmlSyntaxException object.

 Public Function NewXmlSyntaxException(
      Optional ByRef LineNumber As Variant,
      Optional ByRef Message As Variant,
      Optional ByVal InnerException As Exception ) As XmlSyntaxException

Parameters

LineNumber
[ByRef] Optional. Variant. The number in the Xml string the exception occurred.
Message
[ByRef] Optional. Variant. The exception message.
InnerException
[ByVal] Optional. Exception. The exception that caused this exception to occur.

Return Values

XmlSyntaxException - A new XmlSyntaxException object.

See Also

Project CorLib Overview

Class Constructors Overview

XmlSyntaxException


Conversion

Conversion

Provides methods to convert to specified data-types.

Public:

Methods:

Name | Description
CBigInt | Attempts to convert a value to a valid BigInteger instance.
CDateTime | Converts a value to a CorDateTime object.
CInt64 | Converts a value to a 64-bit signed integer.
CObj | Returns the instance as type Object.
CUnk | Returns the controlling IUnknown interface of the object.

See Also

Project CorLib Overview

Class Conversion Overview


Conversion: CBigInt

CBigInt

Attempts to convert a value to a valid BigInteger instance.

 Public Function CBigInt(
      ByRef Value As Variant ) As BigInteger

Parameters

Value
[ByRef] Variant. The value to be converted to BigInteger.

Return Values

BigInteger - A new BigInteger instance representing the converted value.

Remarks

The follow types are supported:

  • String
  • Int64
  • Long
  • Integer
  • Byte
  • Double
  • Single
  • Currency
  • Decimal
  • Byte Array
  • BigInteger
  • Nothing
 Dim b As BigInteger
 Set b = CBigInt(12345)

See Also

Project CorLib Overview

Class Conversion Overview


Conversion: CDateTime

CDateTime

Converts a value to a CorDateTime object.

 Public Function CDateTime(
      ByRef Value As Variant ) As CorDateTime

Parameters

Value
[ByRef] Variant. The value to be converted to aCorDateTime object.

Return Values

CorDateTime - The converted value.

Remark

This is a short-cut version of Convert.ToDateTime.

See Also

Project CorLib Overview

Class Conversion Overview


Conversion: CInt64

CInt64

Converts a value to a 64-bit signed integer.

 Public Function CInt64(
      ByRef Value As Variant ) As Int64

Parameters

Value
[ByRef] Variant. The value to be converted

Return Values

Int64 - Returns a 64-bit signed integer.

Remarks

This method will attempt to convert various data types to an Int64 value.
Type | Operation
Int64 | Returns value.
String | Attemps to parse the string expression using Int64.Parse.
Long -or- Integer -or- Byte | Directly assigns to LowPart in the Int64 and sets the HighPart to -1 if the value is negative.
Double -or- Single -or- Currency -or- Decimal | Assigns the value rounding off any fractions using Round.

Exceptions

Exception | Condition
InvalidCastException | Count not convert from specified type.
OverflowException | Value represented a value outside the Int64 valid range from MinValue to MaxValue.

Examples

The following code demonstrates the various types that can be converted.

Public Sub Main()
    ConvertValue "80278098"
    ConvertValue "0xffff"
    ConvertValue CLng(-223432)
    ConvertValue CInt(23214)
    ConvertValue CByte(255)
    ConvertValue CDbl(1234.4323)
    ConvertValue CSng(1234.43)
    ConvertValue CCur(492398.724)
    ConvertValue CDec(492398.724)
End Sub

Private Sub ConvertValue(ByRef Value As Variant)
    Dim x As Int64

    x = CInt64(Value)

    Debug.Print CorString.Format("{0} of {1} = {2}", TypeName(Value), Value, x)
End Sub

' This code produces the following output.
'    String of 80278098 = 80278098
'    String of 0xffff = 65535
'    Long of -223432 = -223432
'    Integer of 23214 = 23214
'    Byte of 255 = 255
'    Double of 1234.4323 = 1234
'    Single of 1234.43 = 1234
'    Currency of 492398.724 = 492399
'    Decimal of 492398.724 = 492399

See Also

Project CorLib Overview

Class Conversion Overview

Int64Static

Constructors


Conversion: CObj

CObj

Returns the instance as type Object.

 Public Function CObj(
      ByVal Obj As Object ) As Object

Parameters

Obj
[ByVal] Object. The instance to convert.

Return Values

Object - Returns the instance as type Object.

See Also

Project CorLib Overview

Class Conversion Overview


Conversion: CUnk

CUnk

Returns the controlling IUnknown interface of the object.

 Public Function CUnk(
      ByVal Obj As IUnknown ) As IUnknown

Parameters

Obj
[ByVal] IUnknown. The object get the controlling interface of.

Return Values

IUnknown - The controlling IUnknown interface.

See Also

Project CorLib Overview

Class Conversion Overview


Convert

Convert

Provides methods used to encode and decode byte arrays to and from base-64 encoded characters.

Public:

Methods:

Name | Description
FromBase64CharArray | Decodes a base-64 character array to a byte array. The Offset and length specify a subset of the character array to be decoded.
FromBase64String | A base-64 string containing characters to be decoded to a byte array.
ToBase64CharArray | Converts the value of a subset of a byte array to an equivalent subset of a Unicode character array consisting of base 64 digits. Parameters specify the subsets as offsets of the input and output arrays and the number of elements in the input array.
ToBase64String | Converts the value of a subset of a byte array to an equivalent subset of a Unicode character string consisting of base-64 characters. Parameters specify the subsets as offsets of the input array and the number of elements in the input array to process.
ToDateTime | Converts the value of the specified object to a CorDateTime object, using the specified culture-specific formatting information.
ToInt64 | Converts the value of the specified object to a 64-bit signed integer.
ToString | Converts a datatype value to a string representation using any supplied formatting or provider arguments.

Remarks

To access the methods of this class, call the method using the Convert.Method syntax.

Examples

This example takes a byte array containing 10 elements with values 1 to 10 and encodes it into a Base-64 string encoding. The encoded string is then decoded back into the original byte array and displayed for view.

Private Sub Main()
    Dim Original() As Byte
    Dim Decoded() As Byte
    Dim s As String

    ' Create a byte array containing values 1 to 10.
    Original = NewBytes(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)

    ' Display the original byte array values
    Debug.Print "Original Bytes"
    DisplayBytes Original

    ' Encode the byte array into a Base-64 Encoded string.
    s = Convert.ToBase64String(Original)

    ' Display Base-64 Encoded string.
    Debug.Print t("\nBase-64 Encoded String")
    Debug.Print "  " & s

    ' Decode Base-64 string into byte array.
    Decoded = Convert.FromBase64String(s)

    ' Display decoded byte array.
    Debug.Print t("\nBytes After Decoding")
    DisplayBytes Decoded
End Sub

'Displays the contents of a byte array.
Private Sub DisplayBytes(ByRef Bytes() As Byte)
    Dim i As Long

    Debug.Print "  ";

    For i = LBound(Bytes) To UBound(Bytes)
        Debug.Print Bytes(i) & " ";
    Next i

    Debug.Print
End Sub

' This code produces the following output.
'
'    Original Bytes
'      1 2 3 4 5 6 7 8 9 10
'
'    Base-64 Encoded String
'      AQIDBAUGBwgJCg==
'
'    Bytes After Decoding
'      1 2 3 4 5 6 7 8 9 10

See Also

Project CorLib Overview

Class Convert Overview


Convert: FromBase64CharArray

FromBase64CharArray

Decodes a base-64 character array to a byte array. The Offset and length specify a subset of the character array to be decoded.

 Public Function FromBase64CharArray(
      ByRef InArray ( ) As Integer,
      ByVal Offset As Long,
      ByVal Length As Long ) As Byte ( )

Parameters

InArray
[ByRef] Integer. A base-64 character array to be decoded to a byte array.
Offset
[ByVal] Long. The character within the character array to begin decoding.
Length
[ByVal] Long. The number of characters to be decoded into the byte array.

Return Values

Byte() - A byte array that has been decoded from a base-64 character array.

See Also

Project CorLib Overview

Class Convert Overview


Convert: FromBase64String

FromBase64String

A base-64 string containing characters to be decoded to a byte array.

 Public Function FromBase64String(
      ByRef s As String ) As Byte ( )

Parameters

s
[ByRef] String. The base-64 string to be decoded.

Return Values

Byte() - A byte array containing the decoded base-64 characters.

See Also

Project CorLib Overview

Class Convert Overview


Convert: ToBase64CharArray

ToBase64CharArray

Converts the value of a subset of a byte array to an equivalent subset of a Unicode character array consisting of base 64 digits. Parameters specify the subsets as offsets of the input and output arrays and the number of elements in the input array.

 Public Function ToBase64CharArray(
      ByRef InArray ( ) As Byte,
      ByVal IndexIn As Long,
      ByVal Length As Long,
      ByRef OutArray ( ) As Integer,
      ByVal IndexOut As Long,
      Optional ByVal InsertLineBreaks As Boolean = False ) As Long

Parameters

InArray
[ByRef] Byte. The bytes to be converted to a base-64 character array.
IndexIn
[ByVal] Long. Offset within InArray to begin encoding to base-64 characters.
Length
[ByVal] Long. The number of bytes to encode.
OutArray
[ByRef] Integer. The output character array containing the base-64 characters.
IndexOut
[ByVal] Long. The starting index in OutArray to place base-64 characters.
InsertLineBreaks
[ByVal] Optional. Boolean. Indicates if a vbCrLf should be inserted every 76 characters to conform with MIME line formatting.

Default: False

Return Values

Long - The number of base-64 characters created.

Remarks

Added .NET 2.0 ability to insert linebreaks every 76 characters for MIME formatting.

See Also

Project CorLib Overview

Class Convert Overview


Convert: ToBase64String

ToBase64String

Converts the value of a subset of a byte array to an equivalent subset of a Unicode character string consisting of base-64 characters. Parameters specify the subsets as offsets of the input array and the number of elements in the input array to process.

 Public Function ToBase64String(
      ByRef InArray ( ) As Byte,
      Optional ByRef Offset As Variant,
      Optional ByRef Length As Variant,
      Optional ByVal InsertLineBreaks As Boolean = False ) As String

Parameters

InArray
[ByRef] Byte. The bytes to be converted to a base-64 character array.
Offset
[ByRef] Optional. Variant. Offset within InArray to begin encoding to base-64 characters.
Length
[ByRef] Optional. Variant. The number of bytes to encode.
InsertLineBreaks
[ByVal] Optional. Boolean. Indicates if a vbCrLf should be inserted every 76 characters to conform with MIME line formatting.

Default: False

Return Values

String - A string containg the byte array encoded as base-64 characters.

See Also

Project CorLib Overview

Class Convert Overview


Convert: ToDateTime

ToDateTime

Converts the value of the specified object to a CorDateTime object, using the specified culture-specific formatting information.

 Public Function ToDateTime(
      ByRef Value As Variant,
      Optional ByVal Provider As IFormatProvider ) As CorDateTime

Parameters

Value
[ByRef] Variant. Value to be converted.
Provider
[ByVal] Optional. IFormatProvider. An object that supplies culture-specific formatting information.

Return Values

CorDateTime - The date and time equivalent of the value of value, or the date and time equivalent of CorDateTime.MinValue if value is Nothing.

See Also

Project CorLib Overview

Class Convert Overview


Convert: ToInt64

ToInt64

Converts the value of the specified object to a 64-bit signed integer.

 Public Function ToInt64(
      ByRef Value As Variant ) As Int64

Parameters

Value
[ByRef] Variant. A value that is convertable to Int64.

Return Values

Int64 - A 64-bit signed integer that is equivalent to Value.

See Also

Project CorLib Overview

Class Convert Overview


Convert: ToString

ToString

Converts a datatype value to a string representation using any supplied formatting or provider arguments.

 Public Function ToString(
      ByRef Value As Variant,
      Optional ByVal Provider As IFormatProvider ) As String

Parameters

Value
[ByRef] Variant. The value to convert to a string.
Provider
[ByVal] Optional. IFormatProvider. A formatting provider to help custom formatting.

Return Values

String - A string representation of the value.

See Also

Project CorLib Overview

Class Convert Overview


CorArray

CorArray

Provides methods for creating, manipulating, searching, and sorting arrays.

Public:

Methods:

Name | Description
BinarySearch | Searches the entire one-dimensional sorted array for a specific element, using an optionally specified IComparer interface.
BinarySearchEx | Searches a range of elements in a one-dimensional sorted Arr for a value, using an optionally specified IComparer interface.
Clear | Clears a portion of the elements in an array.
Copy | Copies one Array to another Array and performs type casting as necessary.
CopyEx | Copies a section of one Array to another Array and performs type casting as necessary.
CreateInstance | Initializes a new array of the specified type in up to 3 dimensions.
Exists | Determines whether the specified array contains elements that match the conditions defined by the specified predicate.
Find | Uses a callback method to search an array for the first element that matches the criteria.
FindAll | Retrieves all the elements that match the conditions defined by the specified callback method.
FindIndex | Searches for an element that matches the conditions defined by the specified callback method, and returns the lower-bound based index of the first occurrence within the range of elements in the array that starts at the specified index and contains the specified number of elements.
FindLast | Searches for an element that matches the conditions defined by the specified callback method, and returns the last occurrence within the entire array.
FindLastIndex | Finds the index of the last occurence of a matched element in the array.
ForEach | Performs the specified action on each element of the specified array.
GetLength | Gets a 32-bit integer that represents the number of elements in the specified dimension of the array.
IndexOf | Returns the index of the first occurrence of a value in a one-dimensional Array or in a portion of the Array.
IsNull | Returns if an array variable is uninitialized.
IsNullOrEmpty | Returns if the array variable is unitialized(null) or empty(no elements).
LastIndexOf | Returns the index of the last occurrence of a value in a one-dimensional Array or in a portion of the Array.
Length | Gets a 32-bit integer that represents the total number of elements in all dimensions of the array.
Rank | Returns the number of dimensions in the array.
Reverse | Reverses the elements in a subportion of an array.
Sort | Sorts an entire array. An optionally supplied comparer object can be used to compare special elements, such as userdefined values.
SortEx | Sorts an array, or subportion, given a startindex and length. An optionally supplied comparer object can be used to compare special elements, such as userdefined values.
SortKey | Sorts an entire array based on an array of keys. An optionally supplied comparer object can be used to compare special elements, such as userdefined values.
SortKeyEx | Sorts an array based on an array of keys. A subportion of the array can be sorted given a startindex and length. An optionally, supplied comparer object can be used to compare special elements, such as userdefined values.
TrueForAll | Determines whether every element in the array matches the conditions defined by the specified callback method.

Remarks

Arrays are a common data structure used when building applications. The CorArray class provides several methods to help manage arrays through the course of an applications lifetime.

Examples

The following code example uses CorArray.Copy and CorArray.CopyEx to copy elements between an Integer array and a Variant array.

Public Sub Main()
    Dim MyIntArray() As Integer
    Dim MyVarArray() As Variant

    ' Creates and initializes a new Integer array and a new Variant array.
    MyIntArray = NewIntegers(1, 2, 3, 4, 5)
    MyVarArray = NewVariants(26, 27, 28, 29, 30)

    ' Prints the initial values of both arrays.
    Debug.Print "Initially,"
    Debug.Print "Integer Array: ";
    PrintValues MyIntArray
    Debug.Print "Variant Array: ";
    PrintValues MyVarArray

    ' Copies the first two elements from the Integer array to the Variant array.
    CorArray.Copy MyIntArray, MyVarArray, 2

    ' Prints the values of the modified arrays.
    Debug.Print t("\nAfter copying the first two elements of the Integer array to the Variant array,")
    Debug.Print "Integer Array: ";
    PrintValues MyIntArray
    Debug.Print "Variant Array: ";
    PrintValues MyVarArray

    ' Copies the last two elements from the Object array to the integer array.
    CorArray.CopyEx MyVarArray, UBound(MyVarArray) - 1, MyIntArray, UBound(MyIntArray) - 1, 2

    ' Prints the values of the modified arrays.
    Debug.Print t("\nAfter copying the last two elements of the Object array to the integer array,")
    Debug.Print "Integer Array: ";
    PrintValues MyIntArray
    Debug.Print "Variant Array: ";
    PrintValues MyVarArray
End Sub

Private Sub PrintValues(ByRef MyArr As Variant)
    Dim Value As Variant

    For Each Value In MyArr
        Debug.Print CorString.Format("{0,5}", Value);
    Next

    Debug.Print
End Sub

' The code example produces the following output.
'    Initially,
'    Integer Array:     1    2    3    4    5
'    Variant Array:    26   27   28   29   30
'
'    After copying the first two elements of the Integer array to the Variant array,
'    Integer Array:     1    2    3    4    5
'    Variant Array:     1    2   28   29   30
'
'    After copying the last two elements of the Object array to the integer array,
'    Integer Array:     1    2    3   29   30
'    Variant Array:     1    2   28   29   30

See Also

Project CorLib Overview

Class CorArray Overview

PublicFunctions


CorArray: BinarySearch

BinarySearch

Searches the entire one-dimensional sorted array for a specific element, using an optionally specified IComparer interface.

 Public Function BinarySearch(
      ByRef Arr As Variant,
      ByRef Value As Variant,
      Optional ByVal Comparer As IComparer ) As Long

Parameters

Arr
[ByRef] Variant. The sorted one-dimensional array to search.
Value
[ByRef] Variant. The value to search for in the array.
Comparer
[ByVal] Optional. IComparer. An object used to compare elements within the array. If this is Nothing then Comparer.Default is used.

Return Values

Long - The index of the specified Value in the specified array, if Value is found. If Value is not found and Value is less than one or more elements in Arr, a negative number which is the bitwise complement of the index of the first element that is larger than Value. If Value is not found and Value is greater than any of the elements in Arr, a negative number which is the bitwise complement of (the index of the last element plus 1).

Remarks

The Arr must be sorted before calling this method.

If the returned value is less than the lower bound of the array, the value is a bitwise Not indication of where the value would have been found in the array. The following shows how to convert the result for a value that is not found.
Lower Bound of Arr | Conversion Method
Zero | Index = Not Result
Non-zero | Index = (Not (Result - LBound(Arr))) + LBound(Arr)

Exceptions

Exception | Condition
ArgumentNullException | Arr is uninitialized
RankException | Arr is multidimensional.
ArgumentException | Value is of a type that is not compatible with the elements in Arr.
InvalidOperationException | Value is not comparable to the elements in Arr.

Examples

The example code searches a sorted list for values, displaying the index found, or the index the value should have been found.

Private Sub Main()
    Dim Ints() As Integer

    ' Create a sorted array with the value 7 missing.
    Ints = NewIntegers(1, 2, 3, 4, 5, 6, 8, 9, 10)

    ' Search for the value 6.
    Search Ints, 6

    ' Search for the missing value 7.
    Search Ints, 7
End Sub

' Performs a binary search on the array, searching for
' the requested value. If the value is found, then the
' search index will be equal or greater than the lower-bound
' of the array, otherwise, the value was not found.
Private Sub Search(ByRef Ints() As Integer, ByVal Value As Integer)
    Dim Index As Long

    Index = CorArray.BinarySearch(Ints, Value)

    ' If the index is not less then then lower-bound
    ' of the array, then the value was found.
    If Index >= LBound(Ints) Then
        Debug.Print CorString.Format("Value [{0}] found at index [{1}].", Value, Index)
    Else
        ' The value was not found. To determine where
        ' the value should have been found, use Not to
        ' negate the returned index value.
        Index = Not Index
        Debug.Print CorString.Format("Value [{0}] should be at index [{1}].", Value, Index)
    End If
End Sub

' This code produces the following output.
'  Value [6] found at index [5].
'  Value [7] should be at index [6].

See Also

Project CorLib Overview

Class CorArray Overview

BinarySearchEx


CorArray: BinarySearchEx

BinarySearchEx

Searches a range of elements in a one-dimensional sorted Arr for a value, using an optionally specified IComparer interface.

 Public Function BinarySearchEx(
      ByRef Arr As Variant,
      ByVal Index As Long,
      ByVal Length As Long,
      ByRef Value As Variant,
      Optional ByVal Comparer As IComparer ) As Long

Parameters

Arr
[ByRef] Variant. The sorted one-dimensional array to search.
Index
[ByVal] Long. The starting index in the range to search.
Length
[ByVal] Long. The length of the range to search.
Value
[ByRef] Variant. The value to search for in the array.
Comparer
[ByVal] Optional. IComparer. The IComparer implementation to use when comparing elements.
-or-
Nothing to use the default Comparer implementation.

Return Values

Long - The index of the specified Value in the specified array, if Value is found. If Value is not found and Value is less than one or more elements in Arr, a negative number which is the bitwise complement of the index of the first element that is larger than Value. If Value is not found and Value is greater than any of the elements in Arr, a negative number which is the bitwise complement of (the index of the last element plus 1).

Remarks

If the returned value is less than the lower bound of the array, then

If the returned value is less than the lower bound of the array, the value is a bitwise Not indication of where the value would have been found in the array. The following shows how to convert the result for a value that is not found.
Lower Bound of Arr | Conversion Method
Zero | Index = Not Result
Non-zero | Index = (Not (Result - LBound(Arr))) + LBound(Arr)

Exceptions

Exception | Condition
ArgumentNullException | Arr is uninitialized
RankException | Arr is multidimensional.
ArgumentOutOfRangeException | Index is less than the lower-bound of Arr. -or- Length is less than zero.
ArgumentException | Value is of a type that is not compatible with the elements in Arr.
InvalidOperationException | Value is not comparable to the elements in Arr.

See Also

Project CorLib Overview

Class CorArray Overview

BinarySearch


CorArray: Clear

Clear

Clears a portion of the elements in an array.

 Public Sub Clear(
      ByRef Arr As Variant,
      ByVal Index As Long,
      ByVal Length As Long )

Parameters

Arr
[ByRef] Variant. The array to clear elements from.
Index
[ByVal] Long. The starting element to being clearing.
Length
[ByVal] Long. The number of elements to be cleared.

Exceptions

Exception | Condition
ArgumentNullException | Arr is uninitialized.
IndexOutOfRangeException | Index is less than the lower-bound of Arr. -or- Length is less than zero. -or- The sum of Index and Length is greater than the upper-bound of Arr.

See Also

Project CorLib Overview

Class CorArray Overview


CorArray: Copy

Copy

Copies one Array to another Array and performs type casting as necessary.

 Public Sub Copy(
      ByRef SourceArray As Variant,
      ByRef DestinationArray As Variant,
      ByVal Length As Long )

Parameters

SourceArray
[ByRef] Variant. The array from which to copy the elements.
DestinationArray
[ByRef] Variant. The array in which to place the elements.
Length
[ByVal] Long. The number of elements to copy.

Remarks

The SourceArray and DestinationArray parameters must have the same number of dimensions. In addition, DestinationArray must already have been dimensioned and must have a sufficient number of elements to accommodate the copied data.

When copying between multidimensional arrays, the array behaves like a long one-dimensional array, where the rows (or columns) are conceptually laid end to end. For example, if an array has three rows (or columns) with four elements each, copying six elements from the beginning of the array would copy all four elements of the first row (or column) and the first two elements of the second row (or column).

Exceptions

Exception | Condition
ArgumentNullException | SourceArray is null. -or- DestinationArray is null.
RankException | SourceArray and DestinationArray have different ranks.
ArrayTypeMismatchException | SourceArray and DestinationArray are incompatible types.
InvalidCastException | At least one element in SourceArray cannot be cast to the type of DestinationArray.
ArgumentOutOfRangeException | Length is less than zero.
ArgumentException | Length is greater than the number of elements from SourceIndex to the end of SourceArray. -or- Length is greater than the number of elements from DestinationIndex to the end of DestinationArray.

Examples

The following code example uses CorArray.Copy and CorArray.CopyEx to copy elements between an Integer array and a Variant array.

Public Sub Main()
    Dim MyIntArray() As Integer
    Dim MyVarArray() As Variant

    ' Creates and initializes a new Integer array and a new Variant array.
    MyIntArray = NewIntegers(1, 2, 3, 4, 5)
    MyVarArray = NewVariants(26, 27, 28, 29, 30)

    ' Prints the initial values of both arrays.
    Debug.Print "Initially,"
    Debug.Print "Integer Array: ";
    PrintValues MyIntArray
    Debug.Print "Variant Array: ";
    PrintValues MyVarArray

    ' Copies the first two elements from the Integer array to the Variant array.
    CorArray.Copy MyIntArray, MyVarArray, 2

    ' Prints the values of the modified arrays.
    Debug.Print t("\nAfter copying the first two elements of the Integer array to the Variant array,")
    Debug.Print "Integer Array: ";
    PrintValues MyIntArray
    Debug.Print "Variant Array: ";
    PrintValues MyVarArray

    ' Copies the last two elements from the Object array to the integer array.
    CorArray.CopyEx MyVarArray, UBound(MyVarArray) - 1, MyIntArray, UBound(MyIntArray) - 1, 2

    ' Prints the values of the modified arrays.
    Debug.Print t("\nAfter copying the last two elements of the Object array to the integer array,")
    Debug.Print "Integer Array: ";
    PrintValues MyIntArray
    Debug.Print "Variant Array: ";
    PrintValues MyVarArray
End Sub

Private Sub PrintValues(ByRef MyArr As Variant)
    Dim Value As Variant

    For Each Value In MyArr
        Debug.Print CorString.Format("{0,5}", Value);
    Next

    Debug.Print
End Sub

' The code example produces the following output.
'    Initially,
'    Integer Array:     1    2    3    4    5
'    Variant Array:    26   27   28   29   30
'
'    After copying the first two elements of the Integer array to the Variant array,
'    Integer Array:     1    2    3    4    5
'    Variant Array:     1    2   28   29   30
'
'    After copying the last two elements of the Object array to the integer array,
'    Integer Array:     1    2    3   29   30
'    Variant Array:     1    2   28   29   30

See Also

Project CorLib Overview

Class CorArray Overview

CopyEx


CorArray: CopyEx

CopyEx

Copies a section of one Array to another Array and performs type casting as necessary.

 Public Sub CopyEx(
      ByRef SourceArray As Variant,
      ByVal SourceIndex As Long,
      ByRef DestinationArray As Variant,
      ByVal DestinationIndex As Long,
      ByVal Length As Long )

Parameters

SourceArray
[ByRef] Variant. The array from which to copy the elements.
SourceIndex
[ByVal] Long. The starting element in the source array to begin copying from.
DestinationArray
[ByRef] Variant. The array in which to place the elements.
DestinationIndex
[ByVal] Long. The starting element in the destination array to place elements.
Length
[ByVal] Long. The number of elements to copy.

Remarks

The SourceArray and DestinationArray parameters must have the same number of dimensions. In addition, DestinationArray must already have been dimensioned and must have a sufficient number of elements to accommodate the copied data.

When copying between multidimensional arrays, the array behaves like a long one-dimensional array, where the rows (or columns) are conceptually laid end to end. For example, if an array has three rows (or columns) with four elements each, copying six elements from the beginning of the array would copy all four elements of the first row (or column) and the first two elements of the second row (or column).

Exceptions

Exception | Condition
ArgumentNullException | SourceArray is null. -or- DestinationArray is null.
RankException | SourceArray and DestinationArray have different ranks.
ArrayTypeMismatchException | SourceArray and DestinationArray are incompatible types.
InvalidCastException | At least one element in SourceArray cannot be cast to the type of DestinationArray.
ArgumentOutOfRangeException | SourceIndex is less than the lower-bound of the first dimension of SourceArray. -or- DestinationIndex is less than the lower-bound of the first dimension of DestinationArray. -or- Length is less than zero.
ArgumentException | Length is greater than the number of elements from SourceIndex to the end of SourceArray. -or- Length is greater than the number of elements from DestinationIndex to the end of DestinationArray.

Examples

The following code example uses CorArray.Copy and CorArray.CopyEx to copy elements between an Integer array and a Variant array.

Public Sub Main()
    Dim MyIntArray() As Integer
    Dim MyVarArray() As Variant

    ' Creates and initializes a new Integer array and a new Variant array.
    MyIntArray = NewIntegers(1, 2, 3, 4, 5)
    MyVarArray = NewVariants(26, 27, 28, 29, 30)

    ' Prints the initial values of both arrays.
    Debug.Print "Initially,"
    Debug.Print "Integer Array: ";
    PrintValues MyIntArray
    Debug.Print "Variant Array: ";
    PrintValues MyVarArray

    ' Copies the first two elements from the Integer array to the Variant array.
    CorArray.Copy MyIntArray, MyVarArray, 2

    ' Prints the values of the modified arrays.
    Debug.Print t("\nAfter copying the first two elements of the Integer array to the Variant array,")
    Debug.Print "Integer Array: ";
    PrintValues MyIntArray
    Debug.Print "Variant Array: ";
    PrintValues MyVarArray

    ' Copies the last two elements from the Object array to the integer array.
    CorArray.CopyEx MyVarArray, UBound(MyVarArray) - 1, MyIntArray, UBound(MyIntArray) - 1, 2

    ' Prints the values of the modified arrays.
    Debug.Print t("\nAfter copying the last two elements of the Object array to the integer array,")
    Debug.Print "Integer Array: ";
    PrintValues MyIntArray
    Debug.Print "Variant Array: ";
    PrintValues MyVarArray
End Sub

Private Sub PrintValues(ByRef MyArr As Variant)
    Dim Value As Variant

    For Each Value In MyArr
        Debug.Print CorString.Format("{0,5}", Value);
    Next

    Debug.Print
End Sub

' The code example produces the following output.
'    Initially,
'    Integer Array:     1    2    3    4    5
'    Variant Array:    26   27   28   29   30
'
'    After copying the first two elements of the Integer array to the Variant array,
'    Integer Array:     1    2    3    4    5
'    Variant Array:     1    2   28   29   30
'
'    After copying the last two elements of the Object array to the integer array,
'    Integer Array:     1    2    3   29   30
'    Variant Array:     1    2   28   29   30

See Also

Project CorLib Overview

Class CorArray Overview

Copy


CorArray: CreateInstance

CreateInstance

Initializes a new array of the specified type in up to 3 dimensions.

 Public Function CreateInstance(
      ByVal ElementType As VbVarType,
      Optional ByVal Length1 As Long = 0,
      Optional ByRef Length2 As Variant,
      Optional ByRef Length3 As Variant ) As Variant

Parameters

ElementType
[ByVal] VbVarType. The data type the array represents.
Length1
[ByVal] Optional. Long. The number of elements in the first dimension.

Default: 0

Length2
[ByRef] Optional. Variant. The number of elements in the second dimension.
Length3
[ByRef] Optional. Variant. The number of elements in the third dimension.

Return Values

Variant - An array of the specified type with the specified dimensions.

Remarks

If a length is zero, then an empty array is returned, not a Null array. If one length is defined as zero, then all other defined lengths must be zero. This does not mean that lengths 2 and 3 need to be set to zero if only an empty one-dimensional array is being created.

Exceptions

Exception | Condition
ArgumentException | ElementType is not a valid type.
ArgumentOutOfRangeException | Length1 is less than zero. -or- Length2 is less than zero. -or- Length3 is less than zero.

See Also

Project CorLib Overview

Class CorArray Overview


CorArray: Exists

Exists

Determines whether the specified array contains elements that match the conditions defined by the specified predicate.

 Public Function Exists(
      ByRef Arr As Variant,
      ByVal AddressOfPredicate As Long ) As Boolean

Parameters

Arr
[ByRef] Variant. The one-dimensional array to search.
AddressOfPredicate
[ByVal] Long. The AddressOf a callback method used to determine if an element matches the specified criteria.

Return Values

Boolean - True if Arr contains one or more elements that match the conditions defined by the specified predicate callback; otherwise, False.

Remarks

The AddressOfPredicate is an address to a method that returns True if the value passed to it matches the conditions defined in the callback method. The elements of Arr are individually passed to the callback method, and processing is stopped when a match is found.

The callback method should have a signature resembling the following:

 Public Function CallbackMethod(ByRef Value As <Type>) As Boolean
   ' Evaluate value
 End Function

It has one parameter that is defined as ByRef and should be the same type as the elements in the array to be searched.

It is extremely important to define the callback method correctly. If the method is incorrect, the application may crash.

Examples

The following code uses the callback Person18OrOlder with the Exists method to search an array of Longs. The callback method is passed individual values representing a persons age and returns True if the age is of an adult or False if not.

Public Sub Main()
    Dim Ages() As Long
    Dim Found As Boolean

    Ages = NewLongs(4, 16, 10, 22, 14, 19)

    Found = CorArray.Exists(Ages, AddressOf Person18OrOlder)

    Debug.Print "There is at least one adult: " & Found
End Sub

Private Function Person18OrOlder(ByRef Age As Long) As Boolean
    Person18OrOlder = Age >= 18
End Function

' The code example produces the following output.
'  There is at least one adult: True

See Also

Project CorLib Overview

Class CorArray Overview

Find

FindIndex

FindLast

FindLastIndex

FindAll


CorArray: Find

Find

Uses a callback method to search an array for the first element that matches the criteria.

 Public Function Find(
      ByRef Arr As Variant,
      ByVal AddressOfPredicate As Long ) As Variant

Parameters

Arr
[ByRef] Variant. The one-dimensional array to search.
AddressOfPredicate
[ByVal] Long. The callback method address used to determine if an element matches the specified criteria.

Return Values

Variant - The element value if a match is found, otherwise a default for that element type.

Remarks

The AddressOfPredicate is an address to a method that returns True if the value passed to it matches the conditions defined in the callback method. The elements of Arr are individually passed to the callback method, and processing is stopped when a match is found.

The callback method should have a signature resembling the following:

 Public Function CallbackMethod(ByRef Value As <Type>) As Boolean
   ' Evaluate value
 End Function

It has one parameter that is defined as ByRef and should be the same type as the elements in the array to be searched.

It is extremely important to define the callback method correctly. If the method is incorrect, the application may crash.

Examples

The following example will search a given array for the first age that is over 25.

The result does not return the position of the found element, only the element itself.

Private Sub Main()
    Dim Ages() As Long
    Dim Age As Long

    Ages = NewLongs(14, 22, 31, 27, 18)

    ' To find the first age over 25, pass the array and
    ' address of the callback method to CorArray.Find.
    Age = CorArray.Find(Ages, AddressOf AgeOver25)

    ' Dispay the index of the first age found.
    Debug.Print "The first age over 25 found: " & Age
End Sub

' The method accepts a ByRef parameter of the array element type.
Private Function AgeOver25(ByRef Age As Long) As Boolean
    AgeOver25 = Age > 25
End Function

' This code example produces the following output.
'    The index of the first age over 25 found: 2

See Also

Project CorLib Overview

Class CorArray Overview

Exists

FindIndex

FindLast

FindLastIndex

FindAll


CorArray: FindAll

FindAll

Retrieves all the elements that match the conditions defined by the specified callback method.

 Public Function FindAll(
      ByRef Arr As Variant,
      ByVal AddressOfPredicate As Long ) As Variant

Parameters

Arr
[ByRef] Variant. The one-dimensional array to find all matching elements.
AddressOfPredicate
[ByVal] Long. The callback address of the matching criteria method.

Return Values

Variant - An array of all matched elements.

Remarks

The AddressOfPredicate is an address to a method that returns True if the value passed to it matches the conditions defined in the callback method. All elements of Arr are individually passed to the callback method and includes in the result if they match the criteria.

The callback method should have a signature resembling the following:

 Public Function CallbackMethod(ByRef Value As <Type>) As Boolean
   ' Evaluate value
 End Function

It has one parameter that is defined as ByRef and should be the same type as the elements in the array to be searched.

It is extremely important to define the callback method correctly. If the method is incorrect, the application may crash.

The returned array is of the same type as Arr.

Examples

The following example will search a given array for all ages that are over 25.

The result will return an array of Longs containing the matched values.

Private Sub Main()
    Dim Ages() As Long
    Dim AgesOver25() As Long
    Dim Age As Variant

    Ages = NewLongs(14, 22, 31, 27, 18)

    ' To find all ages over 25, pass the array and
    ' address of the callback method to CorArray.FindAll.
    AgesOver25 = CorArray.FindAll(Ages, AddressOf AgeOver25)

    ' Dispay all the ages found.
    Debug.Print "All ages over 25: "

    For Each Age In AgesOver25
        Debug.Print Age
    Next
End Sub

' The method accepts a ByRef parameter of the array element type.
Private Function AgeOver25(ByRef Age As Long) As Boolean
    AgeOver25 = Age > 25
End Function

' This code example produces the following output.
'  All ages over 25:
'   31
'   27

See Also

Project CorLib Overview

Class CorArray Overview

Exists

Find

FindIndex

FindLast

FindLastIndex


CorArray: FindIndex

FindIndex

Searches for an element that matches the conditions defined by the specified callback method, and returns the lower-bound based index of the first occurrence within the range of elements in the array that starts at the specified index and contains the specified number of elements.

 Public Function FindIndex(
      ByRef Arr As Variant,
      ByVal AddressOfPredicate As Long,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Arr
[ByRef] Variant. The one-dimensional array to be searched.
AddressOfPredicate
[ByVal] Long. The address of the callback function used to match the array elements.
Index
[ByRef] Optional. Variant. The starting index of the search.
Count
[ByRef] Optional. Variant. The number of elements in the section to search.

Return Values

Long - The index of the first occurrence of an element that matches the conditions defined in the callback method, if found; otherwise the lower-bound of the array minus one.

Remarks

The AddressOfPredicate is an address to a method that returns True if the value passed to it matches the conditions defined in the callback method. The elements of Arr are individually passed to the callback method, and processing is stopped when a match is found.

The callback method should have a signature resembling the following:

 Public Function CallbackMethod(ByRef Value As <Type>) As Boolean
   ' Evaluate value
 End Function

It has one parameter that is defined as ByRef and should be the same type as the elements in the array to be searched.

It is extremely important to define the callback method correctly. If the method is incorrect, the application may crash.

The search is based on the array lower-bound, not zero-based.

Exceptions

Exception | Condition
ArgumentNullException | Arr is uninitialized.
ArgumentOutOfRangeException | StartIndex is outside the range of valid indexes for Arr. -or- Count is less than zero. -or- StartIndex and Count do not specify a valid section in Arr.

Examples

The following example will search a given array for the first age that is over 25 and return the index.

Private Sub Main()
    Dim Ages() As Long
    Dim Index As Long

    Ages = NewLongs(14, 22, 31, 27, 18)

    ' To find the index of the first age over 25, pass the array and
    ' address of the callback method to CorArray.FindIndex.
    Index = CorArray.FindIndex(Ages, AddressOf AgeOver25)

    ' Dispay the index found.
    Debug.Print "The first age over 25 found at index " & Index
End Sub

' The method accepts a ByRef parameter of the array element type.
Private Function AgeOver25(ByRef Age As Long) As Boolean
    AgeOver25 = Age > 25
End Function

' This code example produces the following output.
'  The first age over 25 found as index 2

See Also

Project CorLib Overview

Class CorArray Overview

Exists

Find

FindLast

FindLastIndex

FindAll


CorArray: FindLast

FindLast

Searches for an element that matches the conditions defined by the specified callback method, and returns the last occurrence within the entire array.

 Public Function FindLast(
      ByRef Arr As Variant,
      ByVal AddressOfPredicate As Long ) As Variant

Parameters

Arr
[ByRef] Variant. The array to search.
AddressOfPredicate
[ByVal] Long. A callback address of the matching criteria method.

Return Values

Variant - The last element in the array to match the criteria, or the default for the array type if no elements matched.

Remarks

The AddressOfPredicate is an address to a method that returns True if the value passed to it matches the conditions defined in the callback method. The elements of Arr are individually passed to the callback method, and processing is stopped when a match is found.

The callback method should have a signature resembling the following:

 Public Function CallbackMethod(ByRef Value As <Type>) As Boolean
   ' Evaluate value
 End Function

It has one parameter that is defined as ByRef and should be the same type as the elements in the array to be searched.

It is extremely important to define the callback method correctly. If the method is incorrect, the application may crash.

Examples

The following example will search a given array for the last occurrence of age that is over 25.

The result does not return the position of the found element, only the element itself.

Private Sub Main()
    Dim Ages() As Long
    Dim Age As Long

    Ages = NewLongs(14, 22, 31, 27, 18)

    ' To find the last age over 25, pass the array and
    ' address of the callback method to CorArray.FindLast.
    Age = CorArray.FindLast(Ages, AddressOf AgeOver25)

    ' Dispay the the last age over 25 found.
    Debug.Print "The last age over 25 found: " & Age
End Sub

' The method accepts a ByRef parameter of the array element type.
Private Function AgeOver25(ByRef Age As Long) As Boolean
    AgeOver25 = Age > 25
End Function

' This code example produces the following output.
'    The last age over 25 found: 27

See Also

Project CorLib Overview

Class CorArray Overview

Exists

Find

FindIndex

FindLastIndex

FindAll


CorArray: FindLastIndex

FindLastIndex

Finds the index of the last occurence of a matched element in the array.

 Public Function FindLastIndex(
      ByRef Arr As Variant,
      ByVal AddressOfPredicate As Long,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Arr
[ByRef] Variant. The one-dimensional array to search.
AddressOfPredicate
[ByVal] Long. The callback address of the matching criteria method.
Index
[ByRef] Optional. Variant. The starting index in the array to begin the backward search.
Count
[ByRef] Optional. Variant. The number of elements to search.

Return Values

Long - The index of the last occurence of the matched element.

Remarks

The AddressOfPredicate is an address to a method that returns True if the value passed to it matches the conditions defined in the callback method. The elements of Arr are individually passed to the callback method, and processing is stopped when a match is found.

The callback method should have a signature resembling the following:

 Public Function CallbackMethod(ByRef Value As <Type>) As Boolean
   ' Evaluate value
 End Function

It has one parameter that is defined as ByRef and should be the same type as the elements in the array to be searched.

It is extremely important to define the callback method correctly. If the method is incorrect, the application may crash.

Exceptions

Exception | Condition
ArgumentNullException | Arr is uninitialized.
ArgumentOutOfRangeException | StartIndex is outside the range of valid indexes for Arr. -or- Count is less than zero. -or- StartIndex and Count do not specify a valid section in Arr.

Examples

The following example will search a given array for the last age that is over 25 and return the index.

Private Sub Main()
    Dim Ages() As Long
    Dim Index As Long

    Ages = NewLongs(14, 22, 31, 27, 18)

    ' To find the index of the last age over 25, pass the array and
    ' address of the callback method to CorArray.FindLastIndex.
    Index = CorArray.FindLastIndex(Ages, AddressOf AgeOver25)

    ' Dispay the index found.
    Debug.Print "The last age over 25 found at index " & Index
End Sub

' The method accepts a ByRef parameter of the array element type.
Private Function AgeOver25(ByRef Age As Long) As Boolean
    AgeOver25 = Age > 25
End Function

' This code example produces the following output.
'  The last age over 25 found at index 3

See Also

Project CorLib Overview

Class CorArray Overview

Exists

Find

FindIndex

FindLast

FindAll


CorArray: ForEach

ForEach

Performs the specified action on each element of the specified array.

 Public Sub ForEach(
      ByRef Arr As Variant,
      ByVal AddressOfAction As Long )

Parameters

Arr
[ByRef] Variant. The one-dimensional array containing the elements to be processed.
AddressOfAction
[ByVal] Long. The callback address of the function to process an array element.

Remarks

The AddressOfAction is an address to a method that will perform an action on the value passed to it.

The callback method should have a signature resembling the following:

 Public Sub CallbackMethod(ByRef Value As <Type>)
   ' Perform action using Value
 End Sub

It has one parameter that is defined as ByRef and should be the same type as the elements in the array to be searched.

It is extremely important to define the callback method correctly. If the method is incorrect, the application may crash.

Exceptions

Exception | Condition
ArgumentNullException | Arr is uninitialized.
RankException | Arr has more than one dimension.

Examples

The following example shows how to use ForEach to display the squares of each element in an integer array.

Private Sub Main()
    Dim IntArray() As Integer

    IntArray = NewIntegers(2, 3, 4)

    CorArray.ForEach IntArray, AddressOf ShowSquares
End Sub

Private Sub ShowSquares(ByRef Value As Integer)
    Debug.Print CorString.Format("{0} squared = {1}", Value, Value * Value)
End Sub

' This code example produces the following output.
'   2 squared = 4
'   3 squared = 9
'   4 squared = 16

See Also

Project CorLib Overview

Class CorArray Overview


CorArray: GetLength

GetLength

Gets a 32-bit integer that represents the number of elements in the specified dimension of the array.

 Public Function GetLength(
      ByRef Arr As Variant,
      ByVal Dimension As Long ) As Long

Parameters

Arr
[ByRef] Variant. The array to get the dimension length from.
Dimension
[ByVal] Long. A one-based dimension of the array whose length needs to be determined.

Return Values

Long - A 32-bit integer that represents the number of elements in the specified dimension.

Remarks

An example of GetLength is GetLength(Arr, 1), which returns the number of elements in the first dimension of the array.

Exceptions

Exception | Condition
ArgumentException | Arr is not an array.
ArgumentNullException | Arr is an uninitialized array.
IndexOutOfRangeException | Dimension is less than one. -or- Dimension is greater than rank.

See Also

Project CorLib Overview

Class CorArray Overview

Length


CorArray: IndexOf

IndexOf

Returns the index of the first occurrence of a value in a one-dimensional Array or in a portion of the Array.

 Public Function IndexOf(
      ByRef Arr As Variant,
      ByRef Value As Variant,
      Optional ByRef StartIndex As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Arr
[ByRef] Variant. The one-dimensional array to search.
Value
[ByRef] Variant. The value to search for in the array.
StartIndex
[ByRef] Optional. Variant. The index to the element in the array to begin search from.
Count
[ByRef] Optional. Variant. The number of elements to search, starting from startindex.

Return Values

Long - Value indicating the index the value was found. If a value of less that the lower-bounds is returned, then the value was not found in the array.

See Also

Project CorLib Overview

Class CorArray Overview

LastIndexOf


CorArray: IsNull

IsNull

Returns if an array variable is uninitialized.

 Public Function IsNull(
      ByRef Arr As Variant ) As Boolean

Parameters

Arr
[ByRef] Variant. The array to test for initialization.

Return Values

Boolean - Returns True if the array is uninitialized, False otherwise.

Exceptions

Exception | Condition
ArgumentException | Arr is not an array.

See Also

Project CorLib Overview

Class CorArray Overview

IsNullOrEmpty


CorArray: IsNullOrEmpty

IsNullOrEmpty

Returns if the array variable is unitialized(null) or empty(no elements).

 Public Function IsNullOrEmpty(
      ByRef Arr As Variant ) As Boolean

Parameters

Arr
[ByRef] Variant. The array to inspectd.

Return Values

Boolean - Returns True if the array is unitialized or has zero elements, False otherwise.

Exceptions

Exception | Condition
ArgumentException | Arr is not an array.

See Also

Project CorLib Overview

Class CorArray Overview

IsNull


CorArray: LastIndexOf

LastIndexOf

Returns the index of the last occurrence of a value in a one-dimensional Array or in a portion of the Array.

 Public Function LastIndexOf(
      ByRef Arr As Variant,
      ByRef Value As Variant,
      Optional ByRef StartIndex As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Arr
[ByRef] Variant. The array to search.
Value
[ByRef] Variant. The value to search for in the array.
StartIndex
[ByRef] Optional. Variant. The index to the element in the array to begin search from.
Count
[ByRef] Optional. Variant. The number of elements to search, starting from startindex.

Return Values

Long - Value indicating the index the value was found. If no value was found, then one less than the lower bound of the array is returned.

See Also

Project CorLib Overview

Class CorArray Overview

IndexOf


CorArray: Length

Length

Gets a 32-bit integer that represents the total number of elements in all dimensions of the array.

 Public Function Length(
      ByRef Arr As Variant ) As Long

Parameters

Arr
[ByRef] Variant. The array to retrieve the number of elements from.

Return Values

Long - A 32-bit integer that represents the total number of elements in all the dimensions of Arr; zero if there are no elements in the array.

See Also

Project CorLib Overview

Class CorArray Overview

GetLength


CorArray: Rank

Rank

Returns the number of dimensions in the array.

 Public Function Rank(
      ByRef Arr As Variant ) As Long

Parameters

Arr
[ByRef] Variant. The array to retrieve the number of dimensions from.

Return Values

Long - The number of dimension in the array.

See Also

Project CorLib Overview

Class CorArray Overview


CorArray: Reverse

Reverse

Reverses the elements in a subportion of an array.

 Public Sub Reverse(
      ByRef Arr As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant )

Parameters

Arr
[ByRef] Variant. The array to reverse.
Index
[ByRef] Optional. Variant. The starting element to begin reversing elements.
Count
[ByRef] Optional. Variant. The number of elements to reverse in the array.

See Also

Project CorLib Overview

Class CorArray Overview


CorArray: Sort

Sort

Sorts an entire array. An optionally supplied comparer object can be used to compare special elements, such as userdefined values.

 Public Sub Sort(
      ByRef Arr As Variant,
      Optional ByRef Comparer As Variant )

Parameters

Arr
[ByRef] Variant. The array to sort.
Comparer
[ByRef] Optional. Variant. (Optional) An IComparer object or address of a comparer callback function.

Remarks

The Comparer parameter can be an IComparer interface or a callback address to a compare function using the AddressOf method.
Callback Method Signature
Public Function SortCallback(ByRef x As <Type>, ByRef y As <Type>) As Long
    ' return less than zero if x is less than y.
    ' return greater than zero if x is greater than y.
    ' return zero if x equals y.
End Function
The <Type> the type of element of the array. If the array is an array of Variants, then <Type> would be a Variant, not any specific sub-type within the variant elements of the array.

Examples

This example creates an array of unsorted integers then uses the CorArray.Sort method to sort the array, displaying the results.

Private Sub Main()
    Dim ints(9) As Integer
    Dim i As Long

    ' Fill array with random values.
    Rnd -13
    For i = 0 To UBound(ints)
        ints(i) = Rnd * 10
    Next i

    ' Display original unsorted array of integers.
    Debug.Print "Unsorted Array of Integers."
    DisplayInts ints

    ' Sort array of integers.
    CorArray.Sort ints

    ' Display sorted array of integers.
    Debug.Print t("\nSorted Array of Integers.")
    DisplayInts ints
End Sub

' Displays an array of integers.
Private Sub DisplayInts(ByRef ints() As Integer)
    Dim i As Long

    For i = LBound(ints) To UBound(ints)
        Debug.Print CorString.Format("ints({0}) = {1}", i, ints(i))
    Next i
End Sub

' This code produces the following output.
'
'  Unsorted Array of Integers.
'  ints(0) = 6
'  ints(1) = 4
'  ints(2) = 0
'  ints(3) = 3
'  ints(4) = 9
'  ints(5) = 7
'  ints(6) = 1
'  ints(7) = 0
'  ints(8) = 4
'  ints(9) = 9
'
'  Sorted Array of Integers.
'  ints(0) = 0
'  ints(1) = 0
'  ints(2) = 1
'  ints(3) = 3
'  ints(4) = 4
'  ints(5) = 4
'  ints(6) = 6
'  ints(7) = 7
'  ints(8) = 9
'  ints(9) = 9

See Also

Project CorLib Overview

Class CorArray Overview

IComparer

SortEx

SortKey

SortKeyEx


CorArray: SortEx

SortEx

Sorts an array, or subportion, given a startindex and length. An optionally supplied comparer object can be used to compare special elements, such as userdefined values.

 Public Sub SortEx(
      ByRef Arr As Variant,
      ByVal Index As Long,
      ByVal Length As Long,
      Optional ByRef Comparer As Variant )

Parameters

Arr
[ByRef] Variant. The array to sort.
Index
[ByVal] Long. The starting index in the array to start sorting.
Length
[ByVal] Long. The number of elements to be sorted.
Comparer
[ByRef] Optional. Variant. An IComparer object or address of a comparer callback function.

Remarks

The Comparer parameter can be an IComparer interface or a callback address to a compare function using the AddressOf method. The callback method signature is defined as follows:

 Public Function SortCallback(ByRef x As <Type>, ByRef y As <Type>) As Long
     ' return less than zero if x is less than y.
     ' return greater than zero if x is greater than y.
     ' return zero if x equals y.
 End Function
The <Type> the type of element of the array. If the array is an array of Variants, then <Type> would be a Variant, not any specific sub-type within the variant elements of the array.

See Also

Project CorLib Overview

Class CorArray Overview

IComparer

Sort

SortKey

SortKeyEx


CorArray: SortKey

SortKey

Sorts an entire array based on an array of keys. An optionally supplied comparer object can be used to compare special elements, such as userdefined values.

 Public Sub SortKey(
      ByRef Keys As Variant,
      ByRef Items As Variant,
      Optional ByRef Comparer As Variant )

Parameters

Keys
[ByRef] Variant. An array the sorting is based on.
Items
[ByRef] Variant. An array that is sorted based on the sorting of keys.
Comparer
[ByRef] Optional. Variant. (Optional) An IComparer object or address of a comparer callback function.

Remarks

The Comparer parameter can be an IComparer interface or a callback address to a compare function using the AddressOf method. The callback method signature is defined as follows:

 Public Function SortCallback(ByRef x As <Type>, ByRef y As <Type>) As Long
     ' return less than zero if x is less than y.
     ' return greater than zero if x is greater than y.
     ' return zero if x equals y.
 End Function
The <Type> the type of element of the array. If the array is an array of Variants, then <Type> would be a Variant, not any specific sub-type within the variant elements of the array.

Examples

This example demonstrates how an array can be sorted by using another array to determine the sort order for the original. This demonstration uses an array of type vbLong as the keys to sort the main Values array. Even though Values is a vbString type array, it will follow the Keys array when being sorted. Once the array is sorted using the Keys vbLong array, the Values array is displayed to show how the array did not sort using string text compare. The Values array is then sorted again using the standard sort method on the Values vbString type array and re-displayed. This will show the difference between sorting using a Keys array of a different type to sort an original array and how the original array itself would be sorted on its own.

Private Sub Main()
    Dim Values(14) As String
    Dim Keys(14) As Long

    ' Fill both arrays with random values.
    FillKeysAndValues Keys, Values

    ' Display the current order of the values array.
    DisplayValues "Unsorted Values Array.", Values

    ' Sort the values array using the keys array
    ' to determine the sort order.
    CorArray.SortKey Keys, Values

    ' Display the new sorted values array.
    ' The values are sorted numerically because the
    ' keys array is a numeric array.
    DisplayValues t("\nSorted Values array using Keys array for sort order."), Values

    ' Re-sort the values array by itself.
    ' The values are sorted as strings.
    CorArray.Sort Values

    ' Display the re-sorted values array, showing
    ' the how string comparing affects sort order.
    DisplayValues t("\nRe-sorted Values array using standard sorting with String compares."), Values
End Sub

' Fill Keys and Values array.
Private Sub FillKeysAndValues(ByRef Keys() As Long, ByRef Values() As String)
    Dim i As Long

    Rnd -13
    For i = LBound(Keys) To UBound(Keys)
        Keys(i) = Rnd * i
        Values(i) = "Value " & Keys(i)
    Next i
End Sub

' Display Array
Private Sub DisplayValues(ByVal Title As String, ByRef Values() As String)
    Dim i As Long

    Debug.Print Title
    For i = LBound(Values) To UBound(Values)
        Debug.Print CorString.Format("  Values({0}) = {1}", i, Values(i))
    Next i
End Sub

' This code produces the following output.
'
'    Unsorted Values Array.
'      Values(0) = Value 0
'      Values(1) = Value 0
'      Values(2) = Value 0
'      Values(3) = Value 1
'      Values(4) = Value 4
'      Values(5) = Value 3
'      Values(6) = Value 1
'      Values(7) = Value 0
'      Values(8) = Value 3
'      Values(9) = Value 8
'      Values(10) = Value 8
'      Values(11) = Value 8
'      Values(12) = Value 10
'      Values(13) = Value 10
'      Values(14) = Value 6
'
'    Sorted Values array using Keys array for sort order.
'      Values(0) = Value 0
'      Values(1) = Value 0
'      Values(2) = Value 0
'      Values(3) = Value 0
'      Values(4) = Value 1
'      Values(5) = Value 1
'      Values(6) = Value 3
'      Values(7) = Value 3
'      Values(8) = Value 4
'      Values(9) = Value 6
'      Values(10) = Value 8
'      Values(11) = Value 8
'      Values(12) = Value 8
'      Values(13) = Value 10
'      Values(14) = Value 10
'
'    Re-sorted Values array using standard sorting with String compares.
'      Values(0) = Value 0
'      Values(1) = Value 0
'      Values(2) = Value 0
'      Values(3) = Value 0
'      Values(4) = Value 1
'      Values(5) = Value 1
'      Values(6) = Value 10
'      Values(7) = Value 10
'      Values(8) = Value 3
'      Values(9) = Value 3
'      Values(10) = Value 4
'      Values(11) = Value 6
'      Values(12) = Value 8
'      Values(13) = Value 8
'      Values(14) = Value 8
As you can see, the Values string array sorted as if numeric when using the Keys array to be sorted by. When it was sorted alone, it was sorted as a string array and the Value 10' appears in its string compared index.

See Also

Project CorLib Overview

Class CorArray Overview

IComparer

Sort

SortEx

SortKeyEx


CorArray: SortKeyEx

SortKeyEx

Sorts an array based on an array of keys. A subportion of the array can be sorted given a startindex and length. An optionally, supplied comparer object can be used to compare special elements, such as userdefined values.

 Public Sub SortKeyEx(
      ByRef Keys As Variant,
      ByRef Items As Variant,
      ByVal Index As Long,
      ByVal Length As Long,
      Optional ByRef Comparer As Variant )

Parameters

Keys
[ByRef] Variant. An array the sorting is based on.
Items
[ByRef] Variant. An array that is sorted based on the sorting of keys.
Index
[ByVal] Long. The starting index in the array to start sorting.
Length
[ByVal] Long. The number of elements to be sorted.
Comparer
[ByRef] Optional. Variant. (Optional) An IComparer object or address of a comparer callback function.

Remarks

The Comparer parameter can be an IComparer interface or a callback address to a compare function using the AddressOf method. The callback method signature is defined as follows:

 Public Function SortCallback(ByRef x As <Type>, ByRef y As <Type>) As Long
     ' return less than zero if x is less than y.
     ' return greater than zero if x is greater than y.
     ' return zero if x equals y.
 End Function
The <Type> the type of element of the array. If the array is an array of Variants, then <Type> would be a Variant, not any specific sub-type within the variant elements of the array.

See Also

Project CorLib Overview

Class CorArray Overview

IComparer

Sort

SortEx

SortKey


CorArray: TrueForAll

TrueForAll

Determines whether every element in the array matches the conditions defined by the specified callback method.

 Public Function TrueForAll(
      ByRef Arr As Variant,
      ByVal AddressOfPredicate As Long ) As Boolean

Parameters

Arr
[ByRef] Variant. The array to check against the conditions.
AddressOfPredicate
[ByVal] Long. The callback address used to match the criteria.

Return Values

Boolean - True if every element in array matches the conditions defined by the specified predicate; otherwise, False. If there are no elements in the array, the return value is True.

Remarks

The AddressOfPredicate is an address to a method that returns True if the value passed to it matches the conditions defined in the callback method. The elements of Arr are individually passed to the callback method, and processing is stopped when the method returns False for any element.

The callback method should have a signature resembling the following:

 Public Function CallbackMethod(ByRef Value As <Type>) As Boolean
   ' Evaluate value
 End Function

It has one parameter that is defined as ByRef and should be the same type as the elements in the array to be searched.

It is extremely important to define the callback method correctly. If the method is incorrect, the application may crash.

Exceptions

Exception | Conditioni
ArgumentNullException | Arr is uninitialized
RankException | Arr has more than one dimension.

Examples

The following code example checks two arrays for containing only ages 18 or older.

Private Sub Main()
    Dim Adults() As Long
    Dim Mixed() As Long

    Adults = NewLongs(22, 45, 37, 62, 18)
    Mixed = NewLongs(29, 33, 16, 49, 13)

    Debug.Print "Adults array has only adults:"
    Debug.Print CorArray.TrueForAll(Adults, AddressOf Age18OrOlder)

    Debug.Print t("\nMixed array has only adults:")
    Debug.Print CorArray.TrueForAll(Mixed, AddressOf Age18OrOlder)
End Sub

' The method accepts a ByRef parameter of the array element type.
Private Function Age18OrOlder(ByRef Age As Long) As Boolean
    Age18OrOlder = Age >= 18
End Function

' This code example produces the following output.
'    Adults array has only adults:
'    True
'
'    Mixed array has only adults:
'    False

See Also

Project CorLib Overview

Class CorArray Overview


CorDateTime

CorDateTime

Represents a point in time.

Implements:

IComparable
IFormattable
IObject

Public:

Properties:

Name | Description
DateOnly (get) | Returns the date portion of the current date representation.
Day (get) | Returns the Day part of the current date representation.
DayOfWeek (get) | Returns the day of the week for the current date.
DayOfYear (get) | Returns the day within the calendar year.
Hour (get) | Returns the Hour part of the current date representation.
IsDayLightSavingsTime (get) | Returns if this CorDateTime instance is currently in daylight savings time.
Kind (get) | Returns the DateTimeKind of CorDateTime.
Millisecond (get) | Returns the Millisecond part of the current date representation.
Minute (get) | Returns the Minute part of the current date representation.
Month (get) | Returns the Month part of the current date representation.
Second (get) | Returns the Second part of the current date representation.
Ticks (get) | Returns the whole date represented in ticks.
TimeOfDay (get) | Returns the time portion of the current date representation.
TotalMilliseconds (get) | Returns the whole date represented in milliseconds.
Year (get) | Returns the Year part of the current date representation.

Methods:

Name | Description
Add | Adds a specified amount of time to the current date, returning a new CorDateTime instance with the calcuated value.
AddDays | Adds a specified number of days to the current date, returning a new CorDateTime instance with the calcuated value.
AddHours | Adds a specified number of hours to the current date, returning a new CorDateTime instance with the calcuated value.
AddMilliseconds | Adds a specified number of milliseconds to the current date, returning a new CorDateTime instance with the calcuated value.
AddMinutes | Adds a specified number of minutes to the current date, returning a new CorDateTime instance with the calcuated value.
AddMonths | Adds a specified number of months to the current date, returning a new CorDateTime instance with the calcuated value.
AddSeconds | Adds a specified number of seconds to the current date, returning a new CorDateTime instance with the calcuated value.
AddTicks | Adds a specified number of ticks to the current date, returning a new CorDateTime instance with the calcuated value.
AddYears | Adds a specified number of years to the current date., returning a new CorDateTime instance with the calcuated value.
CompareTo | Compares this instance to a passed in Date or CorDateTime instance.
Equals | Returns a boolean indicating if the value and this object instance are the same date.
EqualTo | Determines if this instance is equal to another CorDateTime object.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GreaterThan | Determines if this instance is greater than another CorDateTime object.
GreaterThanOrEqualTo | Determines if this instance is greater than or equal to another CorDateTime object.
LessThan | Determines if this instance is less than another CorDateTime object.
LessThanOrEqualTo | Determines if this instance is less than or equal to another CorDateTime object.
NotEqualTo | Determines if this instance is not equal to another CorDateTime object.
Subtract | Subtracts either a CorDateTime instance or a TimeSpan instance from this CorDateTime instance.
ToBinary | Returns a 64-bit representation of the time and kind.
ToFileTime | Converts the CorDateTime to a FileTime representation, adjusting for timezone.
ToFileTimeUtc | Converts the CorDateTime to a FileTime representation, ignoring the timezone offset.
ToLocalTime | Returns a CorDateTime with the timezone offset applied to this instance.
ToLongDateString | Returns the date formatted to the current cultures long date pattern.
ToLongTimeString | Returns the time formatted to the current cultures long time pattern.
ToOADate | Converts the current instance to an Ole Automation date representation that is normally used in Visual Basic.
ToShortDateString | Returns the date formatted to the current cultures short date pattern.
ToShortTimeString | Returns the time formatted to the current cultures short time pattern.
ToString | Formats a CorDateTime object or Date value in the pattern specified by the formatting command. If no command is specified, then G' is assumed. If the command cannot be found, then a custom pattern is assumed.
ToUniversalTime | Returns a CorDateTime with the timezone offset removed from this instance.

Remarks

The CorDateTime class can represent a point in time from 1/1/0001 12:00:00 AM to 12/31/9999 11:59:59 PM. The time is represented in a gregorian calendar set.

Examples

The following example code creates and displays a CorDateTime object with various output formats.

Public Sub Main()
    Dim dt As CorDateTime

    Set dt = NewDateTime(2003, 2, 3, 8, 0, 0)

    Debug.Print dt.ToString
    Debug.Print dt.ToShortDateString
    Debug.Print dt.ToLongDateString
    Debug.Print dt.ToShortTimeString
    Debug.Print dt.ToLongTimeString
End Sub

' This code produces the following output.
'
'    2/3/2003 8:00:00 AM
'    2/3/2003
'    Monday, February 3, 2003
'    8:00 AM
'    8:00:00 AM

See Also

Project CorLib Overview

Class CorDateTime Overview

Constructors

CorDateTimeStatic

DateTimeFormatInfo

TimeSpan

IComparable

IFormattable


CorDateTime: Add

Add

Adds a specified amount of time to the current date, returning a new CorDateTime instance with the calcuated value.

 Public Function Add(
      ByRef Value As TimeSpan ) As CorDateTime

Parameters

Value
[ByRef] TimeSpan. The amount of time to add.

Return Values

CorDateTime - The new CorDateTime object containing the new calculated time.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: AddDays

AddDays

Adds a specified number of days to the current date, returning a new CorDateTime instance with the calcuated value.

 Public Function AddDays(
      ByVal Value As Double ) As CorDateTime

Parameters

Value
[ByVal] Double. The number of days to add.

Return Values

CorDateTime - The new CorDateTime containing the calculated value.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: AddHours

AddHours

Adds a specified number of hours to the current date, returning a new CorDateTime instance with the calcuated value.

 Public Function AddHours(
      ByVal Value As Double ) As CorDateTime

Parameters

Value
[ByVal] Double. The number of hours to add.

Return Values

CorDateTime - The new CorDateTime instance containing the calculated value.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: AddMilliseconds

AddMilliseconds

Adds a specified number of milliseconds to the current date, returning a new CorDateTime instance with the calcuated value.

 Public Function AddMilliseconds(
      ByVal Value As Double ) As CorDateTime

Parameters

Value
[ByVal] Double. The number of milliseconds to add.

Return Values

CorDateTime - The new CorDateTime containing the new calculated time.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: AddMinutes

AddMinutes

Adds a specified number of minutes to the current date, returning a new CorDateTime instance with the calcuated value.

 Public Function AddMinutes(
      ByVal Value As Double ) As CorDateTime

Parameters

Value
[ByVal] Double. The number of minutes to add.

Return Values

CorDateTime - The new CorDateTime instance containing the calculated value.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: AddMonths

AddMonths

Adds a specified number of months to the current date, returning a new CorDateTime instance with the calcuated value.

 Public Function AddMonths(
      ByVal Months As Long ) As CorDateTime

Parameters

Months
[ByVal] Long. The number of months to be added.

Return Values

CorDateTime - The new CorDateTime instance containing the calculated value.

Remarks

If the new month does not have as many days in it as the original month, then the day is set to the last day of the new month if it exceeds the maximum number of days for the new month.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: AddSeconds

AddSeconds

Adds a specified number of seconds to the current date, returning a new CorDateTime instance with the calcuated value.

 Public Function AddSeconds(
      ByVal Value As Double ) As CorDateTime

Parameters

Value
[ByVal] Double. The number of seconds to be added.

Return Values

CorDateTime - The new CorDateTime instance containing the calculated value.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: AddTicks

AddTicks

Adds a specified number of ticks to the current date, returning a new CorDateTime instance with the calcuated value.

 Public Function AddTicks(
      ByRef Value As Variant ) As CorDateTime

Parameters

Value
[ByRef] Variant. The number of ticks to be added.

Return Values

CorDateTime - the new CorDateTime instance containing the calcuated value.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: AddYears

AddYears

Adds a specified number of years to the current date., returning a new CorDateTime instance with the calcuated value.

 Public Function AddYears(
      ByVal Value As Long ) As CorDateTime

Parameters

Value
[ByVal] Long. The number of years to be added.

Return Values

CorDateTime - The new CorDateTime instance containing the calculated value.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: CompareTo

CompareTo

Compares this instance to a passed in Date or CorDateTime instance.

 Public Function CompareTo(
      ByRef Value As Variant ) As Long

Parameters

Value
[ByRef] Variant. The Date or CorDateTime value to compare against this instance.

Return Values

Long - A value indicating the relation to the passed in value. Negative indicates this instance is less than the argument, zero indicates the two values are equal, and positive indicates this value is greater than the argument.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: DateOnly (get)

DateOnly

Returns the date portion of the current date representation.

 Public Property Get DateOnly ( ) As CorDateTime

Return Values

CorDateTime - The date portion.

Remarks

The date portion does not include the time portion from the original date representation. The new date will have a time of 12:00AM.

Read Only.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: Day (get)

Day

Returns the Day part of the current date representation.

 Public Property Get Day ( ) As Long

Return Values

Long - The day of the date.

Read Only.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: DayOfWeek (get)

DayOfWeek

Returns the day of the week for the current date.

 Public Property Get DayOfWeek ( ) As DayOfWeek

Return Values

DayOfWeek - The day of the week.

Remarks

The DayOfWeek is zero based and therefore not directly compatible with vbDayOfWeek. 1 must be added to align to the 1-based values of vbDayOfWeek.

Read Only.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: DayOfYear (get)

DayOfYear

Returns the day within the calendar year.

 Public Property Get DayOfYear ( ) As Long

Return Values

Long - The day within the year.

Remarks

The value is calculated using the Gregorian calendar, and will range from 1-365 or 1-366 for leap years.

Read Only.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same date.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: EqualTo

EqualTo

Determines if this instance is equal to another CorDateTime object.

 Public Function EqualTo(
      ByVal Value As CorDateTime ) As Boolean

Parameters

Value
[ByVal] CorDateTime. The CorDateTime object to compare against.

Return Values

Boolean - Returns True if this object is equal to the Value object.

Remarks

This is provided for quick comprisons of two CorDateTime Objects.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: GreaterThan

GreaterThan

Determines if this instance is greater than another CorDateTime object.

 Public Function GreaterThan(
      ByVal Value As CorDateTime ) As Boolean

Parameters

Value
[ByVal] CorDateTime. The CorDateTime object to compare against.

Return Values

Boolean - Returns True if this object is greater than the Value object.

Remarks

This is provided for quick comparisions of two CorDateTime objects.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: GreaterThanOrEqualTo

GreaterThanOrEqualTo

Determines if this instance is greater than or equal to another CorDateTime object.

 Public Function GreaterThanOrEqualTo(
      ByVal Value As CorDateTime ) As Boolean

Parameters

Value
[ByVal] CorDateTime. The CorDateTime object to compare against.

Return Values

Boolean - Returns True if this object is greater than or equal to the Value object.

Remarks

This is provided for quick comprisons of two CorDateTime Objects.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: Hour (get)

Hour

Returns the Hour part of the current date representation.

 Public Property Get Hour ( ) As Long

Return Values

Long - The current hour.

Read Only.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: IComparable

IComparable

 Implements IComparable

Return Values

IComparable -

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: IFormattable

IFormattable

 Implements IFormattable

Return Values

IFormattable -

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: IsDayLightSavingsTime (get)

IsDayLightSavingsTime

Returns if this CorDateTime instance is currently in daylight savings time.

 Public Property Get IsDayLightSavingsTime ( ) As Boolean

Return Values

Boolean - If this instance is in daylight savings.

Remarks

This uses the current time zone settings of the system to determine when daylight savings should be.

Read Only.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: Kind (get)

Kind

Returns the DateTimeKind of CorDateTime.

 Public Property Get Kind ( ) As DateTimeKind

Return Values

DateTimeKind - The DateTimeKind.

Remarks

A CorDateTime can be Universal Coordinated Time (UTC), local time, or unspecified.

Read Only.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: LessThan

LessThan

Determines if this instance is less than another CorDateTime object.

 Public Function LessThan(
      ByVal Value As CorDateTime ) As Boolean

Parameters

Value
[ByVal] CorDateTime. The CorDateTime object to compare against.

Return Values

Boolean - Returns True if this object is less than the Value object.

Remarks

This is provided for quick comprisons of two CorDateTime Objects.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: LessThanOrEqualTo

LessThanOrEqualTo

Determines if this instance is less than or equal to another CorDateTime object.

 Public Function LessThanOrEqualTo(
      ByVal Value As CorDateTime ) As Boolean

Parameters

Value
[ByVal] CorDateTime. The CorDateTime object to compare against.

Return Values

Boolean - Returns True if this object is less than or equal to the Value object.

Remarks

This is provided for quick comprisons of two CorDateTime Objects.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: Millisecond (get)

Millisecond

Returns the Millisecond part of the current date representation.

 Public Property Get Millisecond ( ) As Long

Return Values

Long - The current millisecond.

Read Only.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: Minute (get)

Minute

Returns the Minute part of the current date representation.

 Public Property Get Minute ( ) As Long

Return Values

Long - The current minute.

Read Only.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: Month (get)

Month

Returns the Month part of the current date representation.

 Public Property Get Month ( ) As Long

Return Values

Long - The month of the date.

Read Only.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: NotEqualTo

NotEqualTo

Determines if this instance is not equal to another CorDateTime object.

 Public Function NotEqualTo(
      ByVal Value As CorDateTime ) As Boolean

Parameters

Value
[ByVal] CorDateTime. The CorDateTime object to compare against.

Return Values

Boolean - Returns True if this object is not equal to the Value object.

Remarks

This is provided for quick comprisons of two CorDateTime Objects.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: Second (get)

Second

Returns the Second part of the current date representation.

 Public Property Get Second ( ) As Long

Return Values

Long - The current second.

Read Only.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: Subtract

Subtract

Subtracts either a CorDateTime instance or a TimeSpan instance from this CorDateTime instance.

 Public Function Subtract(
      ByRef Value As Variant ) As Object

Parameters

Value
[ByRef] Variant. A CorDateTime or TimeSpan object to subtract from this instance.

Return Values

Object - If subtracting a CorDateTime object from this, then a TimeSpan representing the difference in time between the two is returned. If subtracting a TimeSpan object from this instance, then a new CorDateTime with a difference of the TimeSpan obect from this instance is returned.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: Ticks (get)

Ticks

Returns the whole date represented in ticks.

 Public Property Get Ticks ( ) As Variant

Return Values

Variant - The date in ticks.

Remarks

The return value is a Decimal containing the the number of whole ticks.

Read Only.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: TimeOfDay (get)

TimeOfDay

Returns the time portion of the current date representation.

 Public Property Get TimeOfDay ( ) As TimeSpan

Return Values

TimeSpan - The time portion.

Remarks

The time portion does not include the original date portion. It now will have a date of 1/1/0001.

Read Only.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: ToBinary

ToBinary

Returns a 64-bit representation of the time and kind.

 Public Function ToBinary ( ) As Currency

Return Values

Currency - 64-bit representation of the CorDateTime

Remarks

The upper 2 bits are used to represent the DateTimeKind of the object, the lower 62-bits are used to represent the ticks.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: ToFileTime

ToFileTime

Converts the CorDateTime to a FileTime representation, adjusting for timezone.

 Public Function ToFileTime ( ) As Currency

Return Values

Currency - The filetime representation of the CorDateTime.

Remarks

FileTime values cannot be less than 1/1/1601 12:00:00AM.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: ToFileTimeUtc

ToFileTimeUtc

Converts the CorDateTime to a FileTime representation, ignoring the timezone offset.

 Public Function ToFileTimeUtc ( ) As Currency

Return Values

Currency - The filetime representation of the CorDateTime.

Remarks

FileTime values cannot be less than 1/1/1601 12:00:00AM.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: ToLocalTime

ToLocalTime

Returns a CorDateTime with the timezone offset applied to this instance.

 Public Function ToLocalTime ( ) As CorDateTime

Return Values

CorDateTime - The CorDateTime object with the timezone offset applied.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: ToLongDateString

ToLongDateString

Returns the date formatted to the current cultures long date pattern.

 Public Function ToLongDateString ( ) As String

Return Values

String - Long date pattern formatted string.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: ToLongTimeString

ToLongTimeString

Returns the time formatted to the current cultures long time pattern.

 Public Function ToLongTimeString ( ) As String

Return Values

String - Long time pattern formatted string.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: ToOADate

ToOADate

Converts the current instance to an Ole Automation date representation that is normally used in Visual Basic.

 Public Function ToOADate ( ) As Date

Return Values

Date - The Visual Basic compatible date.

Remarks

It is possible that this instance holds a date outside of the valid range of dates that Visual Basic can represent. If this happens, then an OverflowException occurs.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: ToShortDateString

ToShortDateString

Returns the date formatted to the current cultures short date pattern.

 Public Function ToShortDateString ( ) As String

Return Values

String - Short date pattern formatted string.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: ToShortTimeString

ToShortTimeString

Returns the time formatted to the current cultures short time pattern.

 Public Function ToShortTimeString ( ) As String

Return Values

String - Short time pattern formatted string.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: ToString

ToString

Formats a CorDateTime object or Date value in the pattern specified by the formatting command. If no command is specified, then G' is assumed. If the command cannot be found, then a custom pattern is assumed.

 Public Function ToString(
      Optional ByRef Format As String,
      Optional ByVal Provider As IFormatProvider ) As String

Parameters

Format
[ByRef] Optional. String. The format inwhich the date should represent.
Provider
[ByVal] Optional. IFormatProvider. A formatting provider to format the date.

Return Values

String - String representing this instance.

Remarks

Formatting can be accomplished by either specifying a formatting command, or entering a custom date format.

D - LongDatePattern
d - ShortDateTimePattern
F - FullDateTimePattern (Long Date and Long Time)
f - Full date and time (Long Date and Short Time)
G - General (Short Date and Long Time)
g - General (Short Date and Short Time)
m,M - MonthDayPattern
r,R - RFC1123Pattern
s - SortableDateTimePattern
T - LongTimePattern
t - ShortTimePattern
U - Full Date and Time (Long Date, Long Time) using universal time
u - UniversalSortableDateTimePattern
y,Y - YearMonthPattern

See Also

Project CorLib Overview

Class CorDateTime Overview

DateTimeFormatInfo


CorDateTime: TotalMilliseconds (get)

TotalMilliseconds

Returns the whole date represented in milliseconds.

 Public Property Get TotalMilliseconds ( ) As Currency

Return Values

Currency - The number of milliseconds from 1/1/0001.

Remarks

The return value is Currency and can represent fractions of milliseconds called ticks. There are 10000 ticks per millisecond, so the fractional portion is the number of ticks.

Read Only.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: ToUniversalTime

ToUniversalTime

Returns a CorDateTime with the timezone offset removed from this instance.

 Public Function ToUniversalTime ( ) As CorDateTime

Return Values

CorDateTime - The CorDateTime object with the timezone offset removed.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTime: Year (get)

Year

Returns the Year part of the current date representation.

 Public Property Get Year ( ) As Long

Return Values

Long - The year of the date.

Read Only.

See Also

Project CorLib Overview

Class CorDateTime Overview


CorDateTimeStatic

CorDateTimeStatic

Represents methods to create CorDateTime objects from various data sources.

Public:

Types:

Name | Description
DateTimeKind | Used to specify the type of CorDateTime object.
DayOfWeek | This enumeration represents the days of the week as used by CorDateTime and Calendars.

Properties:

Name | Description
MaxValue (get) | Returns the maximum CorDateTime representation.
MinValue (get) | Returns the minimum CorDateTime representation.
Now (get) | Returns a CorDateTime that represents the current time on the local machine.
Today (get) | Returns a CorDateTime that represents only the current date. The time portion is not present.
UtcNow (get) | Returns a CorDateTime that represents the current time with the UTC offset.

Methods:

Name | Description
DaysInMonth | Returns the number of days in a Gregorian calendar month.
Equals | Returns a value indicating whether two Date or CorDateTime instances have the same date and time value.
FromBinary | Creates a CorDateTime object from a 64-bit currency value.
FromFileTime | Creates a CorDateTime object from an operating system file timestamp.
FromFileTimeUtc | Returns a CorDateTime object from a FileTime value.
FromMilliseconds | Returns a CorDateTime object from milliseconds.
FromOADate | Returns a CorDateTime object from a VB Date value.
IsLeapYear | Returns a boolean indicating if the specific Gregorian year is a leap year.
Parse | Parses a string representation of a date into a CorDateTime object.
SpecifyKind | Creates a new CorDateTime object with the specified DateTimeKind.
TryParse | Attempts to parse a string representation of a date into a CorDateTime object.

Remarks

These methods are considered static. The CorDateTimeStatic cannot be directly instantiated. to access the methods use the CorDateTime qualifier (e.g. CorDateTime.MaxValue.)

 Dim dt As CorDateTime
 Set dt = CorDateTime.FromOADate(#1/1/2001 8:30:00 AM#)

  A quicker way to create a CorDateTime object is to use the NewDate constructor.
 Set dt = NewDate(#1/1/2001 8:30:00 AM#)
This will create a new instance of CorDateTime with the supplied date value.

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview

CorDateTime


CorDateTimeStatic: DateTimeKind

DateTimeKind

Used to specify the type of CorDateTime object.

 Public Enum DateTimeKind

Values

UnspecifiedKind = 0
0
UtcKind = 1
1
LocalKind = 2
2

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview


CorDateTimeStatic: DayOfWeek

DayOfWeek

This enumeration represents the days of the week as used by CorDateTime and Calendars.

 Public Enum DayOfWeek

Values

Sunday
0
Monday
1
Tuesday
2
Wednesday
3
Thursday
4
Friday
5
Saturday
6

Remarks

The DayOfWeek is 0 based, where as VBs vbDayOfWeek is 1 based.

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview


CorDateTimeStatic: DaysInMonth

DaysInMonth

Returns the number of days in a Gregorian calendar month.

 Public Function DaysInMonth(
      ByVal Year As Long,
      ByVal Month As Long ) As Long

Parameters

Year
[ByVal] Long. The year the month is in.
Month
[ByVal] Long. The month to find the number of days for.

Return Values

Long - The number of days in the specified month.

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview


CorDateTimeStatic: Equals

Equals

Returns a value indicating whether two Date or CorDateTime instances have the same date and time value.

 Public Function Equals(
      ByRef t1 As Variant,
      ByRef t2 As Variant ) As Boolean

Parameters

t1
[ByRef] Variant. The first Date or CorDateTime to compare.
t2
[ByRef] Variant. The second Date or CorDateTime to compare.

Return Values

Boolean - true if their values are equal; otherwise, false

Remarks

t1 and t2 are equal if their TotalMilliseconds property values are equal. Their Kind property values are not considered in the test for equality.

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview


CorDateTimeStatic: FromBinary

FromBinary

Creates a CorDateTime object from a 64-bit currency value.

 Public Function FromBinary(
      ByVal Value As Currency ) As CorDateTime

Parameters

Value
[ByVal] Currency. The value to initialize the CorDateTime with.

Return Values

CorDateTime - A new CorDateTime object.

Remarks

The 64-bit value contains both the time in 100-nanosecond increments and the DateTimeKind value used to determine if the value is a UTC, Local Time, or unspecified time.

The upper 2-bits represent the DateTimeKind value.

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview


CorDateTimeStatic: FromFileTime

FromFileTime

Creates a CorDateTime object from an operating system file timestamp.

 Public Function FromFileTime(
      ByVal Time As Currency ) As CorDateTime

Parameters

Time
[ByVal] Currency. The file time in UTC time.

Return Values

CorDateTime - The CorDateTime of the file time converted to local time from UTC time.

Remarks

Time is a 64-bit integer representing a Windows file timestamp. Using a Currency datatype means the timestamp is represented as milliseconds with the fraction representing ticks of a millisecond. No conversion if performed. The 64-bit values is used as is.

The timestamp is the number of milliseconds (including the fractional tick portion) elasped since January 1, 1601 A.D. 12:00 A.M. coordinated universal time (UTC).

A tick is 100-nanoseconds. There are 10000 ticks per millisecond, equivalent to the number of fractional values in a Currency datatype.

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview


CorDateTimeStatic: FromFileTimeUtc

FromFileTimeUtc

Returns a CorDateTime object from a FileTime value.

 Public Function FromFileTimeUtc(
      ByVal Time As Currency ) As CorDateTime

Parameters

Time
[ByVal] Currency. The file time in UTC time.

Return Values

CorDateTime - The CorDateTime of the file time in UTC time.

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview


CorDateTimeStatic: FromMilliseconds

FromMilliseconds

Returns a CorDateTime object from milliseconds.

 Public Function FromMilliseconds(
      ByVal ms As Currency,
      Optional ByVal Kind As DateTimeKind = UnspecifiedKind ) As CorDateTime

Parameters

ms
[ByVal] Currency. The number of milliseconds the time is equal to.
Kind
[ByVal] Optional. DateTimeKind. Specifies whether the CorDateTime is a UTC, Local, or unspecified time type.

Default: UnspecifiedKind

Return Values

CorDateTime - The CorDateTime object converted from milliseconds.

Remarks

Since a Currency can be passed in, the fractional portion can be used to represent the number ticks (1/10000 ms) in the date.

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview


CorDateTimeStatic: FromOADate

FromOADate

Returns a CorDateTime object from a VB Date value.

 Public Function FromOADate(
      ByVal d As Date,
      Optional ByVal Kind As DateTimeKind = UnspecifiedKind ) As CorDateTime

Parameters

d
[ByVal] Date. The standard VB Date value.
Kind
[ByVal] Optional. DateTimeKind. Specifies whether the CorDateTime is a UTC, Local, or unspecified time type.

Default: UnspecifiedKind

Return Values

CorDateTime - The CorDateTime representation of the date.

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview


CorDateTimeStatic: IsLeapYear

IsLeapYear

Returns a boolean indicating if the specific Gregorian year is a leap year.

 Public Function IsLeapYear(
      ByVal Year As Long ) As Boolean

Parameters

Year
[ByVal] Long. The year to test for leap year.

Return Values

Boolean - Indication of leap year.

Remarks

Only the Gregorian calendar is supported through the CorDateTime functions. To determine leap years for other calendar types, an instance of the specific calendar will need to be used.

If the year is evenly divisible by 4 or 400 and not by 100 then it is a leap year.

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview


CorDateTimeStatic: MaxValue (get)

MaxValue

Returns the maximum CorDateTime representation.

 Public Property Get MaxValue ( ) As CorDateTime

Return Values

CorDateTime - The maximum CorDateTime.

Remarks

The maximum CorDateTime is "12/31/9999 11:59:59 PM".

Read Only.

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview


CorDateTimeStatic: MinValue (get)

MinValue

Returns the minimum CorDateTime representation.

 Public Property Get MinValue ( ) As CorDateTime

Return Values

CorDateTime - The minimum CorDateTime.

Remarks

The minimum CorDateTime is 1/1/0001 12:00:00 AM.

Read Only.

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview


CorDateTimeStatic: Now (get)

Now

Returns a CorDateTime that represents the current time on the local machine.

 Public Property Get Now ( ) As CorDateTime

Return Values

CorDateTime - The CorDateTime object representing the current time on the local machine.

Remarks

This method uses Windows GetLocalTime which has a resolution down to the milliseconds. If the milliseconds is not wanted, then either the Millisecond must be subtracted from the instance, or use CorDateTime.FromOADate passing the VB Now value.

Read Only.

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview


CorDateTimeStatic: Parse

Parse

Parses a string representation of a date into a CorDateTime object.

 Public Function Parse(
      ByRef s As String ) As CorDateTime

Parameters

s
[ByRef] String. The date string to be parsed.

Return Values

CorDateTime - A CorDateTime object created from the date string.

Remarks

The parse method simply uses CDate to parse the string.

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview


CorDateTimeStatic: SpecifyKind

SpecifyKind

Creates a new CorDateTime object with the specified DateTimeKind.

 Public Function SpecifyKind(
      ByVal Value As CorDateTime,
      ByVal Kind As DateTimeKind ) As CorDateTime

Parameters

Value
[ByVal] CorDateTime. The CorDateTime to convert to a specific kind.
Kind
[ByVal] DateTimeKind. Specifies whether the CorDateTime is a UTC, Local, or unspecified time type.

Return Values

CorDateTime - A new CorDateTime with the original date and new kind.

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview


CorDateTimeStatic: Today (get)

Today

Returns a CorDateTime that represents only the current date. The time portion is not present.

 Public Property Get Today ( ) As CorDateTime

Return Values

CorDateTime - The CorDateTime representing the date.

Remarks

The time is still there, just is only 12:00AM.

Read Only.

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview


CorDateTimeStatic: TryParse

TryParse

Attempts to parse a string representation of a date into a CorDateTime object.

 Public Function TryParse(
      ByRef s As String,
      ByRef Result As CorDateTime ) As Boolean

Parameters

s
[ByRef] String. The date string to be parsed.
Result
[ByRef] CorDateTime. The parameter to place the parsed date into.

Return Values

Boolean - A boolean indicating if the date was successfully parsed.

Remarks

This method will not throw an exception if the string cannot be parsed.

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview


CorDateTimeStatic: UtcNow (get)

UtcNow

Returns a CorDateTime that represents the current time with the UTC offset.

 Public Property Get UtcNow ( ) As CorDateTime

Return Values

CorDateTime - The CorDateTime object representing the current time with the UTC offset.

Remarks

This method uses Windows GetSystemTime which has a resolution down to the milliseconds. There is no direct VB equivalent.

Read Only.

See Also

Project CorLib Overview

Class CorDateTimeStatic Overview


CorMath

CorMath

Provides extended math functionality.

Public:

Properties:

Name | Description
e (get) | Represents the natural logarithmic base, specified by the constant, e.
PI (get) | Represents the ratio of the circumference of a circle to its diameter.

Methods:

Name | Description
ACos | Returns the angle from a Cosine.
ASin | Returns the angle from a Sine.
BigMul | Produces the full product of two 32-bit numbers.
CDeg | Converts radians to degrees.
Ceiling | Returns the next highest whole integer value.
Clamp | Returns value clamped to the inclusive range of Min and Max.
Cosh | Returns the hyperbolic cosine of the specified angle.
CRad | Converts degrees to radians.
DivRem | Divides two integers, placing the remainder in a supplied variable.
Floor | Returns the next lowest whole integer value.
IEEERemainder | Returns the remainder resulting from the division of a specified number by another specified number.
Log10 | Returns a log value in a base 10 log.
LogBase | Returns a value in the specified base.
LShift | Shifts the bits of an integer left.
Max | Returns the maximum of two values.
MaxIn | Returns the maximum value from a list of values.
Min | Returns the minimum of two values.
MinIn | Returns the minimum value in a list of values.
RShift | Shifts the bits of an integer right.
Sinh | Returns the hyberbolic sine of the specified angle.
Tanh | Returns the hyberbolic tangent of the specified angle.

Remarks

The functions in this class are global. To access them simply call the functions directly as any normal function. The CorMath class does not need to be referenced.

 Debug.Print PI
 Debug.Print Max(1, 2)

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: ACos

ACos

Returns the angle from a Cosine.

 Public Function ACos(
      ByVal d As Double ) As Double

Parameters

d
[ByVal] Double. A number representing a Cosine.

Return Values

Double - The angle in radians.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: ASin

ASin

Returns the angle from a Sine.

 Public Function ASin(
      ByVal d As Double ) As Double

Parameters

d
[ByVal] Double. A number representing a Sine.

Return Values

Double - The angle in radians.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: BigMul

BigMul

Produces the full product of two 32-bit numbers.

 Public Function BigMul(
      ByVal a As Long,
      ByVal b As Long ) As Int64

Parameters

a
[ByVal] Long. The first number to multiply.
b
[ByVal] Long. The second number to multiply.

Return Values

Int64 - The number containing the product of the specified numbers.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: CDeg

CDeg

Converts radians to degrees.

 Public Function CDeg(
      ByVal Radians As Double ) As Double

Parameters

Radians
[ByVal] Double. An angle in radians.

Return Values

Double - An angle in degrees.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: Ceiling

Ceiling

Returns the next highest whole integer value.

 Public Function Ceiling(
      ByVal Value As Double ) As Double

Parameters

Value
[ByVal] Double. The number to round to the next integer.

Return Values

Double - The next integer.

Remarks

Negative values will round towards zero. If the value is already a whole integer value then that value will be returned.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: Clamp

Clamp

Returns value clamped to the inclusive range of Min and Max.

 Public Function Clamp(
      ByRef Value As Variant,
      ByRef Min As Variant,
      ByRef Max As Variant ) As Variant

Parameters

Value
[ByRef] Variant. The value to be clamped.
Min
[ByRef] Variant. The lower bound of the result.
Max
[ByRef] Variant. The upper bound of the result.

Return Values

Variant - Returns Value if between Min and Max.
-or-
Min if Value is less than.
-or-
Max if Value is greater than.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: Cosh

Cosh

Returns the hyperbolic cosine of the specified angle.

 Public Function Cosh(
      ByVal d As Double ) As Double

Parameters

d
[ByVal] Double. An angle in radians.

Return Values

Double - The hyberbolic cosine.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: CRad

CRad

Converts degrees to radians.

 Public Function CRad(
      ByVal Degrees As Double ) As Double

Parameters

Degrees
[ByVal] Double. An angle in degrees.

Return Values

Double - An angle in radians.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: DivRem

DivRem

Divides two integers, placing the remainder in a supplied variable.

 Public Function DivRem(
      ByVal a As Long,
      ByVal b As Long,
      ByRef Remainder As Long ) As Long

Parameters

a
[ByVal] Long. The dividend.
b
[ByVal] Long. The divosor.
Remainder
[ByRef] Long. The variable to place the remainder of the division.

Return Values

Long - The quotient of the division.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: e (get)

e

Represents the natural logarithmic base, specified by the constant, e.

 Public Property Get e ( ) As Double

Return Values

Double - e (Approx 2.71828182845905)

Read Only.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: Floor

Floor

Returns the next lowest whole integer value.

 Public Function Floor(
      ByVal Value As Double ) As Double

Parameters

Value
[ByVal] Double. the number to be rounded downward.

Return Values

Double - The next lowest whole integer value.

Remarks

Negative values will be rounded away from zero. -2.1 will be rounded down to -3.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: IEEERemainder

IEEERemainder

Returns the remainder resulting from the division of a specified number by another specified number.

 Public Function IEEERemainder(
      ByVal x As Double,
      ByVal y As Double ) As Double

Parameters

x
[ByVal] Double. A dividend.
y
[ByVal] Double. A devisor.

Return Values

Double - The remainder of the division.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: Log10

Log10

Returns a log value in a base 10 log.

 Public Function Log10(
      ByVal d As Double ) As Double

Parameters

d
[ByVal] Double. The number to calculate the log of.

Return Values

Double - A base 10 log value.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: LogBase

LogBase

Returns a value in the specified base.

 Public Function LogBase(
      ByVal d As Double,
      ByVal NewBase As Double ) As Double

Parameters

d
[ByVal] Double. The number to calculate the log of.
NewBase
[ByVal] Double. The base of the log value.

Return Values

Double - The log value.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: LShift

LShift

Shifts the bits of an integer left.

 Public Function LShift(
      ByVal Value As Long,
      ByVal Count As Long ) As Long

Parameters

Value
[ByVal] Long. The value to be shifted left.
Count
[ByVal] Long. The number of bits to shift.

Return Values

Long - The newly shifted value.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: Max

Max

Returns the maximum of two values.

 Public Function Max(
      ByRef x As Variant,
      ByRef y As Variant ) As Variant

Parameters

x
[ByRef] Variant. Value to test as potential max value.
y
[ByRef] Variant. Value to test as potential max value.

Return Values

Variant - The max value.

Remarks

The values must be of the same type for the comparison to be performed. If X is an IComparable, then the object is used to test for the maximum value.

If both values are equavalent then X is returned.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: MaxIn

MaxIn

Returns the maximum value from a list of values.

 Public Function MaxIn(
      ByRef List As Variant ) As Variant

Parameters

List
[ByRef] Variant. The list of values to continue searching for the maximum.

Return Values

Variant - The maximum value found.

Remarks

The list can be an Array, Collection, or ICollection object.

The values must be of the same type for the comparison to be performed. If X is an IComparable, then the object is used to test for the maximum value.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: Min

Min

Returns the minimum of two values.

 Public Function Min(
      ByRef x As Variant,
      ByRef y As Variant ) As Variant

Parameters

x
[ByRef] Variant. Value to test as potential min value.
y
[ByRef] Variant. Value to test as potential min value.

Return Values

Variant - The min value.

Remarks

The values must be of the same type for the comparison to be performed. If X is an IComparable, then the object is used to test for the minimum value.

If both values are equavalent then X is returned.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: MinIn

MinIn

Returns the minimum value in a list of values.

 Public Function MinIn(
      ByRef List As Variant ) As Variant

Parameters

List
[ByRef] Variant. A list of values to find the mininum value in.

Return Values

Variant - The mininum value found in the list.

Remarks

The list can be an Array, Collection, or ICollection object.

The values must be of the same type for the comparison to be performed. If X is an IComparable, then the object is used to test for the minimum value.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: PI (get)

PI

Represents the ratio of the circumference of a circle to its diameter.

 Public Property Get PI ( ) As Double

Return Values

Double - Pi (approx 3.14159265358979)

Read Only.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: RShift

RShift

Shifts the bits of an integer right.

 Public Function RShift(
      ByVal Value As Long,
      ByVal Count As Long ) As Long

Parameters

Value
[ByVal] Long. The value to be shifted right.
Count
[ByVal] Long. The number of bits to shift.

Return Values

Long - The newly shifted value.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: Sinh

Sinh

Returns the hyberbolic sine of the specified angle.

 Public Function Sinh(
      ByVal d As Double ) As Double

Parameters

d
[ByVal] Double. An angle in radians.

Return Values

Double - The hyberbolic sine.

See Also

Project CorLib Overview

Class CorMath Overview


CorMath: Tanh

Tanh

Returns the hyberbolic tangent of the specified angle.

 Public Function Tanh(
      ByVal d As Double ) As Double

Parameters

d
[ByVal] Double. An angle in radians.

Return Values

Double - The hyperbolic tangent.

See Also

Project CorLib Overview

Class CorMath Overview


CorString

CorString

Provides static functions to format and manipulate string values.

Public:

Types:

Name | Description
CompareOptions | Defines the string comparison options to use with certain implementations of the CorString.Compare and CorString.Equals methods. This enumeration allows a bitwise combination of its member values.
StringComparison | Specifies the culture, case, and sort rules to be used with certain implementations of the CorString.Compare and CorString.Equals methods.
StringSplitOptions | Specifies whether CorString.Split method include or omit empty substrings from the return value.

Methods:

Name | Description
CharAt | Returns character value from a string at the specified index.
Compare | Compares two specified String objects using the specified rules, and returns an integer that indicates their relative position in the sort order.
CompareCultural | Compares two specified String objects using the specified comparison options and culture-specific information to influence the comparison, and returns an integer that indicates the relationship of the two strings to each other in the sort order.
CompareCulturalEx | Compares substrings of two specified String objects using the specified comparison options and culture-specific information to influence the comparison, and returns an integer that indicates the relationship of the two substrings to each other in the sort order.
CompareEx | Compares substrings of two specified String objects using the specified rules, and returns an integer that indicates their relative position in the sort order.
CompareOrdinal | Compares two specified String objects by evaluating the numeric values of the corresponding Char objects in each string.
CompareOrdinalEx | Compares substrings of two specified String objects by evaluating the numeric values of the corresponding Char objects in each substring.
CopyTo | Copies a specified number of characters from a specified position in a string to a specified position in an array of Unicode characters.
EndsWith | Determines whether the end of a string matches the specified string when compared using the specified comparison option.
EndsWithEx | Determines whether the end of this string instance matches the specified string when compared using the specified culture.
Equals | Determines whether two specified Strings have the same value.
Format | Replaces the format item in a specified string with the string representation of a corresponding value in a specified array.
FormatArray | Replaces the format item in a specified string with the string representation of a corresponding value in a specified array.
FormatArrayEx | Replaces the format item in a specified string with the string representation of a corresponding object in a specified array. A specified parameter supplies culture-specific formatting information.
FormatEx | Replaces the format item in a specified string with the string representation of a corresponding object in a specified array. A specified parameter supplies culture-specific formatting information.
IndexOfAny | Reports the zero-based index of the first occurrence in s of any character in a specified array of Unicode characters. The search starts at a specified character position and examines a specified number of character positions.
Insert | Returns a new string in which a specified string is inserted at a specified index position in s.
IsNull | Returns if the string is null.
IsNullOrWhiteSpace | Returns if the string is null, empty or contains only white-space characters.
Join | Concatenates the specified elements of an array or collection, using the specified separator between each element.
LastIndexOfAny | Reports the zero-based index of the first occurrence in s of any character in a specified array of Unicode characters. The search starts at a specified character position and examines a specified number of character positions.
PadLeft | Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified Unicode character, for a specified total length.
PadRight | Returns a new string that left-aligns the characters in this string by padding them on the right with a specified Unicode character, for a specified total length.
Remove | Returns a new string in which a specified number of characters beginning at a specified position have been deleted.
Split | Splits a string into a maximum number of substrings based on the strings or characters in an array. You can specify whether the substrings include empty array elements.
StartsWith | Determines whether the beginning of a string matches the specified string when compared using the specified comparison option.
StartsWithEx | Determines whether the beginning of this string instance matches the specified string when compared using the specified culture.
ToCharArray | Creates and array of chars (Integers) from the specified string.
Trim | Removes all leading and trailing occurrences of a set of characters specified in an array from the s parameter.
TrimEnd | Removes all trailing occurrences of a set of characters specified in an array from the s parameter.
TrimStart | Removes all leading occurrences of a set of characters specified in an array from the s parameter.

Remarks

This class cannot be directly instantiated. The methods are accessed through the class name itself.

Examples

The following example shows how to call various methods on the CorString class.

Public Sub Main()
    Const Sentance As String = "This string consists of a single short sentence."

    Dim Words() As String
    Dim Word As Variant

    Words = CorString.Split(Sentance, " ")

    For Each Word In Words
        Debug.Print CorString.Format("'{0}'", Word)
    Next
End Sub

' This code produces the following output.
'
'    'This'
'    'string'
'    'consists'
'    'of'
'    'a'
'    'single'
'    'short'
'    'sentence.'

See Also

Project CorLib Overview

Class CorString Overview


CorString: CharAt

CharAt

Returns character value from a string at the specified index.

 Public Function CharAt(
      ByRef s As String,
      ByVal Index As Long ) As Integer

Parameters

s
[ByRef] String. The string to return the character from.
Index
[ByVal] Long. The position of the character in the string.

Return Values

Integer - A 16-bit integer representing the character.

Remarks

Index is zero-based.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Index is less than zero. -or- Index is equal to or greater than the length of s.

See Also

Project CorLib Overview

Class CorString Overview


CorString: Compare

Compare

Compares two specified String objects using the specified rules, and returns an integer that indicates their relative position in the sort order.

 Public Function Compare(
      ByRef StrA As String,
      ByRef StrB As String,
      Optional ByVal ComparisonType As StringComparison = StringComparison. Ordinal ) As Long

Parameters

StrA
[ByRef] String. The first string to compare.
StrB
[ByRef] String. The second string to compare.
ComparisonType
[ByVal] Optional. StringComparison. One of the enumeration values that specifies the rules to use in the comparison.

Default: StringComparison . Ordinal

Return Values

Long - A 32-bit signed integer that indicates the lexical relationship between the two comparands, as shown in the following table
Value | Condition
Less than zero | StrA is less than StrB.
Zero | StrA equals StrB.
Greater than zero | StrA is greater than StrB.

See Also

Project CorLib Overview

Class CorString Overview


CorString: CompareCultural

CompareCultural

Compares two specified String objects using the specified comparison options and culture-specific information to influence the comparison, and returns an integer that indicates the relationship of the two strings to each other in the sort order.

 Public Function CompareCultural(
      ByRef StrA As String,
      ByRef StrB As String,
      ByVal Culture As CultureInfo,
      ByVal Options As CompareOptions ) As Long

Parameters

StrA
[ByRef] String. The first string to compare.
StrB
[ByRef] String. The second string to compare.
Culture
[ByVal] CultureInfo. The culture that supplies culture-specific comparison information.
Options
[ByVal] CompareOptions. Options to use when performing the comparison (such as ignoring case or symbols).

Return Values

Long - A 32-bit signed integer that indicates the lexical relationship between StrA and StrB, as shown in the following table
Value | Condition
Less than zero | StrA is less than StrB.
Zero | StrA equals StrB.
Greater than zero | StrA is greater than StrB.

See Also

Project CorLib Overview

Class CorString Overview


CorString: CompareCulturalEx

CompareCulturalEx

Compares substrings of two specified String objects using the specified comparison options and culture-specific information to influence the comparison, and returns an integer that indicates the relationship of the two substrings to each other in the sort order.

 Public Function CompareCulturalEx(
      ByRef StrA As String,
      ByVal IndexA As Long,
      ByRef StrB As String,
      ByVal IndexB As Long,
      ByVal Length,
      ByVal Culture As CultureInfo,
      ByVal Options As CompareOptions ) As Long

Parameters

StrA
[ByRef] String. The first string to use in the comparison.
IndexA
[ByVal] Long. The position of the substring within StrA.
StrB
[ByRef] String. The second string to use in the comparison.
IndexB
[ByVal] Long. The position of the substring within StrB.
Length
[ByVal] Variant. The maximum number of characters in the substrings to compare.
Culture
[ByVal] CultureInfo. The culture that supplies culture-specific comparison information.
Options
[ByVal] CompareOptions. Options to use when performing the comparison (such as ignoring case or symbols).

Return Values

Long - A 32-bit signed integer that indicates the lexical relationship between StrA and StrB, as shown in the following table
Value | Condition
Less than zero | StrA is less than StrB.
Zero | StrA equals StrB.
Greater than zero | StrA is greater than StrB.

See Also

Project CorLib Overview

Class CorString Overview


CorString: CompareEx

CompareEx

Compares substrings of two specified String objects using the specified rules, and returns an integer that indicates their relative position in the sort order.

 Public Function CompareEx(
      ByRef StrA As String,
      ByVal IndexA As Long,
      ByRef StrB As String,
      ByVal IndexB As Long,
      ByVal Length As Long,
      Optional ByVal ComparisonType As StringComparison = StringComparison. Ordinal ) As Long

Parameters

StrA
[ByRef] String. The first string to use in the comparison.
IndexA
[ByVal] Long. The position of the substring within StrA.
StrB
[ByRef] String. The second string to use in the comparison.
IndexB
[ByVal] Long. The position of the substring within StrB.
Length
[ByVal] Long. The maximum number of characters in the substrings to compare.
ComparisonType
[ByVal] Optional. StringComparison. One of the enumeration values that specifies the rules to use in the comparison.

Default: StringComparison . Ordinal

Return Values

Long - A 32-bit signed integer that indicates the lexical relationship between StrA and StrB, as shown in the following table
Value | Condition
Less than zero | The substring in the StrA parameter is less than the substring in the StrB parameter.
Zero | The substrings are equal, or the Length parameter is zero.
Greater than zero | The substring in StrA is greater than the substring in StrB.

Remarks

The substrings to compare start in StrA at IndexA and in StrB at IndexB. Both IndexA and IndexB are zero-based; that is, the first character in StrA and StrB is at position zero, not position one.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | IndexA is greater than StrA length. -or- IndexB is greater than StrB length. -or- IndexA, IndexB, or Length is negative. -or- Either StrA or StrB is empty, and Length is greater than zero.
ArgumentException | ComparisonType is not a StringComparison value.
NotSupportedException | StringComparison is not supported.

See Also

Project CorLib Overview

Class CorString Overview


CorString: CompareOptions

CompareOptions

Defines the string comparison options to use with certain implementations of the CorString.Compare and CorString.Equals methods.

This enumeration allows a bitwise combination of its member values.

 Public Enum CompareOptions

Values

None = 0
Indicates the default option settings for string comparisons.
IgnoreCase = &H1
Indicates that the string comparison must ignore case.
IgnoreNonSpace = &H2
Indicates that the string comparison must ignore nonspacing combining characters, such as diacritics. The Online Unicode Standard defines combining characters as characters that are combined with base characters to produce a new character. Nonspacing combining characters do not occupy a spacing position by themselves when rendered.
IgnoreSymbols = &H4
Indicates that the string comparison must ignore symbols, such as white-space characters, punctuation, currency symbols, the percent sign, mathematical symbols, the ampersand, and so on.
IgnoreKanaType = &H8
Indicates that the string comparison must ignore the Kana type. Kana type refers to Japanese hiragana and katakana characters, which represent phonetic sounds in the Japanese language. Hiragana is used for native Japanese expressions and words, while katakana is used for words borrowed from other languages, such as "computer" or "Internet". A phonetic sound can be expressed in both hiragana and katakana. If this value is selected, the hiragana character for one sound is considered equal to the katakana character for the same sound.
IgnoreWidth = &H10
Indicates that the string comparison must ignore the character width. For example, Japanese katakana characters can be written as full-width or half-width. If this value is selected, the katakana characters written as full-width are considered equal to the same characters written as half-width
OrdinalIgnoreCaseOption = &H10000000
String comparison must ignore case, then perform an ordinal comparison. This technique is equivalent to converting the string to uppercase using the invariant culture and then performing an ordinal comparison on the result.
StringSort = &H20000000
Indicates that the string comparison must use the string sort algorithm. In a string sort, the hyphen and the apostrophe, as well as other nonalphanumeric symbols, come before alphanumeric characters.
OrdinalOption = &H40000000
Indicates that the string comparison must use successive Unicode UTF-16 encoded values of the string (code unit by code unit comparison), leading to a fast comparison but one that is culture-insensitive. A string starting with a code unit \uXXXX comes before a string starting with \uYYYY, if \uXXXX is less than \uYYYY.

This value cannot be combined with other CompareOptions values and must be used alone.

See Also

Project CorLib Overview

Class CorString Overview


CorString: CompareOrdinal

CompareOrdinal

Compares two specified String objects by evaluating the numeric values of the corresponding Char objects in each string.

 Public Function CompareOrdinal(
      ByRef StrA As String,
      ByRef StrB As String ) As Long

Parameters

StrA
[ByRef] String. The first string to compare.
StrB
[ByRef] String. The second string to compare.

Return Values

Long - A 32-bit signed integer that indicates the lexical relationship between StrA and StrB, as shown in the following table
Value | Condition
Less than zero | StrA is less than StrB.
Zero | StrA equals StrB.
Greater than zero | StrA is greater than StrB.

See Also

Project CorLib Overview

Class CorString Overview


CorString: CompareOrdinalEx

CompareOrdinalEx

Compares substrings of two specified String objects by evaluating the numeric values of the corresponding Char objects in each substring.

 Public Function CompareOrdinalEx(
      ByRef StrA As String,
      ByVal IndexA As Long,
      ByRef StrB As String,
      ByVal IndexB As Long,
      ByVal Length ) As Long

Parameters

StrA
[ByRef] String. The first string to use in the comparison.
IndexA
[ByVal] Long. The position of the substring within StrA.
StrB
[ByRef] String. The second string to use in the comparison.
IndexB
[ByVal] Long. The position of the substring within StrB.
Length
[ByVal] Variant. The maximum number of characters in the substrings to compare.

Return Values

Long - A 32-bit signed integer that indicates the lexical relationship between StrA and StrB, as shown in the following table
Value | Condition
Less than zero | The substring in the StrA parameter is less than the substring in the StrB parameter.
Zero | The substrings are equal, or the Length parameter is zero.
Greater than zero | The substring in StrA is greater than the substring in StrB.

Remarks

The IndexA, IndexB, and Length parameters must be nonnegative.

The number of characters compared is the lesser of the length of StrA less IndexA, the length of StrB less IndexB, and Length.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | IndexA is greater than StrA length. -or- IndexB is greater than StrB length. -or- IndexA, IndexB, or Length is negative. -or- Either StrA or StrB is empty, and Length is greater than zero.

See Also

Project CorLib Overview

Class CorString Overview


CorString: CopyTo

CopyTo

Copies a specified number of characters from a specified position in a string to a specified position in an array of Unicode characters.

 Public Sub CopyTo(
      ByRef Source As String,
      ByVal SourceIndex As Long,
      ByRef Destination ( ) As Integer,
      ByVal DestinationIndex As Long,
      ByVal Count As Long )

Parameters

Source
[ByRef] String. The string to copy the characters from.
SourceIndex
[ByVal] Long. The zero-based index of the first character to copy.
Destination
[ByRef] Integer. An array of Unicode characters to which characters in the string are copied.
DestinationIndex
[ByVal] Long. The index in Destination as which the copy operation begins.
Count
[ByVal] Long. The number of characters in the string to copy to Destination.

Remarks

This method copies Count characters from the SourceIndex position of Source to the DestinationIndex position of destination character array. This method does not resize the destination character array; it must have a sufficient number of elements to accommodate the copied characters or the method throws an ArgumentOutOfRangeException.

SourceIndex is zero-based, and DestinationIndex is lower-bound based.

Exceptions

Exception | Condition
ArgumentNullException | Destination is null.
ArgumentOutOfRangeException | SourceIndex or Count is negative. -or- DestinationIndex is less than the lower-bound of Destination. -or- Count is greater than the length of the substring from StartIndex to the end of the string. -or- Count is greater than the length of the subarray from DestinationIndex to the upper-bound of the Destination array.

Examples

The following example demonstrates the CopyTo method.

Public Sub Main()
    Dim StrSource       As String
    Dim Destination()   As Integer

    StrSource = "changed"
    Destination = NewChars("T", "h", "e", " ", "i", "n", "i", "t", "i", "a", "l", " ", "a", "r", "r", "a", "y")

    Debug.Print NewString(Destination)

    CorString.CopyTo StrSource, 0, Destination, 4, Len(StrSource)

    Debug.Print NewString(Destination)

    StrSource = "A different string"

    CorString.CopyTo StrSource, 2, Destination, 3, 9

    Debug.Print NewString(Destination)
End Sub

' This example produces the following output.
'
'    The initial array
'    The changed array
'    Thedifferentarray

See Also

Project CorLib Overview

Class CorString Overview


CorString: EndsWith

EndsWith

Determines whether the end of a string matches the specified string when compared using the specified comparison option.

 Public Function EndsWith(
      ByRef s As String,
      ByRef Value As String,
      Optional ByVal ComparisonType As StringComparison = StringComparison. Ordinal ) As Boolean

Parameters

s
[ByRef] String. The string to check.
Value
[ByRef] String. The string to compare to the substring at the end of s.
ComparisonType
[ByVal] Optional. StringComparison. One of the enumeration values that determines how s and Value are compared.

Default: StringComparison . Ordinal

Return Values

Boolean - True if the Value parameter matches the end of s; otherwise False.

Exceptions

Exception | Condition
ArgumentException | ComparisonType is not a StringComparison value.

See Also

Project CorLib Overview

Class CorString Overview


CorString: EndsWithEx

EndsWithEx

Determines whether the end of this string instance matches the specified string when compared using the specified culture.

 Public Function EndsWithEx(
      ByRef s As String,
      ByRef Value As String,
      ByVal IgnoreCase As Boolean,
      ByVal Culture As CultureInfo ) As Boolean

Parameters

s
[ByRef] String. The string to check.
Value
[ByRef] String. The string to compare to the substring at the end of the s parameter.
IgnoreCase
[ByVal] Boolean. True to ignore case during comparison; otherwise False.
Culture
[ByVal] CultureInfo. Cultural information that determines how s and Value are compared. If Culture is Nothing, the current culture is used.

Return Values

Boolean - True if the Value parameter matches the end of s; otherwise False.

See Also

Project CorLib Overview

Class CorString Overview


CorString: Equals

Equals

Determines whether two specified Strings have the same value.

 Public Function Equals(
      ByRef a As String,
      ByRef b As String,
      Optional ByVal ComparisonType As StringComparison = StringComparison. Ordinal ) As Boolean

Parameters

a
[ByRef] String. The first string to compare.
b
[ByRef] String. The second string to compare.
ComparisonType
[ByVal] Optional. StringComparison. One of the enumeration values that specifies the rules for the comparison.

Default: StringComparison . Ordinal

Return Values

Boolean - True if the value of the a parameter is equal to the value of the b parameter; otherwise, False.

See Also

Project CorLib Overview

Class CorString Overview


CorString: Format

Format

Replaces the format item in a specified string with the string representation of a corresponding value in a specified array.

 Public Function Format(
      ByRef FormatText As String,
      ParamArray Args ( ) As Variant ) As String

Parameters

FormatText
[ByRef] String. A composite format string (see Remarks).
Args
[ByRef] Variant. An argument array that contains zero or more values to format.

Return Values

String - A copy of FormatText in which the format items have been replaced by the string representation of the corresponding values in Args.

Remarks

This method uses the composite formatting feature of VBCorLib to convert the value of an object to its text representation and embed that representation in a string.

The FormatText parameter consists of zero or more runs of text intermixed with zero or more indexed placeholders, called format items, that correspond to a value in the parameter list of this method. The formatting process replaces each format item with the string representation of the corresponding value.

The syntax of a format item is as follows:

{index[,length][:formatString]}

Elements in square brackets are optional. The following table describes each element.

Element | Description
index | The zero-based position in the parameter list of the value to be formatted. If the value specified by index is Nothing, the format item is replaced by an empty string (""). If there is no parameter in the index position, a FormatException is thrown.
,length | The minimum number of characters in the string representation of the parameter. If positive, the parameter is right-aligned; if negative, it is left-aligned.
:formatString | A standard or custom format string that is supported by the value to be formatted. Possible values for formatString are the same as the values supported by the values ToString(FormatText) method. If formatString is not specified and the value to be formatted implements the IFormattable interface, vbNullString is passed as the value of the Format parameter that is used as the IFormattable.ToString format string.

The leading and trailing brace characters, "{" and "}", are required. To specify a single literal brace character in FormatText, specify two leading or trailing brace characters; that is, "{{" or "}}".

Exceptions

Exception | Condition
FormatException | FormatText is invalid. -or- The index of a format item is less than zero, or greater than or equal to the length of the Args array.

Examples

The following example creates a string that contains data on the high and low temperature on a particular date. Two of the format items define the width of their corresponding values string representation, and the first format item also includes a standard date and time format string.

Public Sub Main()
    Dim Date1 As Date
    Dim HiTime As TimeSpan
    Dim HiTemp As Variant
    Dim LowTime As TimeSpan
    Dim LowTemp As Variant
    Dim Result As String
    Dim Values() As Variant

    Date1 = #7/1/2009#
    Set HiTime = NewTime(#2:17:32 PM#)
    HiTemp = CDec(62.1)
    Set LowTime = NewTime(#3:16:10 AM#)
    LowTemp = CDec(54.8)

    Result = CorString.Format("Temperature on {0:d}:{5}{1,11}: {2} degrees (hi){5}{3,11}: {4} degrees (lo)", Date1, HiTime, HiTemp, LowTime, LowTemp, vbCrLf)
    Debug.Print Result
    Debug.Print

    Values = Array(Date1, HiTime, HiTemp, LowTime, LowTemp, vbCrLf)
    Result = CorString.FormatArray("Temperature on {0:d}:{5}{1,11}: {2} degrees (hi){5}{3,11}: {4} degrees (lo)", Values)
    Debug.Print Result
End Sub

' This code produces the following output.
'
'    Temperature on 7/1/2009:
'       14:17:32: 62.1 degrees (hi)
'       03:16:10: 54.8 degrees (lo)
'
'    Temperature on 7/1/2009:
'       14:17:32: 62.1 degrees (hi)
'       03:16:10: 54.8 degrees (lo)

See Also

Project CorLib Overview

Class CorString Overview

FormatArray

FormatEx

FormatArrayEx

NumberFormatInfo

DateTimeFormatInfo


CorString: FormatArray

FormatArray

Replaces the format item in a specified string with the string representation of a corresponding value in a specified array.

 Public Function FormatArray(
      ByRef FormatText As String,
      ByRef Args ( ) As Variant ) As String

Parameters

FormatText
[ByRef] String. A composite format string (see Remarks).
Args
[ByRef] Variant. An argument array that contains zero or more values to format.

Return Values

String - A copy of FormatText in which the format items have been replaced by the string representation of the corresponding values in Args.

Remarks

This method uses the composite formatting feature of VBCorLib to convert the value of an object to its text representation and embed that representation in a string.

The FormatText parameter consists of zero or more runs of text intermixed with zero or more indexed placeholders, called format items, that correspond to a value in the parameter list of this method. The formatting process replaces each format item with the string representation of the corresponding value.

The syntax of a format item is as follows:

{index[,length][:formatString]}

Elements in square brackets are optional. The following table describes each element.

Element | Description
index | The zero-based position in the parameter list of the value to be formatted. If the value specified by index is Nothing, the format item is replaced by an empty string (""). If there is no parameter in the index position, a FormatException is thrown.
,length | The minimum number of characters in the string representation of the parameter. If positive, the parameter is right-aligned; if negative, it is left-aligned.
:formatString | A standard or custom format string that is supported by the value to be formatted. Possible values for formatString are the same as the values supported by the values ToString(FormatText) method. If formatString is not specified and the value to be formatted implements the IFormattable interface, vbNullString is passed as the value of the Format parameter that is used as the IFormattable.ToString format string.

The leading and trailing brace characters, "{" and "}", are required. To specify a single literal brace character in FormatText, specify two leading or trailing brace characters; that is, "{{" or "}}".

Exceptions

Exception | Condition
FormatException | FormatText is invalid. -or- The index of a format item is less than zero, or greater than or equal to the length of the Args array.

Examples

The following example creates a string that contains data on the high and low temperature on a particular date. Two of the format items define the width of their corresponding values string representation, and the first format item also includes a standard date and time format string.

Public Sub Main()
    Dim Date1 As Date
    Dim HiTime As TimeSpan
    Dim HiTemp As Variant
    Dim LowTime As TimeSpan
    Dim LowTemp As Variant
    Dim Result As String
    Dim Values() As Variant

    Date1 = #7/1/2009#
    Set HiTime = NewTime(#2:17:32 PM#)
    HiTemp = CDec(62.1)
    Set LowTime = NewTime(#3:16:10 AM#)
    LowTemp = CDec(54.8)

    Result = CorString.Format("Temperature on {0:d}:{5}{1,11}: {2} degrees (hi){5}{3,11}: {4} degrees (lo)", Date1, HiTime, HiTemp, LowTime, LowTemp, vbCrLf)
    Debug.Print Result
    Debug.Print

    Values = Array(Date1, HiTime, HiTemp, LowTime, LowTemp, vbCrLf)
    Result = CorString.FormatArray("Temperature on {0:d}:{5}{1,11}: {2} degrees (hi){5}{3,11}: {4} degrees (lo)", Values)
    Debug.Print Result
End Sub

' This code produces the following output.
'
'    Temperature on 7/1/2009:
'       14:17:32: 62.1 degrees (hi)
'       03:16:10: 54.8 degrees (lo)
'
'    Temperature on 7/1/2009:
'       14:17:32: 62.1 degrees (hi)
'       03:16:10: 54.8 degrees (lo)

See Also

Project CorLib Overview

Class CorString Overview

Format

FormatEx

FormatArrayEx

NumberFormatInfo

DateTimeFormatInfo


CorString: FormatArrayEx

FormatArrayEx

Replaces the format item in a specified string with the string representation of a corresponding object in a specified array. A specified parameter supplies culture-specific formatting information.

 Public Function FormatArrayEx(
      ByVal Provider As IFormatProvider,
      ByRef FormatText As String,
      ByRef Args ( ) As Variant ) As String

Parameters

Provider
[ByVal] IFormatProvider. An object that supplies culture-specific formatting information.
FormatText
[ByRef] String. A composite format string (see Remarks).
Args
[ByRef] Variant. An argument array that contains zero or more values to format.

Return Values

String - A copy of FormatText in which the format items have been replaced by the string representation of the corresponding values in Args.

Remarks

This method uses the composite formatting feature of VBCorLib to convert the value of an object to its text representation and embed that representation in a string.

The provider parameter supplies custom and culture-specific information used to moderate the formatting process. The Provider parameter is an IFormatProvider implementation whose GetFormat method is called by the CorString.FormatEx(IFormatProvider, String,Object()) method. The method must return an object to supply formatting information that is of the same type as the FormatType parameter. The Provider parameters GetFormat method is called one or more times, depending on the specific type of objects in Args, as follows:

  • It is always passed the format type name "ICustomFormatter".
  • It is passed the format type name "DateTimeFormatInfo" for each format item whose corresponding data type is a date and time value.
  • It is passed the format type name "NumberFormatInfo" for each format item whose corresponding data type is numeric.

The FormatText parameter consists of zero or more runs of text intermixed with zero or more indexed placeholders, called format items, that correspond to a value in the parameter list of this method. The formatting process replaces each format item with the string representation of the corresponding value.

The syntax of a format item is as follows:

{index[,length][:formatString]}

Elements in square brackets are optional. The following table describes each element.

Element | Description
index | The zero-based position in the parameter list of the value to be formatted. If the value specified by index is Nothing, the format item is replaced by an empty string (""). If there is no parameter in the index position, a FormatException is thrown.
,length | The minimum number of characters in the string representation of the parameter. If positive, the parameter is right-aligned; if negative, it is left-aligned.
:formatString | A standard or custom format string that is supported by the value to be formatted. Possible values for formatString are the same as the values supported by the values ToString(FormatText) method. If formatString is not specified and the value to be formatted implements the IFormattable interface, vbNullString is passed as the value of the Format parameter that is used as the IFormattable.ToString format string.

The leading and trailing brace characters, "{" and "}", are required. To specify a single literal brace character in FormatText, specify two leading or trailing brace characters; that is, "{{" or "}}".

Exceptions

Exception | Condition
FormatException | FormatText is invalid. -or- The index of a format item is less than zero, or greater than or equal to the length of the Args array.

Examples

The following example uses the CorString.FormatEx(IFormatProvider, String,Object()) method to display the string representation of some date and time and numeric values using several different cultures.

Public Sub Main()
    Dim CultureNames() As String
    Dim CultureName As Variant
    Dim DateToDisplay As Date
    Dim Value As Double

    CultureNames = NewStrings("en-US", "fr-FR", "de-DE", "es-ES")
    DateToDisplay = #9/1/2009 6:32:00 PM#
    Value = 9164.32

    Debug.Print "Culture     Date                                Value"
    Debug.Print

    For Each CultureName In CultureNames
        Dim Culture As CultureInfo
        Dim Output As String

        Set Culture = NewCultureInfo(CultureName)
        Output = CorString.FormatEx(Culture, "{0,-11} {1,-35:D} {2:N}", Culture.Name, DateToDisplay, Value)

        Debug.Print Output
    Next
End Sub

' This code produces the following output.
'
'    Culture     Date                                Value
'
'    en-US       Tuesday, September 1, 2009          9,164.32
'    fr-FR       mardi 1 septembre 2009              9 164,32
'    de-DE       Dienstag, 1. September 2009         9.164,32
'    es-ES       martes, 1 de septiembre de 2009     9.164,32

The following example defines a customer number format provider that formats an integer value as a customer account number in the form x-xxxxx-xx.

There are two modules created for this example. A BAS module containing the Main method and a Class module implementing the IFormatProvider interface and ICustomFormatter interface.

The following is a Visual Basic Class module named CustomerFormatter.

Option Explicit
Implements IFormatProvider
Implements ICustomFormatter

Private Function IFormatProvider_GetFormat(FormatType As String) As Object
    If CorString.Equals(FormatType, "ICustomFormatter", OrdinalIgnoreCase) Then
        Set IFormatProvider_GetFormat = Me
    End If
End Function

Private Function ICustomFormatter_Format(ByVal FormatText As String, Arg As Variant, ByVal Provider As CorLib.IFormatProvider) As String
    Dim CustomerString As String
    Dim Separator As String
    Dim Result As String

    If Not Provider Is Me Then
        Exit Function
    End If

    CustomerString = Object.ToString(Arg)

    If Len(CustomerString) < 8 Then
        CustomerString = CorString.PadLeft(CustomerString, 8, "0")
    End If

    Select Case FormatText
        Case "", "G"
            Separator = "-"
        Case "S"
            Separator = "/"
        Case "P"
            Separator = "."
        Case Else
            Throw NewFormatException(CorString.Format("The '{0}' format specifier is not supported.", FormatText))
    End Select

    ICustomFormatter_Format = Left$(CustomerString, 1) & Separator & Mid$(CustomerString, 2, 5) & Separator & Mid$(CustomerString, 7)
End Function

The following is a Visual Basic BAS module containing Main start-up method.

Public Sub Main()
    Const AcctNumber As Long = 79203159

    Debug.Print CorString.FormatEx(New CustomerFormatter, "{0}", AcctNumber)
    Debug.Print CorString.FormatEx(New CustomerFormatter, "{0:G}", AcctNumber)
    Debug.Print CorString.FormatEx(New CustomerFormatter, "{0:S}", AcctNumber)
    Debug.Print CorString.FormatEx(New CustomerFormatter, "{0:P}", AcctNumber)

    On Error GoTo Catch
    Debug.Print CorString.FormatEx(New CustomerFormatter, "{0:X}", AcctNumber)
    Exit Sub

Catch:
    Dim Ex As FormatException

    Catch Ex
    Debug.Print Ex.Message
End Sub

' This code produces the following output.
'
'    7-92031-59
'    7-92031-59
'    7/92031/59
'    7.92031.59
'    The 'X' format specifier is not supported.

See Also

Project CorLib Overview

Class CorString Overview

Format

FormatArray

FormatEx

NumberFormatInfo

DateTimeFormatInfo


CorString: FormatEx

FormatEx

Replaces the format item in a specified string with the string representation of a corresponding object in a specified array. A specified parameter supplies culture-specific formatting information.

 Public Function FormatEx(
      ByVal Provider As IFormatProvider,
      ByRef FormatText As String,
      ParamArray Args ( ) As Variant ) As String

Parameters

Provider
[ByVal] IFormatProvider. An object that supplies culture-specific formatting information.
FormatText
[ByRef] String. A composite format string (see Remarks).
Args
[ByRef] Variant. An argument array that contains zero or more values to format.

Return Values

String - A copy of FormatText in which the format items have been replaced by the string representation of the corresponding values in Args.

Remarks

This method uses the composite formatting feature of VBCorLib to convert the value of an object to its text representation and embed that representation in a string.

The provider parameter supplies custom and culture-specific information used to moderate the formatting process. The Provider parameter is an IFormatProvider implementation whose GetFormat method is called by the CorString.FormatEx(IFormatProvider, String,Object()) method. The method must return an object to supply formatting information that is of the same type as the FormatType parameter. The Provider parameters GetFormat method is called one or more times, depending on the specific type of objects in Args, as follows:

  • It is always passed the format type name "ICustomFormatter".
  • It is passed the format type name "DateTimeFormatInfo" for each format item whose corresponding data type is a date and time value.
  • It is passed the format type name "NumberFormatInfo" for each format item whose corresponding data type is numeric.

The FormatText parameter consists of zero or more runs of text intermixed with zero or more indexed placeholders, called format items, that correspond to a value in the parameter list of this method. The formatting process replaces each format item with the string representation of the corresponding value.

The syntax of a format item is as follows:

{index[,length][:formatString]}

Elements in square brackets are optional. The following table describes each element.

Element | Description
index | The zero-based position in the parameter list of the value to be formatted. If the value specified by index is Nothing, the format item is replaced by an empty string (""). If there is no parameter in the index position, a FormatException is thrown.
,length | The minimum number of characters in the string representation of the parameter. If positive, the parameter is right-aligned; if negative, it is left-aligned.
:formatString | A standard or custom format string that is supported by the value to be formatted. Possible values for formatString are the same as the values supported by the values ToString(FormatText) method. If formatString is not specified and the value to be formatted implements the IFormattable interface, vbNullString is passed as the value of the Format parameter that is used as the IFormattable.ToString format string.

The leading and trailing brace characters, "{" and "}", are required. To specify a single literal brace character in FormatText, specify two leading or trailing brace characters; that is, "{{" or "}}".

Exceptions

Exception | Condition
FormatException | FormatText is invalid. -or- The index of a format item is less than zero, or greater than or equal to the length of the Args array.

Examples

The following example uses the CorString.FormatEx(IFormatProvider, String,Object()) method to display the string representation of some date and time and numeric values using several different cultures.

Public Sub Main()
    Dim CultureNames() As String
    Dim CultureName As Variant
    Dim DateToDisplay As Date
    Dim Value As Double

    CultureNames = NewStrings("en-US", "fr-FR", "de-DE", "es-ES")
    DateToDisplay = #9/1/2009 6:32:00 PM#
    Value = 9164.32

    Debug.Print "Culture     Date                                Value"
    Debug.Print

    For Each CultureName In CultureNames
        Dim Culture As CultureInfo
        Dim Output As String

        Set Culture = NewCultureInfo(CultureName)
        Output = CorString.FormatEx(Culture, "{0,-11} {1,-35:D} {2:N}", Culture.Name, DateToDisplay, Value)

        Debug.Print Output
    Next
End Sub

' This code produces the following output.
'
'    Culture     Date                                Value
'
'    en-US       Tuesday, September 1, 2009          9,164.32
'    fr-FR       mardi 1 septembre 2009              9 164,32
'    de-DE       Dienstag, 1. September 2009         9.164,32
'    es-ES       martes, 1 de septiembre de 2009     9.164,32

The following example defines a customer number format provider that formats an integer value as a customer account number in the form x-xxxxx-xx.

There are two modules created for this example. A BAS module containing the Main method and a Class module implementing the IFormatProvider interface and ICustomFormatter interface.

The following is a Visual Basic Class module named CustomerFormatter.

Option Explicit
Implements IFormatProvider
Implements ICustomFormatter

Private Function IFormatProvider_GetFormat(FormatType As String) As Object
    If CorString.Equals(FormatType, "ICustomFormatter", OrdinalIgnoreCase) Then
        Set IFormatProvider_GetFormat = Me
    End If
End Function

Private Function ICustomFormatter_Format(ByVal FormatText As String, Arg As Variant, ByVal Provider As CorLib.IFormatProvider) As String
    Dim CustomerString As String
    Dim Separator As String
    Dim Result As String

    If Not Provider Is Me Then
        Exit Function
    End If

    CustomerString = Object.ToString(Arg)

    If Len(CustomerString) < 8 Then
        CustomerString = CorString.PadLeft(CustomerString, 8, "0")
    End If

    Select Case FormatText
        Case "", "G"
            Separator = "-"
        Case "S"
            Separator = "/"
        Case "P"
            Separator = "."
        Case Else
            Throw NewFormatException(CorString.Format("The '{0}' format specifier is not supported.", FormatText))
    End Select

    ICustomFormatter_Format = Left$(CustomerString, 1) & Separator & Mid$(CustomerString, 2, 5) & Separator & Mid$(CustomerString, 7)
End Function

The following is a Visual Basic BAS module containing Main start-up method.

Public Sub Main()
    Const AcctNumber As Long = 79203159

    Debug.Print CorString.FormatEx(New CustomerFormatter, "{0}", AcctNumber)
    Debug.Print CorString.FormatEx(New CustomerFormatter, "{0:G}", AcctNumber)
    Debug.Print CorString.FormatEx(New CustomerFormatter, "{0:S}", AcctNumber)
    Debug.Print CorString.FormatEx(New CustomerFormatter, "{0:P}", AcctNumber)

    On Error GoTo Catch
    Debug.Print CorString.FormatEx(New CustomerFormatter, "{0:X}", AcctNumber)
    Exit Sub

Catch:
    Dim Ex As FormatException

    Catch Ex
    Debug.Print Ex.Message
End Sub

' This code produces the following output.
'
'    7-92031-59
'    7-92031-59
'    7/92031/59
'    7.92031.59
'    The 'X' format specifier is not supported.

See Also

Project CorLib Overview

Class CorString Overview

Format

FormatArray

FormatArrayEx

NumberFormatInfo

DateTimeFormatInfo


CorString: IndexOfAny

IndexOfAny

Reports the zero-based index of the first occurrence in s of any character in a specified array of Unicode characters. The search starts at a specified character position and examines a specified number of character positions.

 Public Function IndexOfAny(
      ByRef s As String,
      ByRef OfAny As Variant,
      Optional ByRef StartIndex As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

s
[ByRef] String. The string to be searched.
OfAny
[ByRef] Variant. A Unicode character array containing one or more characters to seek. This accepts String or Integer().
StartIndex
[ByRef] Optional. Variant. The zero-based starting index of s to begin searching.
Count
[ByRef] Optional. Variant. The number of characters in s to search.

Return Values

Long - The zero-based index position of the first occurrence in s where any character in AnyOf was found; -1 if no character in AnyOf was found.

Remarks

The search begins at StartIndex and continues to StartIndex + Count - 1. The character at StartIndex + Count is not included in the search.

Index numbering starts from zero. The StartIndex parameter can range from 0 to one less than the length of s.

The search for AnyOf is case-sensitive.

Exceptions

Exception | Condition
ArgumentNullException | AnyOf is uninitialized.
ArgumentOutOfRangeException | Count or StartIndex is negative. -or- Count + StartIndex is greater than the number of characters in s.

Examples

The following example finds the index of the occurrence of any character of the string "aid" within a substring of another string.

Public Sub Main()
    Const Br1 As String = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"
    Const Br2 As String = "0123456789012345678901234567890123456789012345678901234567890123456"
    Const Str As String = "Now is the time for all good men to come to the aid of their party."
    Const Target As String = "aid"

    Dim Start   As Long
    Dim At      As Long
    Dim Count   As Long

    Start = (Len(Str) - 1) \ 3
    Count = (Len(Str) - 1) \ 4

    Debug.Print CorString.Format("The first character occurrence from position {0} for {1} characters.", Start, Count)
    Debug.Print CorString.Format("{0}{1}{0}{2}{0}{3}{0}", Environment.NewLine, Br1, Br2, Str)
    Debug.Print CorString.Format("A character in '{0}' occurs at position: ", Target);

    At = CorString.IndexOfAny(Str, Target, Start, Count)

    If At > -1 Then
        Debug.Print At
    Else
        Debug.Print "(not found)"
    End If
End Sub

' This example produces the following output.
'
'    The first character occurrence from position 22 for 16 characters.
'
'    0----+----1----+----2----+----3----+----4----+----5----+----6----+-
'    0123456789012345678901234567890123456789012345678901234567890123456
'    Now is the time for all good men to come to the aid of their party.
'
'    A character in 'aid' occurs at position:  27

See Also

Project CorLib Overview

Class CorString Overview

LastIndexOfAny


CorString: Insert

Insert

Returns a new string in which a specified string is inserted at a specified index position in s.

 Public Function Insert(
      ByRef s As String,
      ByVal StartIndex As Long,
      ByRef Value As String ) As String

Parameters

s
[ByRef] String. The string to insert to.
StartIndex
[ByVal] Long. The zero-base index position of the insertion.
Value
[ByRef] String. The string to insert.

Return Values

String - A new string that is equivalent to this instance, but with Value inserted at position StartIndex.

Remarks

If StartIndex is equal to the length of s, value is appended to the end of s.
Note
This method does not modify the value of s. Instead, it returns a new string in which Value is inserted into s.

For example, the return value of CorString.Insert("abc", 2, "XYZ") is "abXYZc".

Exceptions

Exception | Condition
ArgumentOutOfRangeException | StartIndex is negative or greater than the length of s.

Examples

The following console application provides a simple demonstration of the Insert method.

Public Sub Main()
    Const Animal1   As String = "fox"
    Const Animal2   As String = "dog"
    Const Adj1      As String = "bold "
    Const Adj2      As String = "lazy "
    Dim Target      As String

    Target = CorString.Format("The {0} jumped over the {1}.", Animal1, Animal2)

    Debug.Print CorString.Format("The original string is: {0}{1}", vbCrLf, Target)

    Target = CorString.Insert(Target, InStr(Target, Animal1) - 1, Adj1)
    Target = CorString.Insert(Target, InStr(Target, Animal2) - 1, Adj2)

    Debug.Print CorString.Format("{0}The final string is: {0}{1}", vbCrLf, Target)
End Sub

' This example produces the following output.
'
'    The original string is:
'    The fox jumped over the dog.
'
'    The final string is:
'    The bold fox jumped over the lazy dog.

See Also

Project CorLib Overview

Class CorString Overview

Remove


CorString: IsNull

IsNull

Returns if the string is null.

 Public Function IsNull(
      ByRef s As String ) As Boolean

Parameters

s
[ByRef] String. The string to be tested for null.

Return Values

Boolean - True if the string pointer is null, False otherwise.

Remarks

This method is not equivalent to checking the length of a string for zero using the Len method. The method checks if the pointer to a string is null. A null string is uninitialized.

Examples

Public Sub Main()
    Debug.Print CorString.IsNull("")
    Debug.Print CorString.IsNull(vbNullString)
End Sub

'' The code produces the following output.
''
''    False
''    True

See Also

Project CorLib Overview

Class CorString Overview


CorString: IsNullOrWhiteSpace

IsNullOrWhiteSpace

Returns if the string is null, empty or contains only white-space characters.

 Public Function IsNullOrWhiteSpace(
      ByRef s As String ) As Boolean

Parameters

s
[ByRef] String. The string to be tested for white-space.

Return Values

Boolean - True if the string has a length of zero or contains only white-space, False otherwise.

Remarks

IsNullOrWhiteSpace is a convenience method that is similar to the following code, except that it offers better performance:

Len(CorString.Trim(s)) = 0

White-space characters are defined by the Unicode standard. The IsNullOrWhiteSpace method interprets any character that returns a value of true when it is passed to the Char.IsWhiteSpace method as a white-space character.

Examples

The following example creates a string array, and then passes each element of the array to the IsNullOrWhiteSpace method.

Public Sub Main()
    Dim Values() As String
    Dim Value As Variant

    Values = NewStrings(vbNullString, "", "ABCDE", Space$(20), t("  \t  "), String$(&H2000, 10))

    For Each Value In Values
        Debug.Print CorString.IsNullOrWhiteSpace(CStr(Value))
    Next
End Sub

' The code produces the following output.
'
'    True
'    True
'    False
'    True
'    True
'    True

See Also

Project CorLib Overview

Class CorString Overview


CorString: Join

Join

Concatenates the specified elements of an array or collection, using the specified separator between each element.

 Public Function Join(
      ByRef Separator As String,
      ByRef Value As Variant,
      Optional ByRef StartIndex As Variant,
      Optional ByRef Count As Variant ) As String

Parameters

Separator
[ByRef] String. The string to use as a saparator.
Value
[ByRef] Variant. An array or collection that contains the elements to concatenate.
StartIndex
[ByRef] Optional. Variant. The first element in Value to use.
Count
[ByRef] Optional. Variant. The number of elements of Value to use.

Return Values

String - A string that consists of the strings in value delimited by the separator string.
-or-
"" if Count is zero, Value has no elements, or Separator and all the elements of Value are "".

Remarks

For example, if Separator is ", " and the elements of Value are "apple", "orange", "grape", and "pear", Join(separator, value, 1, 2) returns "orange, grape".

Exceptions

Exception | Condition
ArgumentOutOfRangeException | StartIndex is less than the lower-bound of Value. -or- Count is less than zero. -or- StartIndex plus Count is greater than the upper-bound of Value.

Examples

The following example concatenates two elements from an array of names of fruit.

Public Sub Main()
    Dim Value() As String
    Dim List    As Collection
    Dim Sep     As String
    Dim Result  As String

    Sep = ", "
    Value = NewStrings("apple", "orange", "grape", "pear")
    Set List = NewCollection("apple", "orange", "grape", "pear")

    Debug.Print CorString.Format("Sep = '{0}'", Sep)
    Debug.Print

    Debug.Print CorString.Format("Value() = {{'{0}' '{1}' '{2}' '{3}'}}", Value(0), Value(1), Value(2), Value(3))
    Result = CorString.Join(Sep, Value, 1, 2)
    Debug.Print CorString.Format("CorString.Join(Sep, Value, 1, 2) = '{0}'", Result)
    Debug.Print

    Debug.Print CorString.Format("List = {{'{0}' '{1}' '{2}' '{3}'}}", List(1), List(2), List(3), List(4))
    Result = CorString.Join(Sep, List)
    Debug.Print CorString.Format("CorString.Join(Sep, List) = '{0}'", Result)
End Sub

' This example produces the following output.
'
'    Sep = ', '
'
'    Value() = {'apple' 'orange' 'grape' 'pear'}
'    CorString.Join(Sep, Value, 1, 2) = 'orange, grape'
'
'    List = {'apple' 'orange' 'grape' 'pear'}
'    CorString.Join(Sep, List) = 'apple, orange, grape, pear'

See Also

Project CorLib Overview

Class CorString Overview

Split


CorString: LastIndexOfAny

LastIndexOfAny

Reports the zero-based index of the first occurrence in s of any character in a specified array of Unicode characters. The search starts at a specified character position and examines a specified number of character positions.

 Public Function LastIndexOfAny(
      ByRef s As String,
      ByRef OfAny As Variant,
      Optional ByRef StartIndex As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

s
[ByRef] String. The string to be searched.
OfAny
[ByRef] Variant. A Unicode character array containing one or more characters to seek. This accepts String or Integer().
StartIndex
[ByRef] Optional. Variant. The search starting position. The search proceeds from StartIndex toward the beginning of s.
Count
[ByRef] Optional. Variant. The number of characters in s to examine.

Return Values

Long - The index position of the last occurrence in s where any character in AnyOf was found; -1 if no character in AnyOf was found or if s is empty.

Remarks

Index numbering starts from zero.

This method begins searching at the StartIndex character position of s and proceeds backward toward the beginning until either a character in AnyOf is found or Count character positions have been examined. The search is case-sensitive.

The search for AnyOf is case-sensitive.

Exceptions

Exception | Condition
ArgumentNullException | AnyOf is uninitialized.
ArgumentOutOfRangeException | s does not equal "", and Count or StartIndex is negative. -or- s does not equal "" and StartIndex minus Count specifies a position that is not within s.

Examples

The following example finds the index of the last occurrence of any character in the string "aid" within a substring of another string.

Public Sub Main()
    Const Br1 As String = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"
    Const Br2 As String = "0123456789012345678901234567890123456789012345678901234567890123456"
    Const Str As String = "Now is the time for all good men to come to the aid of their party."
    Const Target As String = "aid"

    Dim Start   As Long
    Dim At      As Long
    Dim Count   As Long

    Start = (Len(Str) - 1) * 2 \ 3
    Count = (Len(Str) - 1) \ 3

    Debug.Print CorString.Format("The first character occurrence from position {0} for {1} characters.", Start, Count)
    Debug.Print CorString.Format("{0}{1}{0}{2}{0}{3}{0}", Environment.NewLine, Br1, Br2, Str)
    Debug.Print CorString.Format("A character in '{0}' occurs at position: ", Target);

    At = CorString.LastIndexOfAny(Str, Target, Start, Count)

    If At > -1 Then
        Debug.Print At
    Else
        Debug.Print "(not found)"
    End If
End Sub

' This example produces the following output.
'
'    The first character occurrence from position 44 for 22 characters.
'
'    0----+----1----+----2----+----3----+----4----+----5----+----6----+-
'    0123456789012345678901234567890123456789012345678901234567890123456
'    Now is the time for all good men to come to the aid of their party.
'
'    A character in 'aid' occurs at position:  27

See Also

Project CorLib Overview

Class CorString Overview

IndexOfAny


CorString: PadLeft

PadLeft

Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified Unicode character, for a specified total length.

 Public Function PadLeft(
      ByRef s As String,
      ByVal TotalWidth As Long,
      Optional ByRef PaddingChar As Variant = 32 ) As String

Parameters

s
[ByRef] String. The string to be padded.
TotalWidth
[ByVal] Long. The number of characters in the resulting string, equal to the number of original characters plus any additional padding characters.
PaddingChar
[ByRef] Optional. Variant. A Unicode padding character. AscW and Chrw$ values are accepted.

Default: 32

Return Values

String - A new string that is equivalent to s, but right-aligned and padded on the left with as many PaddingChar characters as needed to create a length of TotalWidth. However, if TotalWidth is less than the length of s, the method returns s. If TotalWidth is equal to the length of s, the method returns a new string that is identical to s.

Remarks

The PadLeft(String,Int32, Char) method pads the beginning of the returned string.

PaddingChar can accept either AscW or ChrW$ values.

Note This method does not modify the s parameter. Instead, it returns a new string that is padded with leading PaddingChar characters so that its total length is TotalWidth characters.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | TotalWidth is less than zero.

Examples

The following example demonstrates the PadLeft method.

Public Sub Main()
    Const Str As String = "Forty-Two"
    Const StrPad As String = "."
    Const CharPad As Integer = 46

    Debug.Print CorString.PadLeft(Str, 15, StrPad)
    Debug.Print CorString.PadLeft(Str, 15, CharPad)
    Debug.Print CorString.PadLeft(Str, 2, StrPad)
End Sub

' The previous code outputs the following.
'
'    ......Forty-Two
'    ......Forty-Two
'    Forty-Two

See Also

Project CorLib Overview

Class CorString Overview


CorString: PadRight

PadRight

Returns a new string that left-aligns the characters in this string by padding them on the right with a specified Unicode character, for a specified total length.

 Public Function PadRight(
      ByRef s As String,
      ByVal TotalWidth As Long,
      Optional ByRef PaddingChar As Variant = 32 ) As String

Parameters

s
[ByRef] String. The string to be padded.
TotalWidth
[ByVal] Long. The number of characters in the resulting string, equal to the number of original characters plus any additional padding characters.
PaddingChar
[ByRef] Optional. Variant. A Unicode padding character. AscW and Chrw$ values are accepted.

Default: 32

Return Values

String - A new string that is equivalent to s, but left-aligned and padded on the right with as many PaddingChar characters as needed to create a length of TotalWidth. However, if TotalWidth is less than the length of s, the method returns s. If TotalWidth is equal to the length of s, the method returns a new string that is identical to s.

Remarks

The PadRight(String,Int32, Char) method pads the end of the returned string.

PaddingChar can accept either AscW or ChrW$ values.

Note This method does not modify the s parameter. Instead, it returns a new string that is padded with trailing PaddingChar characters so that its total length is TotalWidth characters.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | TotalWidth is less than zero.

Examples

The following example demonstrates the PadRight method.

Public Sub Main()
    Const Str As String = "Forty-Two"
    Const StrPad As String = "."
    Const CharPad As Integer = 46

    Debug.Print CorString.PadRight(Str, 15, StrPad)
    Debug.Print CorString.PadRight(Str, 15, CharPad)
    Debug.Print CorString.PadRight(Str, 2, StrPad)
End Sub

' The previous code outputs the following.
'
'    Forty-Two......
'    Forty-Two......
'    Forty-Two

See Also

Project CorLib Overview

Class CorString Overview


CorString: Remove

Remove

Returns a new string in which a specified number of characters beginning at a specified position have been deleted.

 Public Function Remove(
      ByRef s As String,
      ByVal StartIndex As Long,
      Optional ByRef Count As Variant ) As String

Parameters

s
[ByRef] String. The string to remove characters from.
StartIndex
[ByVal] Long. The zero-based position to begin deleting characters.
Count
[ByRef] Optional. Variant. The number of characters to delete.

Return Values

String - A new string with the substring deleted.

Remarks

The value of the StartIndex parameter can range from zero to one less than the length of the string.
Note
This method does not modify the value of si. Instead, it returns a new string in which the number of characters specified by the count parameter have been removed. The characters are removed at the position specified by StartIndex.

Examples

The following example demonstrates how you can remove the middle name from a complete name.

Public Sub Main()
    Dim Name    As String
    Dim FoundS1 As Long
    Dim FoundS2 As Long

    Name = "Michelle Violet Banks"
    Debug.Print CorString.Format("The entire name is '{0}'", Name)

    FoundS1 = InStr(Name, " ")
    FoundS2 = InStr(FoundS1 + 1, Name, " ")

    If FoundS1 <> FoundS2 And FoundS1 > 0 Then
        Name = CorString.Remove(Name, FoundS1, FoundS2 - FoundS1)

        Debug.Print CorString.Format("After removing the middle name, we are left with '{0}'", Name)
    End If
End Sub

' This example produces the following output.
'
'    The entire name is 'Michelle Violet Banks'
'    After removing the middle name, we are left with 'Michelle Banks'

See Also

Project CorLib Overview

Class CorString Overview

Insert


CorString: Split

Split

Splits a string into a maximum number of substrings based on the strings or characters in an array. You can specify whether the substrings include empty array elements.

 Public Function Split(
      ByRef s As String,
      ByRef Separator As Variant,
      Optional ByVal Count As Long = &H7FFFFFFF,
      Optional ByVal Options As StringSplitOptions = StringSplitOptions. None ) As String ( )

Parameters

s
[ByRef] String. The string to split.
Separator
[ByRef] Variant. A String or Integer array that delimits the substrings in the s parameter, an empty array that contains no delimiters, or null.
Count
[ByVal] Optional. Long. The maximum number of substrings to return.

Default: &H7FFFFFFF

Options
[ByVal] Optional. StringSplitOptions. StringSplitOptions.RemoveEmptyEntries to omit empty array elements from the array returned; or StringSplitOptions.None to include empty array elements in the array returned.

Default: StringSplitOptions . None

Return Values

String() - An array whose elements contain the substrings in this string that are delimited by one or more strings in Separator. For more information, see the Remarks section.

Remarks

Delimiter strings are not included in the elements of the returned array.

If the s parameter does not contain any of the strings or characters in Separator, or the Count parameter is 1, the returned array consists of a single element that contains the s parameter. If the Separator parameter is null or contains no elements, white-space characters are assumed to be the delimiters. White-space characters are defined by the Unicode standard and return True if they are passed to the Char.IsWhiteSpace method.

If the Count parameter is zero, or the Options parameter is RemoveEmptyEntries and the length of the s parameter is zero, an empty array is returned.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Count is negative.
ArgumentException | Options is not one of the StringSplitOptions values.

See Also

Project CorLib Overview

Class CorString Overview


CorString: StartsWith

StartsWith

Determines whether the beginning of a string matches the specified string when compared using the specified comparison option.

 Public Function StartsWith(
      ByRef s As String,
      ByRef Value As String,
      Optional ByVal ComparisonType As StringComparison = StringComparison. Ordinal ) As Boolean

Parameters

s
[ByRef] String. The string to check.
Value
[ByRef] String. The string to compare to the substring at the beginning of s.
ComparisonType
[ByVal] Optional. StringComparison. One of the enumeration values that determines how s and Value are compared.

Default: StringComparison . Ordinal

Return Values

Boolean - True if the s parameter begins with Value; otherwise False.

Exceptions

Exception | Condition
ArgumentException | ComparisonType is not a StringComparison value.

See Also

Project CorLib Overview

Class CorString Overview


CorString: StartsWithEx

StartsWithEx

Determines whether the beginning of this string instance matches the specified string when compared using the specified culture.

 Public Function StartsWithEx(
      ByRef s As String,
      ByRef Value As String,
      ByVal IgnoreCase As Boolean,
      ByVal Culture As CultureInfo ) As Boolean

Parameters

s
[ByRef] String. The string to check.
Value
[ByRef] String. The string to compare to the substring at the beginning of s.
IgnoreCase
[ByVal] Boolean. True to ignore case during comparison; otherwise False.
Culture
[ByVal] CultureInfo. Cultural information that determines how s and Value are compared. If Culture is Nothing, the current culture is used.

Return Values

Boolean - True if the s parameter begins with Value; otherwise False.

See Also

Project CorLib Overview

Class CorString Overview


CorString: StringComparison

StringComparison

Specifies the culture, case, and sort rules to be used with certain implementations of the CorString.Compare and CorString.Equals methods.

 Public Enum StringComparison

Values

CurrentCulture = 0
Compare strings using culture-sensitive sort rules and the current culture.
CurrentCultureIgnoreCase = 1
Compare strings using culture-sensitive sort rules, the current culture, and ignoring the case of the strings being compared.
InvariantCulture = 2
Compare strings using culture-sensitive sort rules and the invariant culture.
InvariantCultureIgnoreCase = 3
Compare strings using culture-sensitive sort rules, the invariant culture, and ignoring the case of the strings being compared.
Ordinal = 4
Specifies a case-sensitive string comparison.
OrdinalIgnoreCase = 5
Specifies a case-insensitive string comparison.
BinaryCompare = 100
Uses the Visual Basic StrComp function with vbBinaryCompare option.
TextCompare = 101
Uses the Visual Basic StrComp function with vbTextCompare option.

See Also

Project CorLib Overview

Class CorString Overview


CorString: StringSplitOptions

StringSplitOptions

Specifies whether CorString.Split method include or omit empty substrings from the return value.

 Public Enum StringSplitOptions

Values

None
The return value includes array elements that contain an empty string.
RemoveEmptyEntries
The return value does not include array elements that contain an empty string.

See Also

Project CorLib Overview

Class CorString Overview


CorString: ToCharArray

ToCharArray

Creates and array of chars (Integers) from the specified string.

 Public Function ToCharArray(
      ByRef s As String,
      Optional ByRef StartIndex As Variant,
      Optional ByRef Length As Variant ) As Integer ( )

Parameters

s
[ByRef] String. The string to create the chars from.
StartIndex
[ByRef] Optional. Variant. The start index in the string to begin converting to a char array. This is zero-based.
Length
[ByRef] Optional. Variant. The number of characters to convert to chars.

Return Values

Integer() - An array containing the converted characters from the string.

Remarks

The StartIndex parameter is zero-based. That is, the index of the first character in the string s is zero.

If Length is zero, the returned array is empty and has a zero length. If s is an empty string (""), the returned array is empty and has a zero length.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | StartIndex or Length is less than zero. -or- StartIndex plus Length is greater than the length of s.

Examples

The following example converts a substring within a string to an array of characters, then enumerates and displays the elements of the array.

Public Sub Main()
    Const Str As String = "012wxyz789"
    Dim Arr() As Integer

    Arr = CorString.ToCharArray(Str, 3, 4)

    Debug.Print CorString.Format("The letters in '{0}' are: '{1}'", Str, NewString(Arr))

    Debug.Print CorString.Format("Each letter in '{0}' is:", Str)

    Dim c As Variant
    For Each c In Arr
        Debug.Print ChrW$(c)
    Next
End Sub

' This code produces the following output.
'
'    The letters in '012wxyz789' are: 'wxyz'
'    Each letter in '012wxyz789' is:
'    w
'    x
'    y
'    z

See Also

Project CorLib Overview

Class CorString Overview


CorString: Trim

Trim

Removes all leading and trailing occurrences of a set of characters specified in an array from the s parameter.

 Public Function Trim(
      ByRef s As String,
      Optional ByRef TrimChars As Variant ) As String

Parameters

s
[ByRef] String. The string to be trimmed.
TrimChars
[ByRef] Optional. Variant. An array of Unicode characters to remove. String and Integer() are accepted.

Return Values

String - The string that remains after all occurrences of characters in the TrimChars parameter are removed from the start and end of s. If TrimChars is missing, white-space characters are removed instead.

Remarks

TrimChars can be either a String or an Integer(). If a String is passed in it will be treated as an Integer() and each character will be used separately.

The Trim method removes from s all leading and trailing characters that are in the TrimChars parameter. The trim operation stops when a character that is not in TrimChars is encountered. For example, if s is "123abc456xyz789" and TrimChars contains the digits from "1" through "9", the Trim method returns "abc456xyz".

Note
This method does not modify the s parameter. Instead, it returns a new string in which all leading and trailing white-space characters found in s are removed.

Exceptions

Exception | Condition
ArgumentException | TrimChars was not a String or Integer().

Examples

The following example demonstrates trimming the trailing characters defined by a String and an Integer().

Public Sub Main()
    Const Digits As String = "0123456789"
    Const Str As String = "324357abcx987234"
    Dim DigitChars() As Integer

    DigitChars = CorString.ToCharArray(Digits)

    Debug.Print CorString.Trim(Str, Digits)
    Debug.Print CorString.Trim(Str, DigitChars)
End Sub

' The previous code outputs the following.
'
'    abcx
'    abcx

See Also

Project CorLib Overview

Class CorString Overview

TrimStart

TrimEnd

ToCharArray


CorString: TrimEnd

TrimEnd

Removes all trailing occurrences of a set of characters specified in an array from the s parameter.

 Public Function TrimEnd(
      ByRef s As String,
      Optional ByRef TrimChars As Variant ) As String

Parameters

s
[ByRef] String. The string to be trimmed.
TrimChars
[ByRef] Optional. Variant. An array of Unicode characters to remove. String and Integer() are accepted.

Return Values

String - The string that remains after all occurrences of characters in the TrimChars parameter are removed from the end of s. If TrimChars is missing, white-space characters are removed instead.

Remarks

TrimChars can be either a String or an Integer(). If a String is passed in it will be treated as an Integer() and each character will be used separately.

The TrimEnd method removes from s all trailing characters that are in the TrimChars parameter. The trim operation stops when a character that is not in TrimChars is encountered. For example, if s is "123abc456xyz789" and TrimChars contains the digits from "1" through "9", the TrimEnd method returns "123abc456xyz".

Note
This method does not modify the s parameter. Instead, it returns a new string in which all trailing white-space characters found in s are removed.

Exceptions

Exception | Condition
ArgumentException | TrimChars was not a String or Integer().

Examples

The following example demonstrates trimming the trailing characters defined by a String and an Integer().

Public Sub Main()
    Const Digits As String = "0123456789"
    Const Str As String = "324357abcx987234"
    Dim DigitChars() As Integer

    DigitChars = CorString.ToCharArray(Digits)

    Debug.Print CorString.TrimEnd(Str, Digits)
    Debug.Print CorString.TrimEnd(Str, DigitChars)
End Sub

' The previous code outputs the following.
'
'   324357abcx
'   324357abcx

See Also

Project CorLib Overview

Class CorString Overview

Trim

TrimStart

ToCharArray


CorString: TrimStart

TrimStart

Removes all leading occurrences of a set of characters specified in an array from the s parameter.

 Public Function TrimStart(
      ByRef s As String,
      Optional ByRef TrimChars As Variant ) As String

Parameters

s
[ByRef] String. The string to be trimmed.
TrimChars
[ByRef] Optional. Variant. An array of Unicode characters to remove. String and Integer() are accepted.

Return Values

String - The string that remains after all occurrences of characters in the TrimChars parameter are removed from the start of s. If TrimChars is missing, white-space characters are removed instead.

Remarks

TrimChars can be either a String or an Integer(). If a String is passed in it will be treated as an Integer() and each character will be used separately.

The TrimStart method removes from s all leading characters that are in the TrimChars parameter. The trim operation stops when a character that is not in TrimChars is encountered. For example, if s is "123abc456xyz789" and TrimChars contains the digits from "1" through "9", the TrimStart method returns "abc456xyz789".

Note
This method does not modify the s parameter. Instead, it returns a new string in which all leading white-space characters found in s are removed.

Exceptions

Exception | Condition
ArgumentException | TrimChars was not a String or Integer().

Examples

The following example demonstrates trimming the leading characters defined by a String and an Integer().

Public Sub Main()
    Const Digits As String = "0123456789"
    Const Str As String = "324357abcx987234"
    Dim DigitChars() As Integer

    DigitChars = CorString.ToCharArray(Digits)

    Debug.Print CorString.TrimStart(Str, Digits)
    Debug.Print CorString.TrimStart(Str, DigitChars)
End Sub

' The previous code outputs the following.
'
'    abcx987234
'    abcx987234

See Also

Project CorLib Overview

Class CorString Overview

Trim

TrimEnd

ToCharArray


CryptoAPIHash

CryptoAPIHash

Wraps the CryptoAPI hash functions to be used in the HashAlgorithmBase callback methods.

Implements:

IHashAlgorithm

See Also

Project CorLib Overview

Class CryptoAPIHash Overview


CryptoAPIHash: IHashAlgorithm

IHashAlgorithm

 Implements IHashAlgorithm

Return Values

IHashAlgorithm -

See Also

Project CorLib Overview

Class CryptoAPIHash Overview


CryptoAPITransform

CryptoAPITransform

Utilizes the Windows CryptoAPI cryptography services to perform data transformations.

Implements:

ICryptoTransform
IObject

Public:

Properties:

Name | Description
CanReuseTransform (get) | Gets a value indicating if the current transfrom can be reused.
CanTransformMultipleBlocks (get) | Gets a value indicating whether multiple blocks can be transformed.
InputBlockSize (get) | Gets the size of one block of data that is to be processed.
KeyHandle (get) | Gets the actual handle to a key created by the CryptoAPI service.
OutputBlockSize (get) | Gets the size of the resulting block of data after an input block of data has been processed.

Methods:

Name | Description
Clear | Releases the key and context of the CryptoAPI provider.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function. An override might be necessary if the hashcode should be derived from a value contained within the class.
Reset | Resets the transform so a new set of data can be processed.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides. A Person class may return the persons name instead.
TransformBlock | Processes a set of data, encrypting or decrypting it.
TransformFinalBlock | Processes a set of data adding any padding needed to complete the process.

Remarks

This class is used to support three cryptographic service providers within the CryptoAPI: DES, TripleDES, and RC2.

See Also

Project CorLib Overview

Class CryptoAPITransform Overview

DESCryptoServiceProvider

TripleDESCryptoServiceProvider

RC2CryptoServiceProvider


CryptoAPITransform: CanReuseTransform (get)

CanReuseTransform

Gets a value indicating if the current transfrom can be reused.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class CryptoAPITransform Overview


CryptoAPITransform: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Gets a value indicating whether multiple blocks can be transformed.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class CryptoAPITransform Overview


CryptoAPITransform: Clear

Clear

Releases the key and context of the CryptoAPI provider.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class CryptoAPITransform Overview


CryptoAPITransform: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test equality on.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class CryptoAPITransform Overview

IObject


CryptoAPITransform: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

An override might be necessary if the hashcode should be derived from a value contained within the class.

 Public Function GetHashCode ( ) As Long

Return Values

Long -

See Also

Project CorLib Overview

Class CryptoAPITransform Overview


CryptoAPITransform: ICryptoTransform

ICryptoTransform

 Implements ICryptoTransform

Return Values

ICryptoTransform -

See Also

Project CorLib Overview

Class CryptoAPITransform Overview


CryptoAPITransform: InputBlockSize (get)

InputBlockSize

Gets the size of one block of data that is to be processed.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - The size of one block of data to be processed.

Remarks

When calling the TransformBlock method, the InputCount must be zero or a multiple of this value.

Read Only.

See Also

Project CorLib Overview

Class CryptoAPITransform Overview


CryptoAPITransform: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class CryptoAPITransform Overview


CryptoAPITransform: KeyHandle (get)

KeyHandle

Gets the actual handle to a key created by the CryptoAPI service.

 Public Property Get KeyHandle ( ) As Long

Return Values

Long - A handle to a CryptoAPI key.

Read Only.

See Also

Project CorLib Overview

Class CryptoAPITransform Overview


CryptoAPITransform: OutputBlockSize (get)

OutputBlockSize

Gets the size of the resulting block of data after an input block of data has been processed.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - The size of the resulting block of data after an input block of data has been processed.

Read Only.

See Also

Project CorLib Overview

Class CryptoAPITransform Overview


CryptoAPITransform: Reset

Reset

Resets the transform so a new set of data can be processed.

 Public Sub Reset ( )

See Also

Project CorLib Overview

Class CryptoAPITransform Overview


CryptoAPITransform: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

A Person class may return the persons name instead.

 Public Function ToString ( ) As String

Return Values

String -

See Also

Project CorLib Overview

Class CryptoAPITransform Overview


CryptoAPITransform: TransformBlock

TransformBlock

Processes a set of data, encrypting or decrypting it.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to be processed.
InputOffset
[ByVal] Long. The index to begin processing from.
InputCount
[ByVal] Long. The amount of data to be processed.
OutputBuffer
[ByRef] Byte. The buffer to place the processed data.
OutputOffset
[ByVal] Long. The index to begin placing the processed data.

Return Values

Long - The number of bytes that were processed.

Remarks

The InputCount must be an exact multiple of the InputBlockSize or an exception will be thrown.

See Also

Project CorLib Overview

Class CryptoAPITransform Overview


CryptoAPITransform: TransformFinalBlock

TransformFinalBlock

Processes a set of data adding any padding needed to complete the process.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The final data to be processed.
InputOffset
[ByVal] Long. The index to begin processing from.
InputCount
[ByVal] Long. The amount of data to be processed.

Return Values

Byte() - The final block of processed data.

Remarks

Once a final block has been processed, the transform is reset to begin transforming new data.

See Also

Project CorLib Overview

Class CryptoAPITransform Overview


CryptoConfig

CryptoConfig

Accesses the cryptography configuration information.

Public:

Methods:

Name | Description
AddAlgorithm | Adds a set of names to algorithm mappings to be used for the current application domain.
CreateFromName | Creates a cryptography object based on the name.
EncodeOID | Returns the encoded version of an Object Identifier.
MapNameToOID | Returns an object identifier (OID) for a specific name.

Remarks

The following table shows the simple names recognized by this class and the default algorithm implementations to which they map.
Simple name | Algorithm implemntation
DES, CorLib.DES | DESCryptoServiceProvider
3DES, TripleDES, Triple DES | TripleDESCryptoServiceProvider
RC2, CorLib.RC2 | RC2CryptoServiceProvider
Rinjdael, CorLib.Rinjdael, CorLib.SymmertricAlgorithm | RijndaelManaged
SHA, SHA1, CorLib.SHA1, CorLib.SHA1CryptoServiceProvider, CorLib.HashAlgorithm | SHA1CryptoServiceProvider
SHA256, SHA-256, CorLib.SHA256 | SHA256Managed
SHA512, SHA-512, CorLib.SHA512 | SHA512Managed
SHA384, SHA-384, CorLib.SHA384 | SHA384Managed
MD5, CorLib.MD5, CorLib.MD5CryptoServiceProvider | MD5CryptoServiceProvider
HMACSHA1, CorLib.HMAC, CorLib.HMACSHA1, CorLib.KeyedHashAlgorithm | HMACSHA1
HMACSHA256, CorLib.HMACSHA256 | HMACSHA256
HMACSHA384, CorLib.HMACSHA384 | HMACSHA384
HMACSHA512, CorLib.HMACSHA512 | HMACSHA512
HMACMD5, CorLib.HMACMD5 | HMACMD5
HMACRIPEMD160, CorLib.HMACRIPEMD160 | HMACRIPEMD160
MACTripleDES, CorLib.MACTripleDES | MACTripleDES
RSA, CorLib.RSA, CorLib.AsymmetricAlgorithm | RSACryptoServiceProvider
DSA, CorLib.DSA | DSACryptoServiceProvider
RandomNumberGenerator, CorLib.RandomNumberGenerator | RNGCryptoServiceProvider
RIPEMD160, RIPEMD-160, CorLib.RIPEMD160 | RIPEMD160Managed

See Also

Project CorLib Overview

Class CryptoConfig Overview


CryptoConfig: AddAlgorithm

AddAlgorithm

Adds a set of names to algorithm mappings to be used for the current application domain.

 Public Sub AddAlgorithm(
      ByRef Algorithm As String,
      ParamArray Names ( ) As Variant )

Parameters

Algorithm
[ByRef] String. The algorithm to map to.
Names
[ByRef] Variant. An array of names to map to the algorithm.

Remarks

The specified mappings take precedence over the built-in mappings.

Exceptions

Exception | Condition
ArgumentException | The Algorithm parameter is empty. -or- One of the entries in the Names parameter is empty.
InvalidCastException | One of the entries in the Names parameter is not a string.

See Also

Project CorLib Overview

Class CryptoConfig Overview


CryptoConfig: CreateFromName

CreateFromName

Creates a cryptography object based on the name.

 Public Function CreateFromName(
      ByRef AlgName As String ) As Object

Parameters

AlgName
[ByRef] String. The name of the cryptography object to be created.

Return Values

Object - An instance of the specified cryptographic object or Nothing if not found.

Remarks

If the algorithm name is not found, then an attempt to create the object using CreateObject(Server.Class) is used. If no cryptographic object can be created then Nothing is returned.

For a list of simple names recognized by this class, see CryptoConfig.

See Also

Project CorLib Overview

Class CryptoConfig Overview


CryptoConfig: EncodeOID

EncodeOID

Returns the encoded version of an Object Identifier.

 Public Function EncodeOID(
      ByRef Str As String ) As Byte ( )

Parameters

Str
[ByRef] String. The object identifier as described in the X.690 standard.

Return Values

Byte() - An encoded version of the object identifier as described in the X.690 standard.

Exceptions

Exception | Condition
CryptoGraphicException | An error occurred while encoding the OID.

See Also

Project CorLib Overview

Class CryptoConfig Overview


CryptoConfig: MapNameToOID

MapNameToOID

Returns an object identifier (OID) for a specific name.

 Public Function MapNameToOID(
      ByRef Name As String ) As String

Parameters

Name
[ByRef] String. The name of the object to obtain the identifier for.

Return Values

String - The object identifier (OID) for the algorithm.

See Also

Project CorLib Overview

Class CryptoConfig Overview


CryptographicException

CryptographicException

An exception that represents an error occuring during some form of cryptographic operation.

Implements:

Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

See Also

Project CorLib Overview

Class CryptographicException Overview


CryptographicException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class CryptographicException Overview


CryptographicException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class CryptographicException Overview


CryptographicException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class CryptographicException Overview


CryptographicException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class CryptographicException Overview


CryptographicException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class CryptographicException Overview


CryptographicException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class CryptographicException Overview


CryptographicException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class CryptographicException Overview


CryptographicException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class CryptographicException Overview


CryptographicException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class CryptographicException Overview

Exception


CryptographicException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class CryptographicException Overview


CryptographicException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class CryptographicException Overview


CryptographicException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewException.

Read Only.

See Also

Project CorLib Overview

Class CryptographicException Overview


CryptographicException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class CryptographicException Overview


CryptographicException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class CryptographicException Overview


CryptographicException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class CryptographicException Overview


CryptographicException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class CryptographicException Overview


CryptoStream

CryptoStream

Provides a streaming mechanism for ciphering data.

Implements:

IObject
Stream

Public:

Types:

Name | Description
CryptoStreamMode | Specifies mode of a cryptographic stream.

Properties:

Name | Description
CanRead (get) | Gets if the stream can be read from.
CanSeek (get) | Gets if the stream can seek.
CanTimeout (get) | Gets if the Stream can timeout.
CanWrite (get) | Gets if the stream can be written to.
Length (get) | Gets the length of the current stream.
Position (get) | Gets the current position within the stream.
Position (let) | Gets the current position within the stream.
ReadTimeout (get) | Gets the amount of time must pass before a Read timeout occurs.
ReadTimeout (let) | Sets the timeout period for Read operations.
WriteTimeout (get) | Gets the timeout period for a Write operation.
WriteTimeout (let) | Sets the timeout period for a Write operation.

Methods:

Name | Description
BeginRead | Begins an Asynchronous read operation (currently is only synchronous)
BeginWrite | Begins an asynchronous buffer write. Currently the CryptoStream class does not support asynchronous buffer writing.
CloseStream | Closes the underlying Stream.
CopyTo | Reads the bytes from the current stream and writes them to another stream.
EndRead | Signifies the end of an asynchronous read from the stream.
EndWrite | Signifies the end of an asynchronous write to the stream.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
Flush | Flushes the buffers of the underlying stream.
FlushFinalBlock | Flushes the remaining data to the underlying stream.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function. An override might be necessary if the hashcode should be derived from a value contained within the class.
ReadBlock | Reads a sequence of bytes from the current CryptoStream and advances the position within the stream by the number of bytes read.
ReadByte | Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
SeekPosition | Seeks a new position within the stream.
SetLength | Sets the length of the current stream.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides. A Person class may return the persons name instead.
WriteBlock | Writes a sequence of bytes to the current CryptoStream and advances the current position within this stream by the number of bytes written.
WriteByte | Writes a single byte to the Stream.

Remarks

A CryptoStream can be written to or read from in the same manner as other stream objects. A CryptoStream is designed to be used in a daisy-chain fashion, allowing for multiple transformations to be applied as a single process.

By supplying another Stream object to the NewCryptoStream constructor, an automatic daisy-chaining of the two streams is created. The Stream does not have to be another CryptoStream object. It can be any object implementing the Stream interface.

See Also

Project CorLib Overview

Class CryptoStream Overview

Constructors


CryptoStream: BeginRead

BeginRead

Begins an Asynchronous read operation (currently is only synchronous)

 Public Function BeginRead(
      ByRef Buffer ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long,
      Optional ByVal Callback As AsyncCallback,
      Optional ByRef State As Variant ) As IAsyncResult

Parameters

Buffer
[ByRef] Byte. The array to store the bytes that are read from the stream.
Offset
[ByVal] Long. The index in Buffer to begin storing bytes.
Count
[ByVal] Long. The number of bytes to be read from the stream.
Callback
[ByVal] Optional. AsyncCallback. An object that is called when the read operation is complete.
State
[ByRef] Optional. Variant. user-defined data to be kept with the Callback object for later retrieval.

Return Values

IAsyncResult - An IAsyncResult object used to identify the corrisponding Endread and report information about the buffer read.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: BeginWrite

BeginWrite

Begins an asynchronous buffer write. Currently the CryptoStream class does not support asynchronous buffer writing.

 Public Function BeginWrite(
      ByRef Buffer ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long,
      Optional ByVal Callback As AsyncCallback,
      Optional ByRef State As Variant ) As IAsyncResult

Parameters

Buffer
[ByRef] Byte. The source array to copy the bytes from into the stream.
Offset
[ByVal] Long. The starting index in the source Buffer to begin copying from.
Count
[ByVal] Long. The maximum number of bytes to be copied into the stream.
Callback
[ByVal] Optional. AsyncCallback. A user supplied object to be notified of the finish of the writing.
State
[ByRef] Optional. Variant. User data that can be carried within the IAsyncResult object return.

Return Values

IAsyncResult - An IAsyncResult object used to identify the corrisponding EndBread and report information about the buffer read.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: CanRead (get)

CanRead

Gets if the stream can be read from.

 Public Property Get CanRead ( ) As Boolean

Return Values

Boolean - True if the stream supports reading, False otherwise.

Remarks

A CryptoStream object supports only reading or writing, not both simultaneously.

Read Only.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: CanSeek (get)

CanSeek

Gets if the stream can seek.

 Public Property Get CanSeek ( ) As Boolean

Return Values

Boolean - Always returns False.

Read Only.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: CanTimeout (get)

CanTimeout

Gets if the Stream can timeout.

 Public Property Get CanTimeout ( ) As Boolean

Return Values

Boolean - True if the stream can timeout, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: CanWrite (get)

CanWrite

Gets if the stream can be written to.

 Public Property Get CanWrite ( ) As Boolean

Return Values

Boolean - True if the Stream supports writing, False otherwise.

Remarks

A CryptoStream object supports only reading or writing, not both simultaneously.

Read Only.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: CloseStream

CloseStream

Closes the underlying Stream.

 Public Sub CloseStream ( )

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: CopyTo

CopyTo

Reads the bytes from the current stream and writes them to another stream.

 Public Sub CopyTo(
      ByVal Destination As Stream,
      Optional ByVal BufferSize As Long = 81920 )

Parameters

Destination
[ByVal] Stream. The stream to which the contents of the current stream will be copied.
BufferSize
[ByVal] Optional. Long. The size of the buffer. This value must be greater than zero. The default size is 81920.

Default: 81920

Remarks

Copying begins at the current position in the current stream, and does not reset the position of the destination stream after the copy operation is complete.

Exceptions

Exception | Condition
ArgumentNullException | Destination is Nothing.
NotSupportedException | The current stream does not support reading. -or- Destination does not support writing.
ObjectDisposedException | Either the current stream or Destination were closed before the CopyTo method was called.
IOException | An I/O error occurred.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: CryptoStreamMode

CryptoStreamMode

Specifies mode of a cryptographic stream.

 Public Enum CryptoStreamMode

Values

ReadMode = 0
Read access to a cryptographic stream.
WriteMode = 1
Write access to a cryptographic stream.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: EndRead

EndRead

Signifies the end of an asynchronous read from the stream.

 Public Function EndRead(
      ByVal AsyncResult As IAsyncResult ) As Long

Parameters

AsyncResult
[ByVal] IAsyncResult. The IAsyncResult object returned from the BeginRead function.

Return Values

Long - The number of bytes read from the stream in to Buffer in the BeginRead method.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: EndWrite

EndWrite

Signifies the end of an asynchronous write to the stream.

 Public Sub EndWrite(
      ByVal AsyncResult As IAsyncResult )

Parameters

AsyncResult
[ByVal] IAsyncResult. The IAsyncResult returned from the BeginWrite function.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test equality on.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class CryptoStream Overview

IObject


CryptoStream: Flush

Flush

Flushes the buffers of the underlying stream.

 Public Sub Flush ( )

Remarks

This does not flush the buffers within the CryptoStream. Call FlushFinalBlock to flush the remaining data to the underlying stream.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: FlushFinalBlock

FlushFinalBlock

Flushes the remaining data to the underlying stream.

 Public Sub FlushFinalBlock ( )

Remarks

This can only be called once.

Exceptions

Exception | Condition
NotSupportedException | The current stream is not writable. -or- The final block has already been transformed.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

An override might be necessary if the hashcode should be derived from a value contained within the class.

 Public Function GetHashCode ( ) As Long

Return Values

Long -

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: Length (get)

Length

Gets the length of the current stream.

 Public Property Get Length ( ) As Currency

Return Values

Currency - This property is not supported.

Read Only.

Exceptions

Exception | Condition
NotSupportedException | This property is not supported.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: Position (get)

Position

Gets the current position within the stream.

 Public Property Get Position ( ) As Currency

Return Values

Currency - This property is not supported.

Read/Write.

Exceptions

Exception | Condition
NotSupportedException | This property is not supported.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: Position (let)

Position

Gets the current position within the stream.

 Public Property Let Position(
      ByVal Value As Currency )

Parameters

Value
[ByVal] Currency. This property is not supported.

Read/Write.

Exceptions

Exception | Condition
NotSupportedException | This property is not supported.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: ReadBlock

ReadBlock

Reads a sequence of bytes from the current CryptoStream and advances the position within the stream by the number of bytes read.

 Public Function ReadBlock(
      ByRef Buffer ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long ) As Long

Parameters

Buffer
[ByRef] Byte. An array of bytes. A maximum of Count bytes are read from the current stream and stored in Buffer.
Offset
[ByVal] Long. The byte offset in Buffer at which to begin storing the data read from the current stream.
Count
[ByVal] Long. The maximum number of bytes to be read from the current stream.

Return Values

Long - The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero if the end of the stream has been reached.
Exception | Condition
NotSupportedException | The CryptoStreamMode associated with current CryptoStream object does not match the underlying stream. For example, this exception is thrown when using ReadMode with an underlying stream that is write only.
ArgumentOutOfRangeException | The Offset parameter is less than zero. -or- The Count parameter is less than zero.
ArgumentException | The sum of the Count and Offset parameters is longer than the length of the Buffer.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: ReadByte

ReadByte

Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.

 Public Function ReadByte ( ) As Long

Return Values

Long - The unsigned byte cast to a Long, or -1 if at the end of the stream.

Remarks

Use the CanRead property to determine whether the current instance supports reading.

Exceptions

Exception | Condition
NotSupportedException | The stream does not support reading.
ObjectDisposedException | Methods were called after the stream was closed.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: ReadTimeout (get)

ReadTimeout

Gets the amount of time must pass before a Read timeout occurs.

 Public Property Get ReadTimeout ( ) As Long

Return Values

Long - Returns the timeout period in milliseconds.

Read/Write.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: ReadTimeout (let)

ReadTimeout

Sets the timeout period for Read operations.

 Public Property Let ReadTimeout(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The timeout period in milliseconds.

Read/Write.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: SeekPosition

SeekPosition

Seeks a new position within the stream.

 Public Function SeekPosition(
      ByVal Offset As Currency,
      ByVal Origin As SeekOrigin ) As Currency

Parameters

Offset
[ByVal] Currency. A byte offset relative to the Origin parameter.
Origin
[ByVal] SeekOrigin. A SeekOrigin value indicating the reference point used to obtain the new position.

Return Values

Currency - This method is not supported.

Exceptions

Exception | Condition
NotSupportedException | This method is not supported.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: SetLength

SetLength

Sets the length of the current stream.

 Public Sub SetLength(
      ByVal Value As Currency )

Parameters

Value
[ByVal] Currency. The new length of the stream.

Exceptions

Exception | Condition
NotSupportedException | This method is not supported.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: Stream

Stream

 Implements Stream

Return Values

Stream -

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

A Person class may return the persons name instead.

 Public Function ToString ( ) As String

Return Values

String -

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: WriteBlock

WriteBlock

Writes a sequence of bytes to the current CryptoStream and advances the current position within this stream by the number of bytes written.

 Public Sub WriteBlock(
      ByRef Buffer ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long )

Parameters

Buffer
[ByRef] Byte. An array of bytes. This method copies Count bytes from Buffer to the current stream.
Offset
[ByVal] Long. The byte offset in Buffer at which to begin copying bytes to the current stream.
Count
[ByVal] Long. The number of bytes to be written to the current stream.

Exceptions

Exception | Condition
NotSupportedException | The CryptoStreamMode associated with current CryptoStream object does not match the underlying stream. For example, this exception is thrown when using WriteMode with an underlying stream that is read only.
ArgumentOutOfRangeException | The Offset parameter is less than zero. -or- The Count parameter is less than zero.
ArgumentException | The sum of the Count and Offset parameters is longer than the length of the Buffer.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: WriteByte

WriteByte

Writes a single byte to the Stream.

 Public Sub WriteByte(
      ByVal Value As Byte )

Parameters

Value
[ByVal] Byte. The byte to be written to the stream.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: WriteTimeout (get)

WriteTimeout

Gets the timeout period for a Write operation.

 Public Property Get WriteTimeout ( ) As Long

Return Values

Long - The timeout period in milliseconds.

Read/Write.

See Also

Project CorLib Overview

Class CryptoStream Overview


CryptoStream: WriteTimeout (let)

WriteTimeout

Sets the timeout period for a Write operation.

 Public Property Let WriteTimeout(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The timeout period in milliseconds.

Read/Write.

See Also

Project CorLib Overview

Class CryptoStream Overview


CspKeyContainerInfo

CspKeyContainerInfo

Represents information about a Crypto Service Providers Key Container.

Implements:

IObject

Public:

Properties:

Name | Description
Accessible (get) | Returns if a key in a key container is accessible.
Exportable (get) | Returns if a key in a key container can be exported out of the container.
KeyContainerName (get) | Returns the name of the key container.
KeyNumber (get) | Returns the key number, representing the type of key.
MachineKeyStore (get) | Returns if the key is stored in a machine storage container.
Protected (get) | Returns if the key is protected.
ProviderName (get) | Returns the name of the cryptography service provider.
ProviderType (get) | Returns the type of cryptography service provider.
RandomlyGenerated (get) | Returns if the key container was randomly generated or imported.
Removable (get) | Returns if the key can be removed from the key container.
UniqueKeyContainerName (get) | Returns a unique key container name.

Methods:

Name | Description
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function. An override might be necessary if the hashcode should be derived from a value contained within the class.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides. A Person class may return the persons name instead.

Remarks

To create an instance of CspKeyContainerInfo use the NewCspKeyContainerInfo constructor.

See Also

Project CorLib Overview

Class CspKeyContainerInfo Overview

Constructors


CspKeyContainerInfo: Accessible (get)

Accessible

Returns if a key in a key container is accessible.

 Public Property Get Accessible ( ) As Boolean

Return Values

Boolean - Returns True if the key is accessible, False otherwise.

Read/Write.

See Also

Project CorLib Overview

Class CspKeyContainerInfo Overview


CspKeyContainerInfo: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test equality on.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class CspKeyContainerInfo Overview

IObject


CspKeyContainerInfo: Exportable (get)

Exportable

Returns if a key in a key container can be exported out of the container.

 Public Property Get Exportable ( ) As Boolean

Return Values

Boolean - Returns True if the key can be exported, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class CspKeyContainerInfo Overview


CspKeyContainerInfo: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

An override might be necessary if the hashcode should be derived from a value contained within the class.

 Public Function GetHashCode ( ) As Long

Return Values

Long -

See Also

Project CorLib Overview

Class CspKeyContainerInfo Overview


CspKeyContainerInfo: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class CspKeyContainerInfo Overview


CspKeyContainerInfo: KeyContainerName (get)

KeyContainerName

Returns the name of the key container.

 Public Property Get KeyContainerName ( ) As String

Return Values

String - The name of the key container.

Read Only.

See Also

Project CorLib Overview

Class CspKeyContainerInfo Overview


CspKeyContainerInfo: KeyNumber (get)

KeyNumber

Returns the key number, representing the type of key.

 Public Property Get KeyNumber ( ) As KeyNumber

Return Values

KeyNumber - Returns 1 for Exchange, 2 for Signature.

Read Only.

See Also

Project CorLib Overview

Class CspKeyContainerInfo Overview


CspKeyContainerInfo: MachineKeyStore (get)

MachineKeyStore

Returns if the key is stored in a machine storage container.

 Public Property Get MachineKeyStore ( ) As Boolean

Return Values

Boolean - Returns True if the key is in a machine set, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class CspKeyContainerInfo Overview


CspKeyContainerInfo: Protected (get)

Protected

Returns if the key is protected.

 Public Property Get Protected ( ) As Boolean

Return Values

Boolean - Returns True if protected, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class CspKeyContainerInfo Overview


CspKeyContainerInfo: ProviderName (get)

ProviderName

Returns the name of the cryptography service provider.

 Public Property Get ProviderName ( ) As String

Return Values

String - A string containing the name of the provider.

Read Only.

See Also

Project CorLib Overview

Class CspKeyContainerInfo Overview


CspKeyContainerInfo: ProviderType (get)

ProviderType

Returns the type of cryptography service provider.

 Public Property Get ProviderType ( ) As Long

Return Values

Long - Returns the type of the provider.

Read Only.

See Also

Project CorLib Overview

Class CspKeyContainerInfo Overview


CspKeyContainerInfo: RandomlyGenerated (get)

RandomlyGenerated

Returns if the key container was randomly generated or imported.

 Public Property Get RandomlyGenerated ( ) As Boolean

Return Values

Boolean - Returns True if the key container was randomly generated, False otherwise.

Read/Write.

See Also

Project CorLib Overview

Class CspKeyContainerInfo Overview


CspKeyContainerInfo: Removable (get)

Removable

Returns if the key can be removed from the key container.

 Public Property Get Removable ( ) As Boolean

Return Values

Boolean - Returns True if the key can be removed, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class CspKeyContainerInfo Overview


CspKeyContainerInfo: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

A Person class may return the persons name instead.

 Public Function ToString ( ) As String

Return Values

String -

See Also

Project CorLib Overview

Class CspKeyContainerInfo Overview


CspKeyContainerInfo: UniqueKeyContainerName (get)

UniqueKeyContainerName

Returns a unique key container name.

 Public Property Get UniqueKeyContainerName ( ) As String

Return Values

String - A unique key container name.

Read Only.

See Also

Project CorLib Overview

Class CspKeyContainerInfo Overview


CspParameters

CspParameters

Contains parameter values that can be passed on to cryptography providers.

Implements:

IObject

Public:

Types:

Name | Description
CspProviderFlags | A set of flags that can be used to modify the behavior of cryptographic providers.

Properties:

Name | Description
Flags (get) | Gets the flags for CspParameters that modify the behavior of the cryptographic service provider (CSP).
Flags (let) | Sets the flags for CspParameters that modify the behavior of the cryptographic service provider (CSP).
KeyContainerName (get) | Returns the key container name.
KeyContainerName (let) | Sets the key container name.
KeyNumber (get) | Returns if an Asymmetric algorithm key is a Signature or Exchange key.
KeyNumber (let) | Sets if an Asymmetric algorithm key is a Signature or Exchange key.
ProviderName (get) | Returns the Provider name of the crypto service provider.
ProviderName (let) | Sets the name of the provider to create when acquiring a crypto service provider.
ProviderType (get) | Gets the provider type code for CspParameters.
ProviderType (let) | Sets the provider type code for CspParameters.

Methods:

Name | Description
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function. An override might be necessary if the hashcode should be derived from a value contained within the class.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides. A Person class may return the persons name instead.

See Also

Project CorLib Overview

Class CspParameters Overview


CspParameters: CspProviderFlags

CspProviderFlags

A set of flags that can be used to modify the behavior of cryptographic providers.

 Public Enum CspProviderFlags

Values

NoFlags = 0
No flags are to be set.
NoPrompt = 64
Prevents the service provider from display any UI for this context.
UseArchivableKey = 16
Allows a key to be exported for archival or recovery.
UseDefaultKeyContainer = 2
Use the key information from the default container.
UseExistingKey = 8
Use the key information from the current key.
UseMachineKeyStore = 1
Use the key information from the computers key store.
UseNonExportableKey = 4
Use key information that cannot be exported.
UseUserProtectedKey = 32
Notify the user through a dialog box or another method when certain actions are attempting to use a key. This flag is not compatible with the NoPrompt flag.

See Also

Project CorLib Overview

Class CspParameters Overview


CspParameters: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test equality on.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class CspParameters Overview

IObject


CspParameters: Flags (get)

Flags

Gets the flags for CspParameters that modify the behavior of the cryptographic service provider (CSP).

 Public Property Get Flags ( ) As CspProviderFlags

Return Values

CspProviderFlags - An enumeration value, or a bitwise combination of enumeration values.

Read/Write.

See Also

Project CorLib Overview

Class CspParameters Overview


CspParameters: Flags (let)

Flags

Sets the flags for CspParameters that modify the behavior of the cryptographic service provider (CSP).

 Public Property Let Flags(
      ByVal Value As CspProviderFlags )

Parameters

Value
[ByVal] CspProviderFlags. An enumeration value, or a bitwise combination of enumeration values.

Read/Write.

Exceptions

Exception | Condition
ArgumentException | Value is not a valid enumeration value.

See Also

Project CorLib Overview

Class CspParameters Overview


CspParameters: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

An override might be necessary if the hashcode should be derived from a value contained within the class.

 Public Function GetHashCode ( ) As Long

Return Values

Long -

See Also

Project CorLib Overview

Class CspParameters Overview


CspParameters: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class CspParameters Overview


CspParameters: KeyContainerName (get)

KeyContainerName

Returns the key container name.

 Public Property Get KeyContainerName ( ) As String

Return Values

String - The name of the key container holding a key.

Remarks

A key can be kept within a container for later retrieval. This is the name of that container.

Read/Write.

See Also

Project CorLib Overview

Class CspParameters Overview


CspParameters: KeyContainerName (let)

KeyContainerName

Sets the key container name.

 Public Property Let KeyContainerName(
      ByVal Value As String )

Parameters

Value
[ByVal] String. The key container name that will hold a key.

Remarks

A key can be kept within a container for later retrieval. This is the name of that container.

Read/Write.

See Also

Project CorLib Overview

Class CspParameters Overview


CspParameters: KeyNumber (get)

KeyNumber

Returns if an Asymmetric algorithm key is a Signature or Exchange key.

 Public Property Get KeyNumber ( ) As Long

Return Values

Long - Returns 1 for Exchange, or 2 for Signature.

Remarks

An Exchange key is a public/private key pair use for Asymmetric encryption. A Signature is a key pair used to digitally sign a message or file.

Read/Write.

See Also

Project CorLib Overview

Class CspParameters Overview


CspParameters: KeyNumber (let)

KeyNumber

Sets if an Asymmetric algorithm key is a Signature or Exchange key.

 Public Property Let KeyNumber(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. Set to 1 for Exchange, or 2 for Signature.

Remarks

An Exchange key is a public/private key pair use for Asymmetric encryption. A Signature is a key pair used to digitally sign a message or file.

Read/Write.

See Also

Project CorLib Overview

Class CspParameters Overview


CspParameters: ProviderName (get)

ProviderName

Returns the Provider name of the crypto service provider.

 Public Property Get ProviderName ( ) As String

Return Values

String - Returns the name of the provider.

Read/Write.

See Also

Project CorLib Overview

Class CspParameters Overview


CspParameters: ProviderName (let)

ProviderName

Sets the name of the provider to create when acquiring a crypto service provider.

 Public Property Let ProviderName(
      ByVal Value As String )

Parameters

Value
[ByVal] String. The provider name to acquire.

Read/Write.

See Also

Project CorLib Overview

Class CspParameters Overview


CspParameters: ProviderType (get)

ProviderType

Gets the provider type code for CspParameters.

 Public Property Get ProviderType ( ) As Long

Return Values

Long - The numeric code of the provider.

Remarks

Use the ProviderType property to specify a provider type by passing a numeric value that represents that provider. The numeric values that represent the default provider types are defined in the WinCrypt.h header file:

  • To specify a provider compatible with the RSA class, pass a value of 1.
  • To specify a provider compatible with the DSA class, pass a value of 13.
The following table lists the provider types and their corresponding numeric values defined in the WinCrypt.h header file.
Provider Type | Numeric Value
PROV_RSA_RULL | 1
PROV_RSA_SIG | 2
PROV_DSS | 3
PROV_FORTEZZA | 4
PROV_MS_EXCHANGE | 5
PROV_SSL | 6
PROV_RSA_SCHANNEL | 12
PROV_DSS_DH | 13
PROV_EC_ECDSA_SIG | 14
PROV_EC_ECNRA_SIG | 15
PROV_EC_ECDSA_FULL | 16
PROV_EC_ECNRA_FULL | 17
PROV_DH_SCHANNEL | 18
PROV_SPYRUS_LYNKS | 20
PROV_RNG | 21
PROV_INTEL_SEC | 22
PROV_REPLACE_OWF | 23
PROV_RSA_AES | 24
For more information about the default provider types and their behaviors, see the Microsoft Cryptography API (CAPI) documentation in the MSDN library.

Read/Write.

See Also

Project CorLib Overview

Class CspParameters Overview


CspParameters: ProviderType (let)

ProviderType

Sets the provider type code for CspParameters.

 Public Property Let ProviderType(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The numeric code of the provider.

Remarks

Use the ProviderType property to specify a provider type by passing a numeric value that represents that provider. The numeric values that represent the default provider types are defined in the WinCrypt.h header file:

  • To specify a provider compatible with the RSA class, pass a value of 1.
  • To specify a provider compatible with the DSA class, pass a value of 13.
The following table lists the provider types and their corresponding numeric values defined in the WinCrypt.h header file.
Provider Type | Numeric Value
PROV_RSA_RULL | 1
PROV_RSA_SIG | 2
PROV_DSS | 3
PROV_FORTEZZA | 4
PROV_MS_EXCHANGE | 5
PROV_SSL | 6
PROV_RSA_SCHANNEL | 12
PROV_DSS_DH | 13
PROV_EC_ECDSA_SIG | 14
PROV_EC_ECNRA_SIG | 15
PROV_EC_ECDSA_FULL | 16
PROV_EC_ECNRA_FULL | 17
PROV_DH_SCHANNEL | 18
PROV_SPYRUS_LYNKS | 20
PROV_RNG | 21
PROV_INTEL_SEC | 22
PROV_REPLACE_OWF | 23
PROV_RSA_AES | 24
For more information about the default provider types and their behaviors, see the Microsoft Cryptography API (CAPI) documentation in the MSDN library.

Read/Write.

See Also

Project CorLib Overview

Class CspParameters Overview


CspParameters: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

A Person class may return the persons name instead.

 Public Function ToString ( ) As String

Return Values

String -

See Also

Project CorLib Overview

Class CspParameters Overview


CultureInfo

CultureInfo

Represents information about a culture, such as number and date formatting.

Implements:

ICloneable
IFormatProvider
IObject

Public:

Properties:

Name | Description
Calendar (get) | Returns the default calendar for the current culture.
DateTimeFormat (get) | Returns the DateTimeFormatInfo associated with this culture.
DateTimeFormat (set) | Sets the DateTimeFormatInfo for the specific culture object.
DisplayName (get) | Returns a displayable name for the culture name.
EnglishName (get) | Returns the english translation for the culture name.
IsNeutralCulture (get) | Returns if this culture is neutral.
IsReadOnly (get) | Returns if this instance is ReadOnly.
LCID (get) | Returns the Locale ID for this culture instance.
Name (get) | Returns the name of the culture.
NativeName (get) | Returns the native name for this culture instance.
NumberFormat (get) | Returns the NumberFormatInfo associated with this culture.
NumberFormat (set) | Sets the NumberFormatInfo for the specific culture object.
OptionalCalendars (get) | Returns a list of optional calendars supported by the culture.
Parent (get) | Returns the parent culture for this culture.
ThreeLetterISOLanguageName (get) | Returns the 3 letter ISO 639-2 standard of the culture name.
ThreeLetterWindowsLanguageName (get) | Returns the 3 letter Windows name of the culture name.
TwoLetterISOLanguageName (get) | Returns the 2 letter ISO 639-1 standard of the culture name.
UseUserOverride (get) | Returns whether the culture instance is using the user settings.

Methods:

Name | Description
Clone | Returns a clone of this culture instance.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetFormat | Returns a format provider of the specified type.
GetHashCode | Returns a pseudo-unique number identifying this instance.
ToString | Returns a string representation of this object instance.

See Also

Project CorLib Overview

Class CultureInfo Overview

Constructors

CultureInfoStatic

ICloneable

IFormatProvider


CultureInfo: Calendar (get)

Calendar

Returns the default calendar for the current culture.

 Public Property Get Calendar ( ) As Calendar

Return Values

Calendar - The calendar associated with the current culture.

Read Only.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: Clone

Clone

Returns a clone of this culture instance.

 Public Function Clone ( ) As CultureInfo

Return Values

CultureInfo - An instance of this culture. ReadOnly status is retained.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: DateTimeFormat (get)

DateTimeFormat

Returns the DateTimeFormatInfo associated with this culture.

 Public Property Get DateTimeFormat ( ) As DateTimeFormatInfo

Return Values

DateTimeFormatInfo - The DateTimeFormatInfo for this culture that can be used to format dates and times specific to this culture.

Read/Write.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: DateTimeFormat (set)

DateTimeFormat

Sets the DateTimeFormatInfo for the specific culture object.

 Public Property Set DateTimeFormat(
      ByVal Value As DateTimeFormatInfo )

Parameters

Value
[ByVal] DateTimeFormatInfo. The DateTimeFormatInfo object to associate with this object instance.

Read/Write.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: DisplayName (get)

DisplayName

Returns a displayable name for the culture name.

 Public Property Get DisplayName ( ) As String

Return Values

String - The name as it should be displayed.

Read Only.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: EnglishName (get)

EnglishName

Returns the english translation for the culture name.

 Public Property Get EnglishName ( ) As String

Return Values

String - The name in the english language.

Read Only.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: GetFormat

GetFormat

Returns a format provider of the specified type.

 Public Function GetFormat(
      ByRef FormatType As String ) As Object

Parameters

FormatType
[ByRef] String. The type of format provider that is requested.

Return Values

Object - The format provider, or Nothing if a provider was not found.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: IFormatProvider

IFormatProvider

 Implements IFormatProvider

Return Values

IFormatProvider -

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: IsNeutralCulture (get)

IsNeutralCulture

Returns if this culture is neutral.

 Public Property Get IsNeutralCulture ( ) As Boolean

Return Values

Boolean - Indication of the cultures neutrality.

Remarks

A neutral culture is a culture that has no region specified. en is a neutral culture, where as en-US is not.

Read Only.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: IsReadOnly (get)

IsReadOnly

Returns if this instance is ReadOnly.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - The readonly status of this instance.

Read Only.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: LCID (get)

LCID

Returns the Locale ID for this culture instance.

 Public Property Get LCID ( ) As Long

Return Values

Long - The Locale ID.

Remarks

A 32 bit LCID is in the format of: 31 - 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 +-----+ +---------+ +---------------+ +-----------------+ | | | Primary language ID (10 bits) | | +----------- Sublanguage ID (6 its) | +----------------------- Sort ID (4 bits) +--------------------------------- Reserved (12 bits)

Read Only.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: Name (get)

Name

Returns the name of the culture.

 Public Property Get Name ( ) As String

Return Values

String - The name of the culture.

Remarks

The culture name follows the RFC 1766 standard in that there are 2 parts. A 2 letter culture and 2 letter region: en-US = English (United States)

Read Only.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: NativeName (get)

NativeName

Returns the native name for this culture instance.

 Public Property Get NativeName ( ) As String

Return Values

String - The name using native characters to spell the culture name.

Read Only.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: NumberFormat (get)

NumberFormat

Returns the NumberFormatInfo associated with this culture.

 Public Property Get NumberFormat ( ) As NumberFormatInfo

Return Values

NumberFormatInfo - The NumberFormatInfo for this culture that can be used to format numbers specific to this culture.

Read/Write.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: NumberFormat (set)

NumberFormat

Sets the NumberFormatInfo for the specific culture object.

 Public Property Set NumberFormat(
      ByVal Value As NumberFormatInfo )

Parameters

Value
[ByVal] NumberFormatInfo. The NumberFormatInfo to associate with this object instance.

Read/Write.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: OptionalCalendars (get)

OptionalCalendars

Returns a list of optional calendars supported by the culture.

 Public Property Get OptionalCalendars ( ) As Calendar ( )

Return Values

Calendar() - A list of calendars associated with the current culture.

Read Only.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: Parent (get)

Parent

Returns the parent culture for this culture.

 Public Property Get Parent ( ) As CultureInfo

Return Values

CultureInfo - The parent culture for this culture. If this culture is invariant, then invariant is returned.

Read Only.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: ThreeLetterISOLanguageName (get)

ThreeLetterISOLanguageName

Returns the 3 letter ISO 639-2 standard of the culture name.

 Public Property Get ThreeLetterISOLanguageName ( ) As String

Return Values

String - The name of the culture in three letters.

Read Only.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: ThreeLetterWindowsLanguageName (get)

ThreeLetterWindowsLanguageName

Returns the 3 letter Windows name of the culture name.

 Public Property Get ThreeLetterWindowsLanguageName ( ) As String

Return Values

String - The name of the culture found in windows.

Read Only.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: TwoLetterISOLanguageName (get)

TwoLetterISOLanguageName

Returns the 2 letter ISO 639-1 standard of the culture name.

 Public Property Get TwoLetterISOLanguageName ( ) As String

Return Values

String - The name of the culture in 2 letters.

Read Only.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfo: UseUserOverride (get)

UseUserOverride

Returns whether the culture instance is using the user settings.

 Public Property Get UseUserOverride ( ) As Boolean

Return Values

Boolean - Indication as to if the culture is using the user setting defined in the control panel.

Read Only.

See Also

Project CorLib Overview

Class CultureInfo Overview


CultureInfoStatic

CultureInfoStatic

Provides a set of static methods retrieve CultureInfo objects.

Public:

Types:

Name | Description
CultureTypes | A list of culture type filters used in GetCultures.

Properties:

Name | Description
CurrentCulture (get) | Returns the current culture associated with this machine.
CurrentCulture (set) | Sets the current culcture associated with this machine.
CurrentUICulture (get) | Returns the culture for the current thread.
InstalledUICulture (get) | Returns the culture for the current systems language.
InvariantCulture (get) | Returns a ReadOnly version of the invariant culture.

Methods:

Name | Description
GetCultures | Returns a set of CultureInfo objects.
ReadOnly | Returns a read-only wrapper around the specified CultureInfo.

Remarks

This class cannot be instantiated. In order to access the methods use the variable name directly.

 Dim Cultures() As CultureInfo
 Cultures = CultureInfo.GetCultures(AllCultures)

See Also

Project CorLib Overview

Class CultureInfoStatic Overview

CultureInfo


CultureInfoStatic: CultureTypes

CultureTypes

A list of culture type filters used in GetCultures.

 Public Enum CultureTypes

Values

NeutralCultures = 1
1) Refers to cultures that are associated with a language but are not specific to a country/region. The names of these cultures consist of the lowercase two-letter code derived from ISO 639-1. For example: "en" (English) is a neutral culture. The invariant culture is included in the array of cultures returned by CultureInfo.GetCultures with this value.
SpecificCultures = 2
2) Refers to cultures that are specific to a country/region. The names of these cultures follow the RFC 1766 standard in the format "-", where is a lowercase two-letter code derived from ISO 639-1 and is an uppercase two-letter code derived from ISO 3166. For example, "en-US" (English - United States) is a specific culture.
InstalledWin32Cultures = 4
4) Refers to all cultures that are installed in the Windows system. Note that not all cultures supported by the .NET Framework are installed in the Windows system.
AllCultures = 7
7) Refers to all cultures.

See Also

Project CorLib Overview

Class CultureInfoStatic Overview


CultureInfoStatic: CurrentCulture (get)

CurrentCulture

Returns the current culture associated with this machine.

 Public Property Get CurrentCulture ( ) As CultureInfo

Return Values

CultureInfo - A ReadOnly version of CultureInfo specific for this machine.

Read/Write.

See Also

Project CorLib Overview

Class CultureInfoStatic Overview


CultureInfoStatic: CurrentCulture (set)

CurrentCulture

Sets the current culcture associated with this machine.

 Public Property Set CurrentCulture(
      ByVal Value As CultureInfo )

Parameters

Value
[ByVal] CultureInfo. The culture to bet set to.

Read/Write.

See Also

Project CorLib Overview

Class CultureInfoStatic Overview


CultureInfoStatic: CurrentUICulture (get)

CurrentUICulture

Returns the culture for the current thread.

 Public Property Get CurrentUICulture ( ) As CultureInfo

Return Values

CultureInfo - A CultureInfo object for the current thread.

Remarks

The culture is determined by the language ID of the current thread by calling GetUserDefaultUILanguage API.

Read Only.

See Also

Project CorLib Overview

Class CultureInfoStatic Overview


CultureInfoStatic: GetCultures

GetCultures

Returns a set of CultureInfo objects.

 Public Function GetCultures(
      ByVal Types As CultureTypes ) As CultureInfo ( )

Parameters

Types
[ByVal] CultureTypes. The culture types that are to be retrieved.

Return Values

CultureInfo() - An array of CultureInfo objects based on Types specified.

See Also

Project CorLib Overview

Class CultureInfoStatic Overview


CultureInfoStatic: InstalledUICulture (get)

InstalledUICulture

Returns the culture for the current systems language.

 Public Property Get InstalledUICulture ( ) As CultureInfo

Return Values

CultureInfo - A CultureInfo object for the current system language.

Remarks

The current system language is detemined by calling the GetSystemDefaultUILanguage API.

Read Only.

See Also

Project CorLib Overview

Class CultureInfoStatic Overview


CultureInfoStatic: InvariantCulture (get)

InvariantCulture

Returns a ReadOnly version of the invariant culture.

 Public Property Get InvariantCulture ( ) As CultureInfo

Return Values

CultureInfo - A ReadOnly version of the invariant culture.

Read Only.

See Also

Project CorLib Overview

Class CultureInfoStatic Overview


CultureInfoStatic: ReadOnly

ReadOnly

Returns a read-only wrapper around the specified CultureInfo.

 Public Function ReadOnly(
      ByVal Culture As CultureInfo ) As CultureInfo

Parameters

Culture
[ByVal] CultureInfo. The CultureInfo to wrap.

Return Values

CultureInfo - The wrapped ReadOnly culture.

See Also

Project CorLib Overview

Class CultureInfoStatic Overview


CursorResourceDecoder

CursorResourceDecoder

Decodes cursor byte data from a .RES formatted byte array.

Implements:

IResourceDecoder

Public:

Methods:

Name | Description
Decode | Decodes an array of bytes into a Cursor StdPicture object.
GetDecodeType | Returns the type of resource this decoder supports.
GetResource | Returns the next available resource in the decoder.

Remarks

This works exactly like the IconResourceDecoder.

See Also

Project CorLib Overview

Class CursorResourceDecoder Overview

ResourceReader

WinResourceReader


CursorResourceDecoder: Decode

Decode

Decodes an array of bytes into a Cursor StdPicture object.

 Public Function Decode(
      ByVal Key As ResourceKey,
      ByRef Bytes ( ) As Byte ) As Long

Parameters

Key
[ByVal] ResourceKey. The identifier associated with the array of bytes.
Bytes
[ByRef] Byte. The byte data containing the encoded cursor.

Return Values

Long - Returns the number of resourced decoded from the byte array. This decoder will return no more than 1.

See Also

Project CorLib Overview

Class CursorResourceDecoder Overview

ResourceKey

ResourceTypese


CursorResourceDecoder: GetDecodeType

GetDecodeType

Returns the type of resource this decoder supports.

 Public Function GetDecodeType ( ) As Variant

Return Values

Variant - This decoder returns ResourceTypes.CursorResource.

See Also

Project CorLib Overview

Class CursorResourceDecoder Overview

ResourceTypes


CursorResourceDecoder: GetResource

GetResource

Returns the next available resource in the decoder.

 Public Function GetResource(
      ByRef ReturnKey As ResourceKey,
      ByRef ReturnValue As Variant ) As Boolean

Parameters

ReturnKey
[ByRef] ResourceKey. This is set to the key that identifies the resource being returned.
ReturnValue
[ByRef] Variant. This is set to the resource value being returned.

Return Values

Boolean - If a resource has been returned, this returns True, otherwise False is returned.

Remarks

Once a resource has been returned, that resource is never returned again.

See Also

Project CorLib Overview

Class CursorResourceDecoder Overview


CursorResourceDecoder: IResourceDecoder

IResourceDecoder

 Implements IResourceDecoder

Return Values

IResourceDecoder -

See Also

Project CorLib Overview

Class CursorResourceDecoder Overview


CursorResourceEncoder

CursorResourceEncoder

Encodes a StdPicture Cursor to byte data used in .RES files.

Implements:

IResourceEncoder

Public:

Methods:

Name | Description
Encode | Encodes the StdPicture cursor.
GetEncodedResource | Retrieves the next encoded resource in the encoder.
Reset | Releases all currently encoded values.

See Also

Project CorLib Overview

Class CursorResourceEncoder Overview

ResourceWriter


CursorResourceEncoder: Encode

Encode

Encodes the StdPicture cursor.

 Public Function Encode(
      ByRef Value As Variant,
      ByRef ResourceName As Variant,
      Optional ByRef ResourceType As Variant,
      Optional ByRef LanguageID As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The StdPicture to be encoded.
ResourceName
[ByRef] Variant. The identifier for the resource value. This can be a String or Number.
ResourceType
[ByRef] Optional. Variant. Identifies the type of resource this is. If this is not supplied, then the type is derived from the value.
LanguageID
[ByRef] Optional. Variant. The LocaleID the value is associated with.

Return Values

Boolean - Returns True if the encoder was able to encode the value, False otherwise.

Remarks

Any value can be passed in. No exception is thrown. If the value is not a cursor then the function returns False.

The ResourceName can be a String or a Numeric value.

The LanguageID can be a CultureInfo object, a culture name, or an LCID. If the LanguageID is not supplied, then the current culture is used.

See Also

Project CorLib Overview

Class CursorResourceEncoder Overview


CursorResourceEncoder: GetEncodedResource

GetEncodedResource

Retrieves the next encoded resource in the encoder.

 Public Function GetEncodedResource(
      ByRef ReturnKey As ResourceKey,
      ByRef ReturnValue ( ) As Byte ) As Boolean

Parameters

ReturnKey
[ByRef] ResourceKey. This is set to a ResourceKey object that uniquely identify the encoded resource.
ReturnValue
[ByRef] Byte. This will be set to a byte array.

Return Values

Boolean - Returns True if an encoded resource was returned, False otherwise.

Remarks

This function can be called multiple times to retrieve multiple resources. As long as a resource is returned, True will be returned, otherwise False will be returned.

See Also

Project CorLib Overview

Class CursorResourceEncoder Overview


CursorResourceEncoder: IResourceEncoder

IResourceEncoder

 Implements IResourceEncoder

Return Values

IResourceEncoder -

See Also

Project CorLib Overview

Class CursorResourceEncoder Overview


CursorResourceEncoder: Reset

Reset

Releases all currently encoded values.

 Public Sub Reset ( )

See Also

Project CorLib Overview

Class CursorResourceEncoder Overview


CursorResourceGroupDecoder

CursorResourceGroupDecoder

Decodes a CursorGroup resource.

Implements:

IResourceDecoder

Public:

Methods:

Name | Description
Decode | Decodes a byte array into a PictureResourceGroup that represents a cursor group.
GetDecodeType | Returns the type of resource this decoder supports.
GetResource | Returns the next available resource in the decoder.

Remarks

This returns a PictureResourceGroup object when decoded.

See Also

Project CorLib Overview

Class CursorResourceGroupDecoder Overview

ResourceReader

WinResourceReader


CursorResourceGroupDecoder: Decode

Decode

Decodes a byte array into a PictureResourceGroup that represents a cursor group.

 Public Function Decode(
      ByVal Key As ResourceKey,
      ByRef Bytes ( ) As Byte ) As Long

Parameters

Key
[ByVal] ResourceKey. The identifier for the cursor group.
Bytes
[ByRef] Byte. The bytes to be decoded into a cursor group.

Return Values

Long - The number of groups decoded. This will return 0 or 1.

See Also

Project CorLib Overview

Class CursorResourceGroupDecoder Overview


CursorResourceGroupDecoder: GetDecodeType

GetDecodeType

Returns the type of resource this decoder supports.

 Public Function GetDecodeType ( ) As Variant

Return Values

Variant - This decoder returns ResourceTypes.GroupCursor.

See Also

Project CorLib Overview

Class CursorResourceGroupDecoder Overview

ResourceTypes


CursorResourceGroupDecoder: GetResource

GetResource

Returns the next available resource in the decoder.

 Public Function GetResource(
      ByRef ReturnKey As ResourceKey,
      ByRef ReturnValue As Variant ) As Boolean

Parameters

ReturnKey
[ByRef] ResourceKey. This is set to the key that identifies the resource being returned.
ReturnValue
[ByRef] Variant. This is set to the resource value being returned.

Return Values

Boolean - If a resource has been returned, this returns True, otherwise False is returned.

Remarks

Once a resource has been returned, that resource is never returned again.

See Also

Project CorLib Overview

Class CursorResourceGroupDecoder Overview


CursorResourceGroupDecoder: IResourceDecoder

IResourceDecoder

 Implements IResourceDecoder

Return Values

IResourceDecoder -

See Also

Project CorLib Overview

Class CursorResourceGroupDecoder Overview


CursorResourceGroupEncoder

CursorResourceGroupEncoder

Encodes a PictureResourceGroup object to a .RES byte array.

Implements:

IResourceEncoder

Public:

Methods:

Name | Description
Encode | Encodes a PictureResourceGroup object.
GetEncodedResource | Retrieves the next encoded resource in the encoder.
Reset | Releases all currently encoded values.

See Also

Project CorLib Overview

Class CursorResourceGroupEncoder Overview

ResourceWriter


CursorResourceGroupEncoder: Encode

Encode

Encodes a PictureResourceGroup object.

 Public Function Encode(
      ByRef Value As Variant,
      ByRef ResourceName As Variant,
      Optional ByRef ResourceType As Variant,
      Optional ByRef LanguageID As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. A PictureResourceGroup to be encoded.
ResourceName
[ByRef] Variant. The identifier for the resource value. This can be a String or Number.
ResourceType
[ByRef] Optional. Variant. Identifies the type of resource this is. This value is ignored by this encoder.
LanguageID
[ByRef] Optional. Variant. The LocaleID the value is associated with.

Return Values

Boolean - Returns True if the encoder was able to encode the value, False otherwise.

Remarks

Any value can be passed in. No exception is thrown. If the value is not a PictureResourceGroup then the function returns False.

The ResourceName can be a String or a Numeric value.

The LanguageID can be a CultureInfo object, a culture name, or an LCID. If the LanguageID is not supplied, then the current culture is used.

See Also

Project CorLib Overview

Class CursorResourceGroupEncoder Overview


CursorResourceGroupEncoder: GetEncodedResource

GetEncodedResource

Retrieves the next encoded resource in the encoder.

 Public Function GetEncodedResource(
      ByRef ReturnKey As ResourceKey,
      ByRef ReturnValue ( ) As Byte ) As Boolean

Parameters

ReturnKey
[ByRef] ResourceKey. This is set to a ResourceKey object that uniquely identify the encoded resource.
ReturnValue
[ByRef] Byte. This will be set to a byte array.

Return Values

Boolean - Returns True if an encoded resource was returned, False otherwise.

Remarks

This function can be called multiple times to retrieve multiple resources. As long as a resource is returned, True will be returned, otherwise False will be returned.

See Also

Project CorLib Overview

Class CursorResourceGroupEncoder Overview


CursorResourceGroupEncoder: IResourceEncoder

IResourceEncoder

 Implements IResourceEncoder

Return Values

IResourceEncoder -

See Also

Project CorLib Overview

Class CursorResourceGroupEncoder Overview


CursorResourceGroupEncoder: Reset

Reset

Releases all currently encoded values.

 Public Sub Reset ( )

See Also

Project CorLib Overview

Class CursorResourceGroupEncoder Overview


DateTimeFormatInfo

DateTimeFormatInfo

Provides a repository of formatting information to be used in formatting CorDateTime and Date values to match that of a specific locale.

Implements:

ICloneable
IFormatProvider
IObject

Public:

Properties:

Name | Description
AbbreviatedDayNames (get) | Returns an array of abbreviated weekday names.
AbbreviatedDayNames (let) | Sets the weekday names to be used by this FormatProvider.
AbbreviatedMonthNames (get) | Returns an array of names for all the months.
AbbreviatedMonthNames (let) | Sets the abbreviated month names to be used by the formatter.
AMDesignator (get) | Returns the string that is displayed for times from 12:00:00 AM to 11:59:59 AM.
AMDesignator (let) | Sets the string that is display for times from 12:00:00 AM to 11:59:59 AM.
Calendar (get) | Returns the Calendar associated with this DateTimeFormatInfo.
Calendar (set) | Sets the calendar associated with this DateTimeFormatInfo.
CalendarWeekRule (get) | Returns the definition of the first week of the calendar year.
CalendarWeekRule (let) | Sets the definition of the first week for the calendar year.
DateSeparator (get) | Returns the string that is displayed when separating the components of a date, such as year, month, day.
DateSeparator (let) | Sets the string that is display when separating the components of a date, such as year, month, day.
DayNames (get) | Returns the names of the weekdays.
DayNames (let) | Sets the names for the weekdays.
FirstDayOfWeek (get) | Returns the first day of the week.
FirstDayOfWeek (let) | Sets the first day of the week.
FullDateTimePattern (get) | Returns a formatting pattern that represents a full date and time associated with the F' formatting command.
FullDateTimePattern (let) | Sets the formatting pattern used for a full date and time formatting, and is associated with the F' formatting command.
IsReadOnly (get) | Returns if this formatter is ReadOnly.
LongDatePattern (get) | Returns a pattern for formatting just the date portion and is associated with the D' formatting command.
LongDatePattern (let) | Sets a pattern used for formatting just the date portion and is associated with the D' formatting command.
LongTimePattern (get) | Returns a pattern used in formatting the time portion and is associated with the T' formatting command.
LongTimePattern (let) | Sets the pattern used to format the time part when using the T' formatting command.
MonthDayPattern (get) | Returns the month/day pattern associated with either m' or 'M' formatting commands.
MonthDayPattern (let) | Sets the month/day formatting pattern associated with either m' or 'M' formatting commands.
MonthNames (get) | Returns the full names for the months of the year.
MonthNames (let) | Sets the full month names to be used by the formatter.
PMDesignator (get) | Returns the string diplayed for times between 12:00:00 PM and 12:00:00 AM.
PMDesignator (let) | Sets the string display for times between 12:00:00 PM and 12:00:00 AM.
RFC1123Pattern (get) | Returns the pattern as specified by RFC-1123 and associated with the r' or 'R' formatting commands.
ShortDatePattern (get) | Returns the pattern for short date formatting associated with the d' formatting command.
ShortDatePattern (let) | Sets the pattern used in formatting dates with the d' formatting command.
ShortTimePattern (get) | Returns the formatting pattern for a short time using the t' formatting command.
ShortTimePattern (let) | Sets the formatting pattern for a short time using the t' formatting command.
SortableDateTimePattern (get) | Returns a pattern that can be used in string sorting to produce an ascending sort with string based dates and times. This pattern is associated with the s' formatting command.
TimeSeparator (get) | Returns the separator of time components, such as hours, minutes, seconds.
TimeSeparator (let) | Set the separator for time components.
UniversalSortableDateTimePattern (get) | Returns a string sortable pattern that is associated with the u' or 'U' formatting commands.
YearMonthPattern (get) | Returns the pattern representing a YearMonth combination. This is associated with the y' or 'Y' formatting commands.
YearMonthPattern (let) | Sets the pattern that represents a YearMonth combination. This is associated with the y' or 'Y' formatting commands.

Methods:

Name | Description
Clone | Returns a clone of this instance. If this instance is ReadOnly, the clone will also be ReadOnly.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetAbbreviatedDayName | Returns the abbreviated name for the specified day-of-the-week.
GetAbbreviatedEraName | Returns the name of the Era specified.
GetAbbreviatedMonthName | Retrieves the abbreviated name for a given month.
GetAllDateTimePatterns | Returns all of the patterns for a specified formatting command. Or if no command is specified, then all of the patterns are returned.
GetDayName | Returns the full name for the day of the week.
GetEra | Returns the numeric era value based on the name provided.
GetEraName | Returns the full name of the specified.
GetFormat | Returns a format provider for the specified format type.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetMonthName | Returns the full name of the specified month.
ToString | Returns a string representation of this object instance.

Remarks

The following table lists standard formats to be used when formatting dates. The format characters are associated with the DateTimeFormatInfo class in representing date formats. The characters are case-sensitive.

This table is taken from Microsoft .NET 1.1 MSDN.
Format Character | Description and Associated Properties
d | ShortDatePattern
D | LongDatePattern
f | Full Date and Time (Long Date and Short Time)
F | FullDateTimePattern (Long Date and Long Time)
g | General (Short Date and Short Time)
G | General (Short Date and Long Time)
m,M | MonthDayPattern
r,R | RFC1123Pattern
s | SortableDateTimePattern
t | ShortTimePattern
T | LongTimePattern
u | UniversalSortableDateTimePattern
U | Full Date and Time (Long Date, Long Time) using universal time
y,Y | YearMonthPattern
The following table lists custom formatting characters that are used to create custom date formats. Characters and whitespace contained within a pair of single or double quotes will be included in the output. The format characters are case-sensitive, so "MM" is recognized, but "mm" is not.
Format Character | Description and Associated Properties
d | The day of the month. Single-digit days will not have a leading zero.
dd | The day of the month. Single-digit days will have a leading zero.
ddd | The abbreviated name of the day of the week, as defined in AbbreviatedDayNames.
dddd | The full name of the day of the week, as defined in DayNames.
M | The numeric month. Single-digit months will not have a leading zero.
MM | The numeric month. Single-digit months will have a leading zero.
MMM | The abbreviated name of the month, as defined in AbbreviatedMonthNames.
MMMM | The full name of the month, as defined in MonthNames.
y | The year without the century. If the year without the century is less than 10, the year is displayed with no leading zero.
yy | The year without the century. If the year without the century is less than 10, the year is displayed with a leading zero.
yyyy | The year in four digits, including the century.
h | The hour in a 12-hour clock. Single-digit hours will not have a leading zero.
hh | The hour in a 12-hour clock. Single-digit hours will have a leading zero.
H | The hour in a 24-hour clock. Single-digit hours will not have a leading zero.
HH | The hour in a 24-hour clock. Single-digit hours will have a leading zero.
m | The minute. Single-digit minutes will not have a leading zero.
mm | The minute. Single-digit minutes will have a leading zero.
s | The second. Single-digit seconds will not have a leading zero.
ss | The second. Single-digit seconds will have a leading zero.
f | The fraction of a second in single-digit precision. The remaining digits are truncated.
ff | The fraction of a second in double-digit precision. The remaining digits are truncated.
fff | The fraction of a second in three-digit precision. The remaining digits are truncated.
ffff | The fraction of a second in four-digit precision. The remaining digits are truncated.
fffff | The fraction of a second in five-digit precision. The remaining digits are truncated.
ffffff | The fraction of a second in six-digit precision. The remaining digits are truncated.
fffffff | The fraction of a second in seven-digit precision. The remaining digits are truncated.
t | The first character in the AM/PM designator defined in AMDesignator or PMDesignator, if any.
tt | The AM/PM designator defined in AMDesignator or PMDesignator, if any.
z | The time zone offset ("+" or "-" followed by the hour only). Single-digit hours will not have a leading zero. For example, Pacific Standard Time is "-8".
zz | The time zone offset ("+" or "-" followed by the hour only). Single-digit hours will have a leading zero. For example, Pacific Standard Time is "-08".
zzz | The full time zone offset ("+" or "-" followed by the hour and minutes). Single-digit hours and minutes will have leading zeros. For example, Pacific Standard Time is "-08:00".
: | The default time separator defined in TimeSeparator.
/ | The default date separator defined in DateSeparator.
%c | Where c is a format pattern if used alone. The "%" character can be omitted if the format pattern is combined with literal characters or other format patterns.
\c | Where c is any character. Displays the character literally. To display the backslash character, use "\\".

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview

DateTimeFormatInfoStatic

ICloneable

IFormatProvider


DateTimeFormatInfo: AbbreviatedDayNames (get)

AbbreviatedDayNames

Returns an array of abbreviated weekday names.

 Public Property Get AbbreviatedDayNames ( ) As String ( )

Return Values

String() - A string array containing the abbreviated weekday names.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: AbbreviatedDayNames (let)

AbbreviatedDayNames

Sets the weekday names to be used by this FormatProvider.

 Public Property Let AbbreviatedDayNames(
      ByRef Value ( ) As String )

Parameters

Value
[ByRef] String. An array of weekday names to be uses as abbreviated weekday names.

Remarks

The array must contain exactly 7 days. If the DateTimeFormatInfo is ReadOnly then an exception will be thrown.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: AbbreviatedMonthNames (get)

AbbreviatedMonthNames

Returns an array of names for all the months.

 Public Property Get AbbreviatedMonthNames ( ) As String ( )

Return Values

String() - The array of names for all of the months.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: AbbreviatedMonthNames (let)

AbbreviatedMonthNames

Sets the abbreviated month names to be used by the formatter.

 Public Property Let AbbreviatedMonthNames(
      ByRef Value ( ) As String )

Parameters

Value
[ByRef] String. The array of month names to be used.

Remarks

There must be exactly 13 months. Some cultures have 13 months in the year. For those cultures that only have 12, and empty string as the 13 is all that is needed.
If the formatter is ReadOnly, an exception will be thrown.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: AMDesignator (get)

AMDesignator

Returns the string that is displayed for times from 12:00:00 AM to 11:59:59 AM.

 Public Property Get AMDesignator ( ) As String

Return Values

String - The AM designator. Generally AM' is used.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: AMDesignator (let)

AMDesignator

Sets the string that is display for times from 12:00:00 AM to 11:59:59 AM.

 Public Property Let AMDesignator(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new AM designator.

Remarks

If this formatter is ReadOnly, an exception will be thrown.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: Calendar (get)

Calendar

Returns the Calendar associated with this DateTimeFormatInfo.

 Public Property Get Calendar ( ) As Calendar

Return Values

Calendar - A calendar object.

Remarks

If no calendar is associated then a GregorianCalendar is returned.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: Calendar (set)

Calendar

Sets the calendar associated with this DateTimeFormatInfo.

 Public Property Set Calendar(
      ByVal Value As Calendar )

Parameters

Value
[ByVal] Calendar. The calendar to associate with this object.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: CalendarWeekRule (get)

CalendarWeekRule

Returns the definition of the first week of the calendar year.

 Public Property Get CalendarWeekRule ( ) As CalendarWeekRule

Return Values

CalendarWeekRule - A CalendarWeekRule value.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: CalendarWeekRule (let)

CalendarWeekRule

Sets the definition of the first week for the calendar year.

 Public Property Let CalendarWeekRule(
      ByVal Value As CalendarWeekRule )

Parameters

Value
[ByVal] CalendarWeekRule. A CalendarWeekRule value.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: Clone

Clone

Returns a clone of this instance. If this instance is ReadOnly, the clone will also be ReadOnly.

 Public Function Clone ( ) As DateTimeFormatInfo

Return Values

DateTimeFormatInfo -

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: DateSeparator (get)

DateSeparator

Returns the string that is displayed when separating the components of a date, such as year, month, day.

 Public Property Get DateSeparator ( ) As String

Return Values

String - The date separator string. Generally this is /'.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: DateSeparator (let)

DateSeparator

Sets the string that is display when separating the components of a date, such as year, month, day.

 Public Property Let DateSeparator(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new date separator. Generally this is /'.

Remarks

If this formatter is ReadOnly, an exception will be thrown.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: DayNames (get)

DayNames

Returns the names of the weekdays.

 Public Property Get DayNames ( ) As String ( )

Return Values

String() - An array containing the full names of the weekdays.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: DayNames (let)

DayNames

Sets the names for the weekdays.

 Public Property Let DayNames(
      ByRef Value ( ) As String )

Parameters

Value
[ByRef] String. An array containing the weekday names to be used.

Remarks

There must be exactly 7 names. If this formatter is ReadOnly, an exception will be thrown.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: FirstDayOfWeek (get)

FirstDayOfWeek

Returns the first day of the week.

 Public Property Get FirstDayOfWeek ( ) As DayOfWeek

Return Values

DayOfWeek - The enum for the first day of the week.

Remarks

This DayOfWeek is 0 based, unlike VBs vbDayOfWeek which is 1 based.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: FirstDayOfWeek (let)

FirstDayOfWeek

Sets the first day of the week.

 Public Property Let FirstDayOfWeek(
      ByVal Value As DayOfWeek )

Parameters

Value
[ByVal] DayOfWeek. The enum for the first day of the week.

Remarks

If this formatter is ReadOnly, an exception is thrown.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: FullDateTimePattern (get)

FullDateTimePattern

Returns a formatting pattern that represents a full date and time associated with the F' formatting command.

 Public Property Get FullDateTimePattern ( ) As String

Return Values

String - The full date and time pattern.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: FullDateTimePattern (let)

FullDateTimePattern

Sets the formatting pattern used for a full date and time formatting, and is associated with the F' formatting command.

 Public Property Let FullDateTimePattern(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new full date and time formatting pattern.

Read/Write.

Remark

If this formatter is ReadOnly, an exception will be thrown.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: GetAbbreviatedDayName

GetAbbreviatedDayName

Returns the abbreviated name for the specified day-of-the-week.

 Public Function GetAbbreviatedDayName(
      ByVal DayOfWeek As DayOfWeek ) As String

Parameters

DayOfWeek
[ByVal] DayOfWeek. The Day-Of-Week to get the name of.

Return Values

String - The abbreviated version of the name for the day-of-week.

Remarks

DayOfWeek is 0 based. It is not identical to the vbDayOfweek, which is 1 based.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: GetAbbreviatedEraName

GetAbbreviatedEraName

Returns the name of the Era specified.

 Public Function GetAbbreviatedEraName(
      ByVal Era As Long ) As String

Parameters

Era
[ByVal] Long. The era to retrieve the name for.

Return Values

String - The name of the era.

Remarks

Eras are identified by number. The gregorian calendar has two era, BC and AD. Only AD is recognized in this case by a number 1.

This feature is not fully implemented. It will only return AD' regardless of the culture.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: GetAbbreviatedMonthName

GetAbbreviatedMonthName

Retrieves the abbreviated name for a given month.

 Public Function GetAbbreviatedMonthName(
      ByVal Month As Long ) As String

Parameters

Month
[ByVal] Long. The month number in the calendar starting at 1.

Return Values

String - The name of the specified month.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: GetAllDateTimePatterns

GetAllDateTimePatterns

Returns all of the patterns for a specified formatting command. Or if no command is specified, then all of the patterns are returned.

 Public Function GetAllDateTimePatterns(
      Optional ByRef Format As Variant ) As String ( )

Parameters

Format
[ByRef] Optional. Variant. The formatting command to retrieve all the patterns for.

Return Values

String() - An array of all the requested formatting patterns.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: GetDayName

GetDayName

Returns the full name for the day of the week.

 Public Function GetDayName(
      ByVal DayOfWeek As DayOfWeek ) As String

Parameters

DayOfWeek
[ByVal] DayOfWeek. The day of the week to get the name for.

Return Values

String - The name for the day of the week.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: GetEra

GetEra

Returns the numeric era value based on the name provided.

 Public Function GetEra(
      ByRef EraName As String ) As Long

Parameters

EraName
[ByRef] String. The name of the era to retrieve the numeric value for.

Return Values

Long - The numeric value for the era.

Remarks

This method is not fully implemented. It will return 1 for all era names and cultures.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: GetEraName

GetEraName

Returns the full name of the specified.

 Public Function GetEraName(
      ByVal Era As Long ) As String

Parameters

Era
[ByVal] Long. The numerical era in which to retrieve the name for.

Return Values

String - The full era name.

Remarks

This method is not fully implements. It will return A.D.' for all numbers and cultures.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: GetFormat

GetFormat

Returns a format provider for the specified format type.

 Public Function GetFormat(
      ByRef FormatType As String ) As Object

Parameters

FormatType
[ByRef] String. The name of the formatting type requested.

Return Values

Object - The formatting provider, or Nothing is none is available.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: GetMonthName

GetMonthName

Returns the full name of the specified month.

 Public Function GetMonthName(
      ByVal Month As Long ) As String

Parameters

Month
[ByVal] Long. The month to retrieve the name for.

Return Values

String - The full name of the month.

Remarks

The valid range is 1 to 13.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: IFormatProvider

IFormatProvider

 Implements IFormatProvider

Return Values

IFormatProvider -

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: IsReadOnly (get)

IsReadOnly

Returns if this formatter is ReadOnly.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - Indication if is ReadOnly or not.

Read Only.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: LongDatePattern (get)

LongDatePattern

Returns a pattern for formatting just the date portion and is associated with the D' formatting command.

 Public Property Get LongDatePattern ( ) As String

Return Values

String - A date-only formatting.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: LongDatePattern (let)

LongDatePattern

Sets a pattern used for formatting just the date portion and is associated with the D' formatting command.

 Public Property Let LongDatePattern(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The pattern used to format the date.

Remarks

If this formatter is ReadOnly, an exception is thrown.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: LongTimePattern (get)

LongTimePattern

Returns a pattern used in formatting the time portion and is associated with the T' formatting command.

 Public Property Get LongTimePattern ( ) As String

Return Values

String - The time-only formatting pattern.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: LongTimePattern (let)

LongTimePattern

Sets the pattern used to format the time part when using the T' formatting command.

 Public Property Let LongTimePattern(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new formatting pattern.

Remarks

If this formatter is ReadOnly, an exception is thrown.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: MonthDayPattern (get)

MonthDayPattern

Returns the month/day pattern associated with either m' or 'M' formatting commands.

 Public Property Get MonthDayPattern ( ) As String

Return Values

String - The MonthDay formatting pattern.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: MonthDayPattern (let)

MonthDayPattern

Sets the month/day formatting pattern associated with either m' or 'M' formatting commands.

 Public Property Let MonthDayPattern(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new Month/Day pattern

Remarks

If this formatter is ReadOnly, an exception is thrown.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: MonthNames (get)

MonthNames

Returns the full names for the months of the year.

 Public Property Get MonthNames ( ) As String ( )

Return Values

String() - An array containing the full month names.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: MonthNames (let)

MonthNames

Sets the full month names to be used by the formatter.

 Public Property Let MonthNames(
      ByRef Value ( ) As String )

Parameters

Value
[ByRef] String. The array of month names.

Remarks

There must be exactly 13 months. Some cultures have 13 months in a calendar year. If a culture only has 12 months, then 13th month is empty. If this formatter is ReadOnly, an exception is thrown.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: PMDesignator (get)

PMDesignator

Returns the string diplayed for times between 12:00:00 PM and 12:00:00 AM.

 Public Property Get PMDesignator ( ) As String

Return Values

String - The current PM designator. Generally this is PM'.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: PMDesignator (let)

PMDesignator

Sets the string display for times between 12:00:00 PM and 12:00:00 AM.

 Public Property Let PMDesignator(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new PM designator. Generally this is PM'.

Remarks

If this formatter is ReadOnly, an exception is thrown.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: RFC1123Pattern (get)

RFC1123Pattern

Returns the pattern as specified by RFC-1123 and associated with the r' or 'R' formatting commands.

 Public Property Get RFC1123Pattern ( ) As String

Return Values

String - The RFC-1123 pattern .

Read Only.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: ShortDatePattern (get)

ShortDatePattern

Returns the pattern for short date formatting associated with the d' formatting command.

 Public Property Get ShortDatePattern ( ) As String

Return Values

String - The formatting pattern for a short date.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: ShortDatePattern (let)

ShortDatePattern

Sets the pattern used in formatting dates with the d' formatting command.

 Public Property Let ShortDatePattern(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new short date formatting pattern.

Remarks

If this formatter is ReadOnly, an exception is thrown.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: ShortTimePattern (get)

ShortTimePattern

Returns the formatting pattern for a short time using the t' formatting command.

 Public Property Get ShortTimePattern ( ) As String

Return Values

String - The short time formatting pattern.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: ShortTimePattern (let)

ShortTimePattern

Sets the formatting pattern for a short time using the t' formatting command.

 Public Property Let ShortTimePattern(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new short time formatting pattern.

Remarks

If this formatter is ReadOnly, an exception is thrown.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: SortableDateTimePattern (get)

SortableDateTimePattern

Returns a pattern that can be used in string sorting to produce an ascending sort with string based dates and times. This pattern is associated with the s' formatting command.

 Public Property Get SortableDateTimePattern ( ) As String

Return Values

String - The string sortable pattern .

Remarks

This pattern is the same across all cultures.

Read Only.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: TimeSeparator (get)

TimeSeparator

Returns the separator of time components, such as hours, minutes, seconds.

 Public Property Get TimeSeparator ( ) As String

Return Values

String - The time component separator.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: TimeSeparator (let)

TimeSeparator

Set the separator for time components.

 Public Property Let TimeSeparator(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new time component separator.

Remarks

If this formatter is ReadOnly, an exception is thrown.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: UniversalSortableDateTimePattern (get)

UniversalSortableDateTimePattern

Returns a string sortable pattern that is associated with the u' or 'U' formatting commands.

 Public Property Get UniversalSortableDateTimePattern ( ) As String

Return Values

String - The UniversalSortableDateTimePattern .

Remarks

The pattern can be used to sort string representations of a date using the universal time designator "Z". This pattern is the same across all cultures.

Read Only.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: YearMonthPattern (get)

YearMonthPattern

Returns the pattern representing a YearMonth combination. This is associated with the y' or 'Y' formatting commands.

 Public Property Get YearMonthPattern ( ) As String

Return Values

String - The YearMonth formatting pattern.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfo: YearMonthPattern (let)

YearMonthPattern

Sets the pattern that represents a YearMonth combination. This is associated with the y' or 'Y' formatting commands.

 Public Property Let YearMonthPattern(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new YearMonth formatting pattern.

Remarks

If this formatter is ReadOnly, an exception is thrown.

Read/Write.

See Also

Project CorLib Overview

Class DateTimeFormatInfo Overview


DateTimeFormatInfoStatic

DateTimeFormatInfoStatic

Provides static methods to retrieve various DateTimeFormatInfo objects.

Public:

Properties:

Name | Description
CurrentInfo (get) | Returns the DateTimeFormatInfo object associated with the current CultureInfo.
InvariantInfo (get) | Returns the DateTimeFormatInfo object from the Invariant culture type.

Methods:

Name | Description
GetInstance | Returns the DateTimeFormatInfo object associated with the supplied IFormatProvider.
ReadOnly | Returns a ReadOnly version of a DateTimeFormatInfo object.

Remarks

This class cannot be directly instantiated. To access the methods use the variable directly.

 Dim Culture As CultureInfo
 Set Culture = CultureInfo.CurrentInfo

See Also

Project CorLib Overview

Class DateTimeFormatInfoStatic Overview

DateTimeFormatInfo


DateTimeFormatInfoStatic: CurrentInfo (get)

CurrentInfo

Returns the DateTimeFormatInfo object associated with the current CultureInfo.

 Public Property Get CurrentInfo ( ) As DateTimeFormatInfo

Return Values

DateTimeFormatInfo - The DateTimeFormatInfo for the current CultureInfo of this thread.

Read Only.

See Also

Project CorLib Overview

Class DateTimeFormatInfoStatic Overview


DateTimeFormatInfoStatic: GetInstance

GetInstance

Returns the DateTimeFormatInfo object associated with the supplied IFormatProvider.

 Public Function GetInstance(
      ByVal FormatProvider As IFormatProvider ) As DateTimeFormatInfo

Parameters

FormatProvider
[ByVal] IFormatProvider. The provider of the DateTimeFormatInfo object.

Return Values

DateTimeFormatInfo - The DateTimeFormatInfo object from the provider.

Remarks

If the provider does not have a DateTimeFormatInfo object, then Nothing is returned.

See Also

Project CorLib Overview

Class DateTimeFormatInfoStatic Overview


DateTimeFormatInfoStatic: InvariantInfo (get)

InvariantInfo

Returns the DateTimeFormatInfo object from the Invariant culture type.

 Public Property Get InvariantInfo ( ) As DateTimeFormatInfo

Return Values

DateTimeFormatInfo - A DateTimeFormatInfo object that is a general case. This returns the same formatting set of information as using New DateTimeFormatInfo.

Read Only.

See Also

Project CorLib Overview

Class DateTimeFormatInfoStatic Overview


DateTimeFormatInfoStatic: ReadOnly

ReadOnly

Returns a ReadOnly version of a DateTimeFormatInfo object.

 Public Function ReadOnly(
      ByVal Info As DateTimeFormatInfo ) As DateTimeFormatInfo

Parameters

Info
[ByVal] DateTimeFormatInfo. The DateTimeFormatInfo object to create a ReadOnly version of.

Return Values

DateTimeFormatInfo - A ReadOnly version of the supplied DateTimeFormatInfo object.

Remarks

If the supplied DateTimeFormatInfo object is already ReadOnly, then that object is returned.

See Also

Project CorLib Overview

Class DateTimeFormatInfoStatic Overview


DayLightTime

DayLightTime

Represents the start and end times for a daylight saving period, and the difference between daylight saving time and standard time.

Implements:

IObject

Public:

Properties:

Name | Description
Delta (get) | Returns the difference between stadard time and daylight saving.
EndTime (get) | Returns the date for when the daylight saving period ends.
StartTime (get) | Returns the date for when the daylight saving period starts.

Methods:

Name | Description
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
ToString | Returns a string representation of this object instance.

See Also

Project CorLib Overview

Class DayLightTime Overview

Constructors

TimeZone

TimeZoneStatic


DayLightTime: Delta (get)

Delta

Returns the difference between stadard time and daylight saving.

 Public Property Get Delta ( ) As TimeSpan

Return Values

TimeSpan - The difference between stadard time and daylight saving.

Remarks

This is the amount to change the current time when switching between standard and daylight saving time.

Read Only.

See Also

Project CorLib Overview

Class DayLightTime Overview


DayLightTime: EndTime (get)

EndTime

Returns the date for when the daylight saving period ends.

 Public Property Get EndTime ( ) As CorDateTime

Return Values

CorDateTime - The date of the end of daylight saving.

Read Only.

See Also

Project CorLib Overview

Class DayLightTime Overview


DayLightTime: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class DayLightTime Overview


DayLightTime: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class DayLightTime Overview


DayLightTime: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class DayLightTime Overview


DayLightTime: StartTime (get)

StartTime

Returns the date for when the daylight saving period starts.

 Public Property Get StartTime ( ) As CorDateTime

Return Values

CorDateTime - The date of the start of daylight saving.

Read Only.

See Also

Project CorLib Overview

Class DayLightTime Overview


DayLightTime: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class DayLightTime Overview


Decoder

Decoder

Provides an interface to be used in converting blocks of bytes into unicode characters.

Public:

Properties:

Name | Description
Fallback (get) | Returns a DecoderFallback object for the current Decoder object.
Fallback (set) | Sets a DecoderFallback object for the current Decoder object.
FallbackBuffer (get) | Returns a DecoderFallbackBuffer object associated with the current Decoder object.

Methods:

Name | Description
Convert | Converts an array of encoded bytes to UTF-16 encoded characters and stores the result in a character array.
Equals | Returns an indication of equality with the passed in value.
GetCharCount | Returns the number of characters a block of bytes can produce.
GetChars | Returns the decoded unicode characters from a block of bytes.
GetHashCode | Returns a pseudo-unique number that describes this instance.
Reset | Sets Decoder to initial value.
ToString | Returns a string representation of this instance.

Remarks

Using a Decoder is different than using a normal Encoding because a Decoder can maintain state between calls. This allows a Decoder to decode characters that span method calls where as an Encoding method calls have no knowledge of previous data. A Decoder is useful in situation where unknown streams of data may need to be processed in multiple chunks such as over a network.

See Also

Project CorLib Overview

Class Decoder Overview


Decoder: Convert

Convert

Converts an array of encoded bytes to UTF-16 encoded characters and stores the result in a character array.

 Public Sub Convert(
      ByRef Bytes ( ) As Byte,
      ByVal ByteIndex As Long,
      ByVal ByteCount As Long,
      ByRef Chars ( ) As Integer,
      ByVal CharIndex As Long,
      ByVal CharCount As Long,
      ByVal Flush As Boolean,
      ByRef BytesUsed As Long,
      ByRef CharsUsed As Long,
      ByRef Completed As Boolean )

Parameters

Bytes
[ByRef] Byte. The byte array to convert.
ByteIndex
[ByVal] Long. The starting position to convert in Bytes.
ByteCount
[ByVal] Long. The number of bytes to be converted.
Chars
[ByRef] Integer. The char array to receive the converted characters.
CharIndex
[ByVal] Long. The starting position to place converted characters.
CharCount
[ByVal] Long. The maximum number of element of chars to use in the conversion.
Flush
[ByVal] Boolean. True to indicate that no further data is to be converted; otherwise, False.
BytesUsed
[ByRef] Long. When this method returns, contains the number of bytes that were used in the conversion. This parameter is passed uninitialized.
CharsUsed
[ByRef] Long. When this method returns, contains the number of characters from chars that were produced by the conversion. This parameter is passed uninitialized.
Completed
[ByRef] Boolean. When this method returns, contains True if all the characters specified by byteCount were converted; otherwise, False. This parameter is passed uninitialized.

Remarks

The Convert method will attempt to convert up to ByteCount bytes but no more than would generate CharCount characters.

An optimized implementation would attempt to convert as many bytes as are available to create CharCount characters. The default implementation simply tries to find a number of byte that when converted will fit in CharCount characters. If there are too many characters to fit then the number of bytes used to calculate the number of characters is halved. This does not lead to an optimal solution as CharCount will usually not be achieved.

See Also

Project CorLib Overview

Class Decoder Overview


Decoder: Equals

Equals

Returns an indication of equality with the passed in value.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test equality with.

Return Values

Boolean -

See Also

Project CorLib Overview

Class Decoder Overview


Decoder: Fallback (get)

Fallback

Returns a DecoderFallback object for the current Decoder object.

 Public Property Get Fallback ( ) As DecoderFallback

Return Values

DecoderFallback - The current DecoderFallback object.

Read/Write.

See Also

Project CorLib Overview

Class Decoder Overview


Decoder: Fallback (set)

Fallback

Sets a DecoderFallback object for the current Decoder object.

 Public Property Set Fallback(
      ByVal Value As DecoderFallback ) :

Parameters

Value
[ByVal] DecoderFallback. The DecoderFallback object to set.

Read/Write.

See Also

Project CorLib Overview

Class Decoder Overview


Decoder: FallbackBuffer (get)

FallbackBuffer

Returns a DecoderFallbackBuffer object associated with the current Decoder object.

 Public Property Get FallbackBuffer ( ) As DecoderFallbackBuffer

Return Values

DecoderFallbackBuffer - The associated DecoderFallbackBuffer object.

Read Only.

See Also

Project CorLib Overview

Class Decoder Overview


Decoder: GetCharCount

GetCharCount

Returns the number of characters a block of bytes can produce.

 Public Function GetCharCount(
      ByRef Bytes ( ) As Byte,
      ByVal Index As Long,
      ByVal Count As Long,
      Optional ByVal Flush As Boolean ) As Long

Parameters

Bytes
[ByRef] Byte. The bytes to be used in decoding to characters.
Index
[ByVal] Long. The starting index in Bytes to begin decoding from.
Count
[ByVal] Long. The number of bytes to be used in the decoding process.
Flush
[ByVal] Optional. Boolean. Tells the Decoder to clear any state after the call.

Return Values

Long - The number of characters that can be produced from Count number of bytes.

Remarks

GetCharCount itself does not store state between method calls, but it will use any stored state from a previous call to GetChars. Typically you would call this method immediately before calling GetChars.

Call with Flush equals True when then last chunk of data is being processed. This will ensure any characters that would normally have been stored as state for the next call will be processed during this call. No state is ever stored by this method, but any hanging characters need to be processed instead of being ignored.

See Also

Project CorLib Overview

Class Decoder Overview


Decoder: GetChars

GetChars

Returns the decoded unicode characters from a block of bytes.

 Public Function GetChars(
      ByRef Bytes ( ) As Byte,
      ByVal ByteIndex As Long,
      ByVal ByteCount As Long,
      ByRef Chars ( ) As Integer,
      ByVal CharIndex As Long,
      Optional ByVal Flush As Boolean ) As Long

Parameters

Bytes
[ByRef] Byte. The bytes to be used in decoding to characters.
ByteIndex
[ByVal] Long. The starting index to begin decoding bytes into characters.
ByteCount
[ByVal] Long. The number of bytes to be used in the decoding process.
Chars
[ByRef] Integer. The output array for the decoded unicode characters.
CharIndex
[ByVal] Long. The starting index in the array to begin storing characters.
Flush
[ByVal] Optional. Boolean. Tells the Decoder to clear any state after the call.

Return Values

Long - The number of characters actually decoded.

Remarks

GetChars converts an array of bytes into Unicode characters. Since Unicode characters could span a boundry between calls the method will store any state needed to resume converting characters in the next call. This allows for unknown chunks of data to be to converted without needed to enure each chunk contains complete characters. A typical scenario would be streaming data from a network.

Because there is state stored between calls, the caller must inform the method that the last chunk of data is being processed so the method can correctly account for any state that might have persisted. This is achieved by passing True for the Flush parameter.

See Also

Project CorLib Overview

Class Decoder Overview


Decoder: GetHashCode

GetHashCode

Returns a pseudo-unique number that describes this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A pseudo-unique number that describes this instance.

See Also

Project CorLib Overview

Class Decoder Overview


Decoder: Reset

Reset

Sets Decoder to initial value.

 Public Sub Reset ( )

Remarks

This methods clears any internal state of the Decoder object. The method clears any state information preserved from a previous call to GetChars or Convert, including trailing bytes at the end of the previous data block.

See Also

Project CorLib Overview

Class Decoder Overview


Decoder: ToString

ToString

Returns a string representation of this instance.

 Public Function ToString ( ) As String

Return Values

String - A string that describes this instance.

See Also

Project CorLib Overview

Class Decoder Overview


DecoderExceptionFallback

DecoderExceptionFallback

Provides a failure-handling mechanism, called a fallback, for an encoded input byte sequence that cannot be converted to an input character. The fallback throws an exception instead of decoding the input byte sequence.

Implements:

DecoderFallback
IObject

Public:

Properties:

Name | Description
MaxCharCount (get) | Return the maximum number of characters the current DecoderFallback object can return.

Methods:

Name | Description
CreateFallbackBuffer | Initializes a new instance of the DecoderExceptionFallbackBuffer class.
Equals | Determines equality with another value.
GetHashCode | Gets a partially unique value that identifies this object.
ToString | Gets a string representation of this object instance.

See Also

Project CorLib Overview

Class DecoderExceptionFallback Overview


DecoderExceptionFallback: CreateFallbackBuffer

CreateFallbackBuffer

Initializes a new instance of the DecoderExceptionFallbackBuffer class.

 Public Function CreateFallbackBuffer ( ) As DecoderFallbackBuffer

Return Values

DecoderFallbackBuffer -

See Also

Project CorLib Overview

Class DecoderExceptionFallback Overview


DecoderExceptionFallback: DecoderFallback

DecoderFallback

 Implements DecoderFallback

Return Values

DecoderFallback -

See Also

Project CorLib Overview

Class DecoderExceptionFallback Overview


DecoderExceptionFallback: Equals

Equals

Determines equality with another value.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The other value to check equality against.

Return Values

Boolean - True if both values are considered equal; otherwise False.

Remarks

A DecoderExceptionFallback is considered equal to another object if it is also a DecoderExceptionFallback object.

See Also

Project CorLib Overview

Class DecoderExceptionFallback Overview


DecoderExceptionFallback: GetHashCode

GetHashCode

Gets a partially unique value that identifies this object.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A number that is generally unique to this object.

Remarks

The DecoderExceptionFallback does not have any internal state that would normally be used to identify this instance. So, every instance of the DecoderExceptionFallback class will return the same hash code.

See Also

Project CorLib Overview

Class DecoderExceptionFallback Overview


DecoderExceptionFallback: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class DecoderExceptionFallback Overview


DecoderExceptionFallback: MaxCharCount (get)

MaxCharCount

Return the maximum number of characters the current DecoderFallback object can return.

 Public Property Get MaxCharCount ( ) As Long

Return Values

Long - The maximum number of characters the current DecoderFallback object can return.

Remarks

For this DecoderFallback this property will aways return zero.

Read Only.

See Also

Project CorLib Overview

Class DecoderExceptionFallback Overview


DecoderExceptionFallback: ToString

ToString

Gets a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - A string describing this object instance.

See Also

Project CorLib Overview

Class DecoderExceptionFallback Overview


DecoderExceptionFallbackBuffer

DecoderExceptionFallbackBuffer

Throws DecoderFallbackException when an encoded input byte sequence cannot be converted to a decoded output character.

Implements:

DecoderFallbackBuffer
IObject

Public:

Properties:

Name | Description
Remaining (get) | Gets the number of characters in the current DecoderExceptionFallbackBuffer object that remain to be processed.

Methods:

Name | Description
Equals | Determines whether the specified object is equal to the current object.
Fallback | Throws DecoderFallbackException when the input byte sequence cannot be decoded. The nominal return value is not used.
GetHashCode | Serves as the default hash function.
GetNextChar | Retrieves the next character in the exception data buffer.
MovePrevious | Causes the next call to GetNextChar to access the exception data buffer character position that is prior to the current position.
ToString | Returns a string that represents the current object.

See Also

Project CorLib Overview

Class DecoderExceptionFallbackBuffer Overview


DecoderExceptionFallbackBuffer: DecoderFallbackBuffer

DecoderFallbackBuffer

 Implements DecoderFallbackBuffer

Return Values

DecoderFallbackBuffer -

See Also

Project CorLib Overview

Class DecoderExceptionFallbackBuffer Overview


DecoderExceptionFallbackBuffer: Equals

Equals

Determines whether the specified object is equal to the current object.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare with the current object.

Return Values

Boolean - True if the specified value is equal to the current object; otherwise, False.

See Also

Project CorLib Overview

Class DecoderExceptionFallbackBuffer Overview


DecoderExceptionFallbackBuffer: Fallback

Fallback

Throws DecoderFallbackException when the input byte sequence cannot be decoded. The nominal return value is not used.

 Public Function Fallback(
      ByRef BytesUnknown ( ) As Byte,
      ByVal Index As Long ) As Boolean

Parameters

BytesUnknown
[ByRef] Byte. An input array of bytes.
Index
[ByVal] Long. The index position of a byte in the input.

Return Values

Boolean - None. No value is returned because the Fallback method always throws an exception.

Exceptions

Exception | Condition
DecoderFallbackException | This method always throws an exception that reports the value and index position of the input byte that cannot be decoded.

Remarks

The GetBytes and Convert methods call Fallback if they encounter an unknown byte in their input. In response, the Fallback method always throws DecoderFallbackException and displays the input data. The Fallback method nominally indicates whether an exception is thrown if an input byte sequence cannot be decoded.

See Also

Project CorLib Overview

Class DecoderExceptionFallbackBuffer Overview


DecoderExceptionFallbackBuffer: GetHashCode

GetHashCode

Serves as the default hash function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A hash code for the current object.

See Also

Project CorLib Overview

Class DecoderExceptionFallbackBuffer Overview


DecoderExceptionFallbackBuffer: GetNextChar

GetNextChar

Retrieves the next character in the exception data buffer.

 Public Function GetNextChar ( ) As Integer

Return Values

Integer - The return value is always the Unicode character NULL (U+0000).

See Also

Project CorLib Overview

Class DecoderExceptionFallbackBuffer Overview


DecoderExceptionFallbackBuffer: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class DecoderExceptionFallbackBuffer Overview


DecoderExceptionFallbackBuffer: MovePrevious

MovePrevious

Causes the next call to GetNextChar to access the exception data buffer character position that is prior to the current position.

 Public Function MovePrevious ( ) As Boolean

Return Values

Boolean - The return value is always False.

See Also

Project CorLib Overview

Class DecoderExceptionFallbackBuffer Overview


DecoderExceptionFallbackBuffer: Remaining (get)

Remaining

Gets the number of characters in the current DecoderExceptionFallbackBuffer object that remain to be processed.

 Public Property Get Remaining ( ) As Long

Return Values

Long - The return value is always zero.

Read Only.

See Also

Project CorLib Overview

Class DecoderExceptionFallbackBuffer Overview


DecoderExceptionFallbackBuffer: ToString

ToString

Returns a string that represents the current object.

 Public Function ToString ( ) As String

Return Values

String - A string that represents the current object.

See Also

Project CorLib Overview

Class DecoderExceptionFallbackBuffer Overview


DecoderFallback

DecoderFallback

Provides a failure-handling mechanism, called a fallback, for an encoded input byte sequence that cannot be converted to an output character.

Public:

Properties:

Name | Description
MaxCharCount (get) | When implemented in a derived class, gets the maximum number of characters the current DecoderFallback object can return.

Methods:

Name | Description
CreateFallbackBuffer | When implemented in a derived class, initializes a new instance of the DecoderFallbackBuffer class.
Equals | Determines whether the specified value passed in is equal to the current object.
GetHashCode | Serves as the default hash function.
ToString | Returns a string that represents the current object.

See Also

Project CorLib Overview

Class DecoderFallback Overview

DecoderFallbackStatic

DecoderExceptionFallback

DecoderReplacementFallback


DecoderFallback: CreateFallbackBuffer

CreateFallbackBuffer

When implemented in a derived class, initializes a new instance of the DecoderFallbackBuffer class.

 Public Function CreateFallbackBuffer ( ) As DecoderFallbackBuffer

Return Values

DecoderFallbackBuffer - An object that provides a fallback buffer for a decoder.

See Also

Project CorLib Overview

Class DecoderFallback Overview


DecoderFallback: Equals

Equals

Determines whether the specified value passed in is equal to the current object.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare to the current object.

Return Values

Boolean - True if the specified value is equal to the current object; otherwise, False.

See Also

Project CorLib Overview

Class DecoderFallback Overview

IObject


DecoderFallback: GetHashCode

GetHashCode

Serves as the default hash function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A hash code for the current object.

See Also

Project CorLib Overview

Class DecoderFallback Overview

IObject


DecoderFallback: MaxCharCount (get)

MaxCharCount

When implemented in a derived class, gets the maximum number of characters the current DecoderFallback object can return.

 Public Property Get MaxCharCount ( ) As Long

Return Values

Long - The maximum number of characters the current DecoderFallback object can return.

Remarks

For an exception fallback handler, this property should return zero.

Read Only.

See Also

Project CorLib Overview

Class DecoderFallback Overview


DecoderFallback: ToString

ToString

Returns a string that represents the current object.

 Public Function ToString ( ) As String

Return Values

String - A string the represents the current object.

See Also

Project CorLib Overview

Class DecoderFallback Overview

IObject


DecoderFallbackBuffer

DecoderFallbackBuffer

Provides a buffer that allows a fallback handler to return an alternate string to a decoder when it cannot decode an input byte sequence.

Public:

Properties:

Name | Description
Remaining (get) | When implemented by a class, gets the number of characters in the current DecoderFallbackBuffer object that remain to be processed.

Methods:

Name | Description
Equals | Determines whether the specified value passed in is equal to the current object.
Fallback | When implemented by a class, prepares the fallback buffer to handle the specified input byte sequence.
GetHashCode | Serves as the default hash function.
GetNextChar | When implemented by a class, retrieves the next character in the fallback buffer.
MovePrevious | When implemented by a class, causes the next call to the GetNextChar method to access the data buffer character position that is prior to the current character position.
Reset | Initializes all data and state information pertaining to this fallback buffer.
ToString | Returns a string that represents the current object.

Remarks

An encoding defines a mapping between a Unicode character and an encoded sequence of bytes. A decoding operation, which converts an input byte sequence to an output character, fails if no mapping is defined for a particular byte sequence.

VBCorLib provides a failure handling mechanism, called a fallback, if a conversion cannot be performed. All decoder fallback handlers must implement the following:

  • A decoder fallback, which is represented by a class that implements the DecoderFallback interface.
  • A decoder fallback buffer, which is represented by a type that implements the DecoderFallbackBuffer interface that can return a string to the conversion operation.

See Also

Project CorLib Overview

Class DecoderFallbackBuffer Overview


DecoderFallbackBuffer: Equals

Equals

Determines whether the specified value passed in is equal to the current object.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare to the current object.

Return Values

Boolean - True if the specified value is equal to the current object; otherwise, False.

See Also

Project CorLib Overview

Class DecoderFallbackBuffer Overview

IObject


DecoderFallbackBuffer: Fallback

Fallback

When implemented by a class, prepares the fallback buffer to handle the specified input byte sequence.

 Public Function Fallback(
      ByRef BytesUnknown ( ) As Byte,
      ByVal Index As Long ) As Boolean

Parameters

BytesUnknown
[ByRef] Byte. An input array of bytes.
Index
[ByVal] Long. The index position of a byte in BytesUnknown.

Return Values

Boolean - True if the fallback buffer can process BytesUnknown; False if the fallback buffer ignores BytesUnknown.

See Also

Project CorLib Overview

Class DecoderFallbackBuffer Overview


DecoderFallbackBuffer: GetHashCode

GetHashCode

Serves as the default hash function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A hash code for the current object.

See Also

Project CorLib Overview

Class DecoderFallbackBuffer Overview

IObject


DecoderFallbackBuffer: GetNextChar

GetNextChar

When implemented by a class, retrieves the next character in the fallback buffer.

 Public Function GetNextChar ( ) As Integer

Return Values

Integer - The next character in the fallback buffer.

See Also

Project CorLib Overview

Class DecoderFallbackBuffer Overview


DecoderFallbackBuffer: MovePrevious

MovePrevious

When implemented by a class, causes the next call to the GetNextChar method to access the data buffer character position that is prior to the current character position.

 Public Function MovePrevious ( ) As Boolean

Return Values

Boolean - True if the MovePrevious operation was successful; otherwise, False.

See Also

Project CorLib Overview

Class DecoderFallbackBuffer Overview


DecoderFallbackBuffer: Remaining (get)

Remaining

When implemented by a class, gets the number of characters in the current DecoderFallbackBuffer object that remain to be processed.

 Public Property Get Remaining ( ) As Long

Return Values

Long - The number of characters in the current fallback buffer that have not yet been processed.

Read Only.

See Also

Project CorLib Overview

Class DecoderFallbackBuffer Overview


DecoderFallbackBuffer: Reset

Reset

Initializes all data and state information pertaining to this fallback buffer.

 Public Sub Reset ( )

Remarks

Notes to Implementers

After calling the Reset method, the Remaining property should return 0, the GetNextChar method should return U+0000, and the MovePrevious method should return False.

See Also

Project CorLib Overview

Class DecoderFallbackBuffer Overview


DecoderFallbackBuffer: ToString

ToString

Returns a string that represents the current object.

 Public Function ToString ( ) As String

Return Values

String - A string the represents the current object.

See Also

Project CorLib Overview

Class DecoderFallbackBuffer Overview

IObject


DecoderFallbackException

DecoderFallbackException

The exception that is thrown when a decoder fallback operation fails.

Implements:

ArgumentException
Exception
IObject
SystemException

Public:

Properties:

Name | Description
BytesUnknown (get) | Gets the input byte sequence that caused the exception.
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
Index (get) | Gets the index position in the input byte sequence of the byte that caused the exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
ParamName (get) | Returns the parameter name that caused the exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackException: ArgumentException

ArgumentException

 Implements ArgumentException

Return Values

ArgumentException -

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackException: BytesUnknown (get)

BytesUnknown

Gets the input byte sequence that caused the exception.

 Public Property Get BytesUnknown ( ) As Byte ( )

Return Values

Byte() - The input byte array that cannot be decoded.

Remarks

The application uses the Index property to get the position in the input byte array of the byte that cannot be decoded.

Read Only.

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Read Only.

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class DecoderFallbackException Overview

Exception


DecoderFallbackException: Index (get)

Index

Gets the index position in the input byte sequence of the byte that caused the exception.

 Public Property Get Index ( ) As Long

Return Values

Long - The index position in the input byte array of the byte that cannot be decoded. The index position is zero-based.

Remarks

The application uses the BytesUnknown property to retrieve the input byte array that contains the byte that cannot be decoded.

Read Only.

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewArgumentException.

Read Only.

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackException: ParamName (get)

ParamName

Returns the parameter name that caused the exception.

 Public Property Get ParamName ( ) As String

Return Values

String - The name of the parameter that caused the exception.

Remarks

Every ArgumentException should contain the name of the parameter that caused the exception.

Read Only.

See Also

Project CorLib Overview

Class DecoderFallbackException Overview

Exception


DecoderFallbackException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class DecoderFallbackException Overview


DecoderFallbackStatic

DecoderFallbackStatic

Gets an object that outputs a substitute string in place of an input byte sequence that cannot be decoded.

Public:

Properties:

Name | Description
ExceptionFallback (get) | Gets an object that throws an exception when an input byte sequence cannot be decoded.
ReplacementFallback (get) |

Remarks

The default value is a DecoderReplacementFallback object that emits the QUESTION MARK character ("?", U+003F) in place of unknown byte sequences.

See Also

Project CorLib Overview

Class DecoderFallbackStatic Overview

DecoderReplacementFallback

DecoderReplacementFallbackBuffer


DecoderFallbackStatic: ExceptionFallback (get)

ExceptionFallback

Gets an object that throws an exception when an input byte sequence cannot be decoded.

 Public Property Get ExceptionFallback ( ) As DecoderFallback

Return Values

DecoderFallback - A type derived from the DecoderFallback class.

Remarks

The default value is a DecoderExceptionFallback object.

Read Only.

See Also

Project CorLib Overview

Class DecoderFallbackStatic Overview

DecoderExceptionFallback

DecoderExceptionFallbackBuffer


DecoderReplacementFallback

DecoderReplacementFallback

Provides a failure-handling mechanism, called a fallback, for an encoded input byte sequence that cannot be converted to an output character. The fallback emits a user-specified replacement string instead of a decoded input byte sequence.

Implements:

DecoderFallback
IObject

Public:

Properties:

Name | Description
DefaultString (get) | Gets the replacement string that is the value of the DecoderReplacementFallback object.
MaxCharCount (get) | Gets the number of characters in the replacement string for the DecoderReplacementFallback object.

Methods:

Name | Description
CreateFallbackBuffer | Creates a DecoderFallbackBuffer object that is initialized with the replacement string of this DecoderReplacementFallback object.
Equals | Indicates whether the value of a specified object is equal to the DecoderReplacementFallback object.
GetHashCode | Retrieves the hash code for the value of the DecoderReplacementFallback object.
ToString | Returns a string that represents the current object.

See Also

Project CorLib Overview

Class DecoderReplacementFallback Overview


DecoderReplacementFallback: CreateFallbackBuffer

CreateFallbackBuffer

Creates a DecoderFallbackBuffer object that is initialized with the replacement string of this DecoderReplacementFallback object.

 Public Function CreateFallbackBuffer ( ) As DecoderFallbackBuffer

Return Values

DecoderFallbackBuffer - A DecoderFallbackBuffer object that specifies a string to use instead of the original decoding operation input.

See Also

Project CorLib Overview

Class DecoderReplacementFallback Overview


DecoderReplacementFallback: DecoderFallback

DecoderFallback

 Implements DecoderFallback

Return Values

DecoderFallback -

See Also

Project CorLib Overview

Class DecoderReplacementFallback Overview


DecoderReplacementFallback: DefaultString (get)

DefaultString

Gets the replacement string that is the value of the DecoderReplacementFallback object.

 Public Property Get DefaultString ( ) As String

Return Values

String - A substitute string that is emitted in place of an input byte sequence that cannot be decoded.

Read Only.

See Also

Project CorLib Overview

Class DecoderReplacementFallback Overview


DecoderReplacementFallback: Equals

Equals

Indicates whether the value of a specified object is equal to the DecoderReplacementFallback object.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. A DecoderReplacementFallback object.

Return Values

Boolean - True if value is a DecoderReplacementFallback object having a DefaultString property that is equal to the DefaultString property of the current DecoderReplacementFallback object; otherwise, False.

See Also

Project CorLib Overview

Class DecoderReplacementFallback Overview


DecoderReplacementFallback: GetHashCode

GetHashCode

Retrieves the hash code for the value of the DecoderReplacementFallback object.

 Public Function GetHashCode ( ) As Long

Return Values

Long - The hash code of the value of the object.

Remarks

The value of a DecoderReplacementFallback object is the value of its DefaultString property.

See Also

Project CorLib Overview

Class DecoderReplacementFallback Overview


DecoderReplacementFallback: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class DecoderReplacementFallback Overview


DecoderReplacementFallback: MaxCharCount (get)

MaxCharCount

Gets the number of characters in the replacement string for the DecoderReplacementFallback object.

 Public Property Get MaxCharCount ( ) As Long

Return Values

Long - The number of characters in the string that is emitted in place of a byte sequence that cannot be decoded, that is, the length of the string returned by the DefaultString property.

Read Only.

See Also

Project CorLib Overview

Class DecoderReplacementFallback Overview


DecoderReplacementFallback: ToString

ToString

Returns a string that represents the current object.

 Public Function ToString ( ) As String

Return Values

String - A string that represents the current object.

See Also

Project CorLib Overview

Class DecoderReplacementFallback Overview


DecoderReplacementFallbackBuffer

DecoderReplacementFallbackBuffer

Represents a substitute output string that is emitted when the original input byte sequence cannot be decoded. This class cannot be inherited.

Implements:

DecoderFallbackBuffer
IObject

Public:

Properties:

Name | Description
Remaining (get) | Gets the number of characters in the replacement fallback buffer that remain to be processed.

Methods:

Name | Description
Equals | Determines whether the specified object is equal to the current object.
Fallback | Prepares the replacement fallback buffer to use the current replacement string.
GetHashCode | Serves as the default hash function.
GetNextChar | Retrieves the next character in the replacement fallback buffer.
MovePrevious | Causes the next call to GetNextChar to access the character position in the replacement fallback buffer prior to the current character position.
Reset | Initializes all internal state information and data in the DecoderReplacementFallbackBuffer object.
ToString | Returns a string that represents the current object.

See Also

Project CorLib Overview

Class DecoderReplacementFallbackBuffer Overview


DecoderReplacementFallbackBuffer: DecoderFallbackBuffer

DecoderFallbackBuffer

 Implements DecoderFallbackBuffer

Return Values

DecoderFallbackBuffer -

See Also

Project CorLib Overview

Class DecoderReplacementFallbackBuffer Overview


DecoderReplacementFallbackBuffer: Equals

Equals

Determines whether the specified object is equal to the current object.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The object to compare with the current object.

Return Values

Boolean - True if the specified object is equal to the current object; otherwise, False.

See Also

Project CorLib Overview

Class DecoderReplacementFallbackBuffer Overview


DecoderReplacementFallbackBuffer: Fallback

Fallback

Prepares the replacement fallback buffer to use the current replacement string.

 Public Function Fallback(
      ByRef BytesUnknown ( ) As Byte,
      ByVal Index As Long ) As Boolean

Parameters

BytesUnknown
[ByRef] Byte. An input byte sequence. This parameter is ignored unless an exception is thrown.
Index
[ByVal] Long. The index position of the byte in BytesUnknown. This parameter is ignored in this operation.

Return Values

Boolean - True if the replacement string is not empty; False if the replacement string is empty.

Remarks

The GetBytes and Convert methods call Fallback if they encounter an unknown input byte sequence that cannot be decoded. If the return value of Fallback is True, the calling method can invoke the GetNextChar method to obtain each character of the fallback buffer.

Exceptions

Exception | Condition
ArgumentException | This method is called again before the GetNextChar method has read all the characters in the replacement fallback buffer.

See Also

Project CorLib Overview

Class DecoderReplacementFallbackBuffer Overview


DecoderReplacementFallbackBuffer: GetHashCode

GetHashCode

Serves as the default hash function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A hash code for the current object.

See Also

Project CorLib Overview

Class DecoderReplacementFallbackBuffer Overview


DecoderReplacementFallbackBuffer: GetNextChar

GetNextChar

Retrieves the next character in the replacement fallback buffer.

 Public Function GetNextChar ( ) As Integer

Return Values

Integer - The next character in the replacement fallback buffer.

Remarks

The Encoding.GetBytes and Decoder.Convert methods call Fallback if they encounter an unknown surrogate pair or character in their input. If the return value of Fallback is True, the calling method can invoke GetNextChar to obtain each character of the replacement fallback buffer.

See Also

Project CorLib Overview

Class DecoderReplacementFallbackBuffer Overview


DecoderReplacementFallbackBuffer: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class DecoderReplacementFallbackBuffer Overview


DecoderReplacementFallbackBuffer: MovePrevious

MovePrevious

Causes the next call to GetNextChar to access the character position in the replacement fallback buffer prior to the current character position.

 Public Function MovePrevious ( ) As Boolean

Return Values

Boolean - True if the MovePrevious operation was successful; otherwise, False.

See Also

Project CorLib Overview

Class DecoderReplacementFallbackBuffer Overview


DecoderReplacementFallbackBuffer: Remaining (get)

Remaining

Gets the number of characters in the replacement fallback buffer that remain to be processed.

 Public Property Get Remaining ( ) As Long

Return Values

Long - The number of characters in the replacement fallback buffer that have not yet been processed.

Read Only.

See Also

Project CorLib Overview

Class DecoderReplacementFallbackBuffer Overview


DecoderReplacementFallbackBuffer: Reset

Reset

Initializes all internal state information and data in the DecoderReplacementFallbackBuffer object.

 Public Sub Reset ( )

Remarks

The Reset method discards any persisted state information and data that govern the emitting of a replacement string. Unpredictable results occur if the decoding operation continues after the Reset method is invoked.

See Also

Project CorLib Overview

Class DecoderReplacementFallbackBuffer Overview


DecoderReplacementFallbackBuffer: ToString

ToString

Returns a string that represents the current object.

 Public Function ToString ( ) As String

Return Values

String - A string that represents the current object.

See Also

Project CorLib Overview

Class DecoderReplacementFallbackBuffer Overview


DES

DES

Represents a base interface that all DES algorithms should implement.

Public:

Properties:

Name | Description
BlockSize (get) | Returns the block size in bits.
BlockSize (let) | Sets the block size in bits.
FeedbackSize (get) | Returns the feedback size in bits.
FeedbackSize (let) | Sets the feedback size in bits.
IV (get) | Returns the Initialization Vector (IV).
IV (let) | Sets the Initialization Vectory (IV).
Key (get) | Returns the secret key used by the cryptographic operation.
Key (let) | Sets the secret key to be used by the cryptographic operation.
KeySize (get) | Returns the size of the key, in bits, used by the cryptographic operation.
KeySize (let) | Sets the size of the key, in bits.
LegalBlockSizes (get) | Returns a list of legal block sizes.
LegalKeySizes (get) | Returns a list of legal key sizes.
Mode (get) | Returns the mode the current algoritm is set to.
Mode (let) | Sets the mode the current algorithm is set to.
Padding (get) | Returns the padding to be used by the algorithm.
Padding (let) | Sets the padding to be used by the algorithm.

Methods:

Name | Description
Clear | Releases all resources.
CreateDecryptor | Creates a new decryptor using the Data Encryption Standard algorithm.
CreateEncryptor | Creates a new encryptor using the Data Ecryption Standard algorithm.
Equals | Returns if this instance and the value are equal.
GenerateIV | Generates a new Initialization Vector array.
GenerateKey | Generates a new Key based on the key size.
GetHashCode | Returns a semi-unique value that represents this instance.
ToString | Returns a string representation of this instance.
ValidKeySize | Checks if the specific number of bits is a valid key size.

Remarks

Data Encryption Standard (DES) is a block cipher that uses a 56-bit key encryption mechanism.

See Also

Project CorLib Overview

Class DES Overview

DESCryptoServiceProvider

SymmetricAlgorithm


DES: BlockSize (get)

BlockSize

Returns the block size in bits.

 Public Property Get BlockSize ( ) As Long

Return Values

Long - The block size in bits.

Remarks

This always returns 64.

The block size is the amount of data that is processed as a single unit by the cipher. It will always require a block of 64 bits (8 bytes) to operate, therefore if a the last block to be operated on is not 64 bits in length it must be padded to meet the block size requirement. The padding is automatically performed by the routine

Read/Write.

See Also

Project CorLib Overview

Class DES Overview


DES: BlockSize (let)

BlockSize

Sets the block size in bits.

 Public Property Let BlockSize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The size of the block in bits.

Remarks

This always returns 64.

The block size is the amount of data that is processed as a single unit by the cipher. It will always require a block of 64 bits (8 bytes) to operate, therefore if a the last block to be operated on is not 64 bits in length it must be padded to meet the block size requirement. The padding is automatically performed by the routine

Read/Write.

See Also

Project CorLib Overview

Class DES Overview


DES: Clear

Clear

Releases all resources.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class DES Overview


DES: CreateDecryptor

CreateDecryptor

Creates a new decryptor using the Data Encryption Standard algorithm.

 Public Function CreateDecryptor(
      Optional ByRef RgbKey As Variant,
      Optional ByRef RgbIV As Variant ) As ICryptoTransform

Parameters

RgbKey
[ByRef] Optional. Variant. The secret key to be used to decrypt the ciphered text back into plain text.
RgbIV
[ByRef] Optional. Variant. The Initialization Vector to begin the feedback with.

Return Values

ICryptoTransform - A new ICryptoTransform used to decrypt ciphered text.

Remarks

Though both parameters are optional, if only one parameter is supplied, an exception will be thrown.

See Also

Project CorLib Overview

Class DES Overview


DES: CreateEncryptor

CreateEncryptor

Creates a new encryptor using the Data Ecryption Standard algorithm.

 Public Function CreateEncryptor(
      Optional ByRef RgbKey As Variant,
      Optional ByRef RgbIV As Variant ) As ICryptoTransform

Parameters

RgbKey
[ByRef] Optional. Variant. The secret key to be used to encrypt the plain text into ciphered text.
RgbIV
[ByRef] Optional. Variant. The Initialization Vector to begin the feedback with.

Return Values

ICryptoTransform - A new ICryptoTransform used to encrypt plain text.

Remarks

Though both parameters are optional, if only one parameter is supplied, an exception will be thrown.

See Also

Project CorLib Overview

Class DES Overview


DES: Equals

Equals

Returns if this instance and the value are equal.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare for equality.

Return Values

Boolean - Returns if the value and this instance are equal.

See Also

Project CorLib Overview

Class DES Overview


DES: FeedbackSize (get)

FeedbackSize

Returns the feedback size in bits.

 Public Property Get FeedbackSize ( ) As Long

Return Values

Long - The feedback size in bits.

Remarks

The always returns 64 bits.

The feedback size determines how much of the previous data processed is to be used on the next block of data. This is to prevent identical blocks of data to appear the same when encrypted.

Read/Write.

See Also

Project CorLib Overview

Class DES Overview


DES: FeedbackSize (let)

FeedbackSize

Sets the feedback size in bits.

 Public Property Let FeedbackSize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The size of feedback in bits.

Remarks

DES only supports 64 bits.

The feedback size determines how much of the previous data processed is to be used on the next block of data. This is to prevent identical blocks of data to appear the same when encrypted.

Not all modes of DES support feedback.

Read/Write.

See Also

Project CorLib Overview

Class DES Overview


DES: GenerateIV

GenerateIV

Generates a new Initialization Vector array.

 Public Sub GenerateIV ( )

See Also

Project CorLib Overview

Class DES Overview


DES: GenerateKey

GenerateKey

Generates a new Key based on the key size.

 Public Sub GenerateKey ( )

See Also

Project CorLib Overview

Class DES Overview


DES: GetHashCode

GetHashCode

Returns a semi-unique value that represents this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns the semi-unique value.

See Also

Project CorLib Overview

Class DES Overview


DES: IV (get)

IV

Returns the Initialization Vector (IV).

 Public Property Get IV ( ) As Byte ( ) :

Return Values

Byte() - An array representing the IV.

Remarks

Only an 8-byte array is supported.

When the very first block of data is process there is no previous data to pull feedback data from, so the Initialization Vector is used as a dummy set of data for feedback.

Read/Write.

See Also

Project CorLib Overview

Class DES Overview


DES: IV (let)

IV

Sets the Initialization Vectory (IV).

 Public Property Let IV(
      ByRef Value ( ) As Byte ) :

Parameters

Value
[ByRef] Byte. A set of bytes representing the IV.

Remarks

Only an 8-byte array is supported.

When the very first block of data is process there is no previous data to pull feedback data from, so the Initialization Vector is used as a dummy set of data for feedback.

Read/Write.

See Also

Project CorLib Overview

Class DES Overview


DES: Key (get)

Key

Returns the secret key used by the cryptographic operation.

 Public Property Get Key ( ) As Byte ( ) :

Return Values

Byte() - Returns the secret key.

Remarks

Valid key sizes are determined by the individual algorithms. A list of valid sizes can be obtained through the LegalKeySizes property.

Read/Write.

See Also

Project CorLib Overview

Class DES Overview


DES: Key (let)

Key

Sets the secret key to be used by the cryptographic operation.

 Public Property Let Key(
      ByRef Value ( ) As Byte ) :

Parameters

Value
[ByRef] Byte. The new secret key to be used.

Remarks

Valid key sizes are determined by the individual algorithms. A list of valid sizes can be obtained through the LegalKeySizes property.

Read/Write.

See Also

Project CorLib Overview

Class DES Overview


DES: KeySize (get)

KeySize

Returns the size of the key, in bits, used by the cryptographic operation.

 Public Property Get KeySize ( ) As Long

Return Values

Long - The size of the key in bits.

Remarks

This will aways return 64.

Read/Write.

See Also

Project CorLib Overview

Class DES Overview


DES: KeySize (let)

KeySize

Sets the size of the key, in bits.

 Public Property Let KeySize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The size of the key in bits.

Remarks

This will cause the Key property to reset and regenerate when needed.

Read/Write.

See Also

Project CorLib Overview

Class DES Overview


DES: LegalBlockSizes (get)

LegalBlockSizes

Returns a list of legal block sizes.

 Public Property Get LegalBlockSizes ( ) As KeySizes ( ) :

Return Values

KeySizes() - A list of legal block sizes the cryptographic operation supports.

Remarks

Block sizes are represented in bits.

Read Only.

See Also

Project CorLib Overview

Class DES Overview


DES: LegalKeySizes (get)

LegalKeySizes

Returns a list of legal key sizes.

 Public Property Get LegalKeySizes ( ) As KeySizes ( ) :

Return Values

KeySizes() - A list of legal key sizes the cryptographic operation supports.

Remarks

Key sizes are represented in bits.

Read Only.

See Also

Project CorLib Overview

Class DES Overview


DES: Mode (get)

Mode

Returns the mode the current algoritm is set to.

 Public Property Get Mode ( ) As CipherMode

Return Values

CipherMode - Returns a CipherMode value.

Remarks

The algoritm can operate in several modes. The modes determine how the data is processed from one block to the next.

Read/Write.

See Also

Project CorLib Overview

Class DES Overview


DES: Mode (let)

Mode

Sets the mode the current algorithm is set to.

 Public Property Let Mode(
      ByVal Value As CipherMode ) :

Parameters

Value
[ByVal] CipherMode. The new mode for the algorithm.

Remarks

The algoritm can operate in several modes. The modes determine how the data is processed from one block to the next.

Read/Write.

See Also

Project CorLib Overview

Class DES Overview


DES: Padding (get)

Padding

Returns the padding to be used by the algorithm.

 Public Property Get Padding ( ) As PaddingMode

Return Values

PaddingMode - A current padding being used.

Remarks

Padding is added to the end of plain text data to make the data length an even multiple of the block size.

Read/Write.

See Also

Project CorLib Overview

Class DES Overview


DES: Padding (let)

Padding

Sets the padding to be used by the algorithm.

 Public Property Let Padding(
      ByVal Value As PaddingMode ) :

Parameters

Value
[ByVal] PaddingMode. The new padding value to be used.

Remarks

Padding is added to the end of plain text data to make the data length an even multiple of the block size.

Read/Write.

See Also

Project CorLib Overview

Class DES Overview


DES: ToString

ToString

Returns a string representation of this instance.

 Public Function ToString ( ) As String

Return Values

String - A string that represents this instance.

See Also

Project CorLib Overview

Class DES Overview


DES: ValidKeySize

ValidKeySize

Checks if the specific number of bits is a valid key size.

 Public Function ValidKeySize(
      ByVal BitLength As Long ) As Boolean

Parameters

BitLength
[ByVal] Long. A value to determine if is a legal key size.

Return Values

Boolean - Returns True if the bit length is a valid key size, False otherwise.

See Also

Project CorLib Overview

Class DES Overview


DESCryptoServiceProvider

DESCryptoServiceProvider

Defines a wrapper class around a DES cryptographic service provider.

Implements:

DES
IObject
SymmetricAlgorithm

Public:

Properties:

Name | Description
BlockSize (get) | Returns the block size, in bits, used by this algorithm.
BlockSize (let) | Sets the block size, in bits, used by this algorithm.
FeedbackSize (get) | Returns the Feedback Size in bits.
FeedbackSize (let) | Sets the Feedback size in bits.
IV (get) | Returns the Initialization Vector.
IV (let) | Sets the Initialization Vector to be used.
Key (get) | Returns the current secret key.
Key (let) | Sets the secret key.
KeySize (get) | Returns the key size in bits.
KeySize (let) | Sets the key size in bits.
LegalBlockSizes (get) | Returns a list of legal block sizes.
LegalKeySizes (get) | Returns a list of valid key sizes supported by this algorithm.
Mode (get) | Returns the Cipher mode this algorithm will use.
Mode (let) | Sets the Cipher mode this algorithm will use.
Padding (get) | Returns the padding mode being used.
Padding (let) | Sets the padding mode to be used.

Methods:

Name | Description
Clear | Clears the Key and IV arrays.
CreateDecryptor | Returns a new cipher used to decrypt data.
CreateEncryptor | Returns a new cipher used to encrypt data.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GenerateIV | Generates a random IV array to use.
GenerateKey | Generates a random key to be used.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
ValidKeySize | Tests if a specific bit length is valid for a key.

Remarks

This example shows a very simple method of encrypting then decrypting a String value.

Private Sub Main()
    ' Create a new DES key.
    Dim Key As New DESCryptoServiceProvider

    ' Encrypt a string to a byte array.
    Dim Buffer() As Byte
    Buffer = Encrypt("This is some plaintext!", Key)

    ' Decrypt the byte array back to a string.
    Dim PlainText As String
    PlainText = Decrypt(Buffer, Key)

    ' Display the PlainText value to the console.
    Console.WriteLine PlainText
    Console.ReadKey
End Sub Main

' Encrypt the string.
Private Function Encrypt(ByVal PlainText As String, ByVal Key As SymmetricAlgorithm) As Byte()
    Dim Buffer() As Byte
    Buffer = StrConv(PlainText, vbFromUnicode)

    Dim Encryptor As ICryptoTransform
    Set Encryptor = Key.CreateEncryptor
    Encrypt = Encryptor.TransformFinalBlock(Buffer, 0, cArray.GetLength(Buffer))
End Function

' Decrypt the byte array.
Public Function Decrypt(ByRef CypherText() As Byte, ByVal Key As SymmetricAlgorithm) As String
    Dim Decryptor As ICryptoTransform
    Set Decryptor = Key.CreateDecryptor

    Dim Buffer() As Byte
    Buffer = Decryptor.TransformFinalBlock(CypherText, 0, cArray.GetLength(CypherText))
    Decrypt = StrConv(Buffer, vbUnicode)
End Function

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview

DES


DESCryptoServiceProvider: BlockSize (get)

BlockSize

Returns the block size, in bits, used by this algorithm.

 Public Property Get BlockSize ( ) As Long

Return Values

Long - The block size in bits.

Remarks

This will always return 64 bits (8 bytes).

Read/Write.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: BlockSize (let)

BlockSize

Sets the block size, in bits, used by this algorithm.

 Public Property Let BlockSize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new block size in bits.

Remarks

The only valid block size is 64 bits.

Read/Write.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: Clear

Clear

Clears the Key and IV arrays.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: CreateDecryptor

CreateDecryptor

Returns a new cipher used to decrypt data.

 Public Function CreateDecryptor(
      Optional ByRef RgbKey As Variant,
      Optional ByRef RgbIV As Variant ) As ICryptoTransform

Parameters

RgbKey
[ByRef] Optional. Variant. A supplied byte array used as the secret key.
RgbIV
[ByRef] Optional. Variant. A supplied byte array used for the Initialization Vector (IV).

Return Values

ICryptoTransform - An ICryptoTransform object used to dencrypt data.

Remarks

Both parameters must be either supplied or missing. A single parameter will throw an exception.

If no parameters are supplied then the key and IV will be retrieved through the Key and IV properties.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: CreateEncryptor

CreateEncryptor

Returns a new cipher used to encrypt data.

 Public Function CreateEncryptor(
      Optional ByRef RgbKey As Variant,
      Optional ByRef RgbIV As Variant ) As ICryptoTransform

Parameters

RgbKey
[ByRef] Optional. Variant. A supplied byte array used as the secret key.
RgbIV
[ByRef] Optional. Variant. A supplied byte array used for the Initialization Vector (IV).

Return Values

ICryptoTransform - An ICryptoTransform object used to encrypt data.

Remarks

Both parameters must be either supplied or missing. A single parameter will throw an exception.

If no parameters are supplied then the key and IV will be retrieved through the Key and IV properties.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: DES

DES

 Implements DES

Return Values

DES -

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the values are the same.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: FeedbackSize (get)

FeedbackSize

Returns the Feedback Size in bits.

 Public Property Get FeedbackSize ( ) As Long

Return Values

Long - The Feedback size in bits.

Read/Write.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: FeedbackSize (let)

FeedbackSize

Sets the Feedback size in bits.

 Public Property Let FeedbackSize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new feedback size in bits.

Read/Write.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: GenerateIV

GenerateIV

Generates a random IV array to use.

 Public Sub GenerateIV ( )

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: GenerateKey

GenerateKey

Generates a random key to be used.

 Public Sub GenerateKey ( )

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: IV (get)

IV

Returns the Initialization Vector.

 Public Property Get IV ( ) As Byte ( )

Return Values

Byte() - The Initialization Vector.

Remarks

If no IV has been set, then a new random IV will be generated.

Read/Write.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: IV (let)

IV

Sets the Initialization Vector to be used.

 Public Property Let IV(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new IV to use.

Remarks

The array must be 8 bytes in length.

Read/Write.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: Key (get)

Key

Returns the current secret key.

 Public Property Get Key ( ) As Byte ( )

Return Values

Byte() - The secret key.

Remarks

If no key has been set, then a new random key will be generated.

Read/Write.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: Key (let)

Key

Sets the secret key.

 Public Property Let Key(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new secret key.

Read/Write.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: KeySize (get)

KeySize

Returns the key size in bits.

 Public Property Get KeySize ( ) As Long

Return Values

Long - The key size in bits.

Read/Write.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: KeySize (let)

KeySize

Sets the key size in bits.

 Public Property Let KeySize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new key size in bits.

Remarks

Only 64 bits is supported for DES encryption.

Read/Write.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: LegalBlockSizes (get)

LegalBlockSizes

Returns a list of legal block sizes.

 Public Property Get LegalBlockSizes ( ) As KeySizes ( )

Return Values

KeySizes() - A list of legal block sizes.

Remarks

Only one block size is legal, 64 bits.

Read Only.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: LegalKeySizes (get)

LegalKeySizes

Returns a list of valid key sizes supported by this algorithm.

 Public Property Get LegalKeySizes ( ) As KeySizes ( )

Return Values

KeySizes() - A list of valid key sizes.

Read Only.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: Mode (get)

Mode

Returns the Cipher mode this algorithm will use.

 Public Property Get Mode ( ) As CipherMode

Return Values

CipherMode - The Cipher mode.

Read/Write.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: Mode (let)

Mode

Sets the Cipher mode this algorithm will use.

 Public Property Let Mode(
      ByVal Value As CipherMode )

Parameters

Value
[ByVal] CipherMode. The cipher mode to use.

Read/Write.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: Padding (get)

Padding

Returns the padding mode being used.

 Public Property Get Padding ( ) As PaddingMode

Return Values

PaddingMode - The current padding mode.

Read/Write.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: Padding (let)

Padding

Sets the padding mode to be used.

 Public Property Let Padding(
      ByVal Value As PaddingMode )

Parameters

Value
[ByVal] PaddingMode. The new padding mode.

Read/Write.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: SymmetricAlgorithm

SymmetricAlgorithm

 Implements SymmetricAlgorithm

Return Values

SymmetricAlgorithm -

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESCryptoServiceProvider: ValidKeySize

ValidKeySize

Tests if a specific bit length is valid for a key.

 Public Function ValidKeySize(
      ByVal BitLength As Long ) As Boolean

Parameters

BitLength
[ByVal] Long. The number of bits to test for.

Return Values

Boolean - Return True if the number of bits is supported, False otherwise.

Remarks

Only 64bits (8 bytes) is supported.

See Also

Project CorLib Overview

Class DESCryptoServiceProvider Overview


DESStatic

DESStatic

Provides static methods relating to the DES crypto service provider.

Public:

Methods:

Name | Description
Create | Returns a DES cryptography service provider based on the name of the provider.
IsSemiWeakKey | Determins if a key is considered semi-weak.
IsWeakKey | Determines if a key is considered weak.

See Also

Project CorLib Overview

Class DESStatic Overview

DES

DESCryptoServiceProvider


DESStatic: Create

Create

Returns a DES cryptography service provider based on the name of the provider.

 Public Function Create(
      Optional ByVal AlgName As String = "DES" ) As DES

Parameters

AlgName
[ByVal] Optional. String. The implementation name of the DES cryptography service provider.

Default: "DES"

Return Values

DES - Returns a DES implementation.

Remarks

If no name is given, then the default implementation is returned.

See Also

Project CorLib Overview

Class DESStatic Overview


DESStatic: IsSemiWeakKey

IsSemiWeakKey

Determins if a key is considered semi-weak.

 Public Function IsSemiWeakKey(
      ByRef RgbKey ( ) As Byte ) As Boolean

Parameters

RgbKey
[ByRef] Byte. The key to check for semi-weakness.

Return Values

Boolean - Returns True if the key is semi-weak, False otherwise.

Remarks

DES has a set of keys known to be semi-weak. The key to be tested is compared to this set of known semi-weak keys.

The set of semi-weak keys are:

    "E001E001F101F101"
    "01E001E001F101F1"
    "FE1FFE1FFE0EFE0E"
    "1FFE1FFE0EFE0EFE"
    "E01FE01FF10EF10E"
    "1FE01FE00EF10EF1"
    "01FE01FE01FE01FE"
    "FE01FE01FE01FE01"
    "011F011F010E010E"
    "1F011F010E010E01"
    "E0FEE0FEF1FEF1FE"
    "FEE0FEE0FEF1FEF1"

See Also

Project CorLib Overview

Class DESStatic Overview


DESStatic: IsWeakKey

IsWeakKey

Determines if a key is considered weak.

 Public Function IsWeakKey(
      ByRef RgbKey ( ) As Byte ) As Boolean

Parameters

RgbKey
[ByRef] Byte. The key to check for weakness.

Return Values

Boolean - Returns True if the key weak, False otherwise.

Remarks

DES has a set of keys known to be weak. The key to be tested is compared against this set of known weak keys.

The set of weak keys are:

    "0101010101010101"
    "FEFEFEFEFEFEFEFE"
    "E0E0E0E0F1F1F1F1"
    "1F1F1F1F0E0E0E0E"

What makes these keys weak is if test encrypted with one of these keys is encrypted a second time, the original plain text would be produced.

See Also

Project CorLib Overview

Class DESStatic Overview


DictionaryEntry

DictionaryEntry

A DictionaryEntry is used to contain a key/value pair. This enables collections to keep the two values together throughout an operation.

Implements:

IObject

Public:

Properties:

Name | Description
Key (get) | Returns the Key protion of the entry.
Key (let) | Sets the key portion of the entry.
Key (set) | Sets the key portion of the entry.
Value (get) | Returns the value portion of the entry pair.
Value (let) | Sets the value portion of the entry.
Value (set) | Sets the value portion of the entry.

Methods:

Name | Description
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
ToString | Returns a string representation of this object instance.

See Also

Project CorLib Overview

Class DictionaryEntry Overview

Constructors


DictionaryEntry: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class DictionaryEntry Overview


DictionaryEntry: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class DictionaryEntry Overview


DictionaryEntry: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class DictionaryEntry Overview


DictionaryEntry: Key (get)

Key

Returns the Key protion of the entry.

 Public Property Get Key ( ) As Variant

Return Values

Variant - The key from the entry.

Read/Write.

See Also

Project CorLib Overview

Class DictionaryEntry Overview


DictionaryEntry: Key (let)

Key

Sets the key portion of the entry.

 Public Property Let Key(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. The new key to set the entry to.

Read/Write.

See Also

Project CorLib Overview

Class DictionaryEntry Overview


DictionaryEntry: Key (set)

Key

Sets the key portion of the entry.

 Public Property Set Key(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. The new key to set the entry to.

Read/Write.

See Also

Project CorLib Overview

Class DictionaryEntry Overview


DictionaryEntry: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class DictionaryEntry Overview


DictionaryEntry: Value (get)

Value

Returns the value portion of the entry pair.

 Public Property Get Value ( ) As Variant

Return Values

Variant - The value from the entry.

Read/Write.

See Also

Project CorLib Overview

Class DictionaryEntry Overview


DictionaryEntry: Value (let)

Value

Sets the value portion of the entry.

 Public Property Let Value(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. The new value to set the entry to.

Read/Write.

See Also

Project CorLib Overview

Class DictionaryEntry Overview


DictionaryEntry: Value (set)

Value

Sets the value portion of the entry.

 Public Property Set Value(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. The new value to set the entry to.

Read/Write.

See Also

Project CorLib Overview

Class DictionaryEntry Overview


Directory

Directory

Provides a set of static methods for manipulating and retrieving directory information.

Public:

Types:

Name | Description
SearchOption | Specifies whether to search the current directory, or the current directory and all subdirectories.

Methods:

Name | Description
CreateDirectory | Creates a directory and any subdirectories in the specified path.
Delete | Deletes directories and files within directories.
Exists | Checks if the path exists.
GetCreationTime | Returns the time of creation for the specified directory in local time.
GetCreationTimeUtc | Returns the time of creation for the specified directory in UTC time.
GetCurrentDirectory | Returns the current directory the application is set to.
GetDirectories | Returns a list of all the directories found in the specified directory that matches the search pattern.
GetDirectoryRoot | Returns the root directory of the specified path.
GetFiles | Returns a list of all the files that match a pattern within the specified directory.
GetFileSystemEntries | Returns both directories and files that match the specified pattern.
GetLastAccessTime | Returns the time the directory was last accessed in local time.
GetLastAccessTimeUtc | Returns the time the directory was last accessed in UTC time.
GetLastWriteTime | Returns the time the directory was last written to in local time.
GetLastWriteTimeUtc | Returns the time the directory was last written to in UTC time.
GetLogicalDrives | Returns a list of the logical drives installed on this machine.
GetParent | Returns the parent of the specified directory.
Move | Moves a directory and all of its contents to another location.
SetCreationTime | Sets the creation time of the specified directory to the local time.
SetCreationTimeUtc | Sets the creation time of the specified directory to UTC time.
SetCurrentDirectory | Changes the current directory to the specified directory.
SetLastAccessTime | Sets the time the directory was last accessed in local time.
SetLastAccessTimeUtc | Sets the time the directory was last accessed in UTC time.
SetLastWriteTime | Sets the time the directory was last written to in local time.
SetLastWriteTimeUtc | Sets the time the directory was last written to in UTC time.

Remarks

Use the Directory class for typical operations such as copying, moving, renaming, creating, and deleting directories. You can also use the Directory class to get and set DateTime information related to the creation, access, and writing of a directory.

Examples

The following code example determines whether a specified directory exists, deletes it if it exists, and creates it if it does not exist. This example then moves the directory, creates a file in the directory, and counts the files in the directory.

Public Sub Main()
    Const Source As String = "c:\MyDir"
    Const Target As String = "c:\TestDir"

    On Error GoTo Catch

    If Not Directory.Exists(Source) Then
        Directory.CreateDirectory Source
    End If

    File.CreateText Path.Combine(Source, "MyDirFile.txt")

    If Directory.Exists(Target) Then
        Directory.Delete Target, True
    End If

    Directory.Move Source, Target

    File.CreateText Path.Combine(Target, "TestDirFile.txt")

    Debug.Print CorString.Format("The number of files in {0} is {1}", _
        Target, CorArray.Length(Directory.GetFiles(Target)))

    Exit Sub

Catch:
    Dim Ex As Exception
    Catch Ex, Err
    Debug.Print "The process failed: " & Ex.Message
End Sub

See Also

Project CorLib Overview

Class Directory Overview


Directory: CreateDirectory

CreateDirectory

Creates a directory and any subdirectories in the specified path.

 Public Function CreateDirectory(
      ByRef Path As String ) As DirectoryInfo

Parameters

Path
[ByRef] String. The directory path to be created.

Return Values

DirectoryInfo - A DirectoryInfo object that represents the created directory.

Remarks

The path to be created can be a relative or absolute path.

See Also

Project CorLib Overview

Class Directory Overview


Directory: Delete

Delete

Deletes directories and files within directories.

 Public Sub Delete(
      ByRef Path As String,
      Optional ByVal Recursive As Boolean = False )

Parameters

Path
[ByRef] String. The top directory to be deleted.
Recursive
[ByVal] Optional. Boolean. If set to True, then all directories and files in the top directory will be deleted along with the top directory. Otherwise, the specified directory must be empty to be deleted.

Default: False

See Also

Project CorLib Overview

Class Directory Overview


Directory: Exists

Exists

Checks if the path exists.

 Public Function Exists(
      ByRef Path As String ) As Boolean

Parameters

Path
[ByRef] String. The path to check for existence.

Return Values

Boolean - Indication of the existence of the path.

Remarks

The path can be relative or absolute.

See Also

Project CorLib Overview

Class Directory Overview


Directory: GetCreationTime

GetCreationTime

Returns the time of creation for the specified directory in local time.

 Public Function GetCreationTime(
      ByRef Path As String ) As CorDateTime

Parameters

Path
[ByRef] String. The directory to retrieve the creation time of.

Return Values

CorDateTime - A CorDateTime object containing the creation time of the directory.

Remarks

The path can be relative or absolute.

See Also

Project CorLib Overview

Class Directory Overview


Directory: GetCreationTimeUtc

GetCreationTimeUtc

Returns the time of creation for the specified directory in UTC time.

 Public Function GetCreationTimeUtc(
      ByRef Path As String ) As CorDateTime

Parameters

Path
[ByRef] String. The directory to retrieve the creation time of.

Return Values

CorDateTime - A CorDateTime object containing the creation time of the directory.

Remarks

The path can be relative or absolute.

See Also

Project CorLib Overview

Class Directory Overview


Directory: GetCurrentDirectory

GetCurrentDirectory

Returns the current directory the application is set to.

 Public Function GetCurrentDirectory ( ) As String

Return Values

String - The current set directory.

See Also

Project CorLib Overview

Class Directory Overview


Directory: GetDirectories

GetDirectories

Returns a list of all the directories found in the specified directory that matches the search pattern.

 Public Function GetDirectories(
      ByRef Path As String,
      Optional ByRef SearchPattern As String = "*",
      Optional ByVal SearchOption As SearchOption = TopDirectoryOnly ) As String ( )

Parameters

Path
[ByRef] String. The directory to find the requested directories.
SearchPattern
[ByRef] Optional. String. A pattern to compare all the directories against, returning those that match the pattern.

Default: "*"

SearchOption
[ByVal] Optional. SearchOption. One of the enumeration values that specifies whether the search operation should include all subdirectories or only the current directory.

Default: TopDirectoryOnly

Return Values

String() - An array of the matching directories. If no directories match the pattern, then an empty zero-length array.

Remarks

The path can be absolute or relative.

See Also

Project CorLib Overview

Class Directory Overview


Directory: GetDirectoryRoot

GetDirectoryRoot

Returns the root directory of the specified path.

 Public Function GetDirectoryRoot(
      ByRef Path As String ) As String

Parameters

Path
[ByRef] String. The path to return the root of.

Return Values

String - The root of the specified directory.

Remarks

If the path is relative, then the current directory will be used as the root.

See Also

Project CorLib Overview

Class Directory Overview


Directory: GetFiles

GetFiles

Returns a list of all the files that match a pattern within the specified directory.

 Public Function GetFiles(
      ByRef Path As String,
      Optional ByRef SearchPattern As String = "*",
      Optional ByVal SearchOption As SearchOption = TopDirectoryOnly ) As String ( )

Parameters

Path
[ByRef] String. The directory to search for the matching files.
SearchPattern
[ByRef] Optional. String. A pattern to match the files against.

Default: "*"

SearchOption
[ByVal] Optional. SearchOption. One of the enumeration values that specifies whether the search operation should include all subdirectories or only the current directory.

Default: TopDirectoryOnly

Return Values

String() - The list of matching file names. If no filenames matched, then an empty, zero-length array is returned.

Remarks

The path can be absolute or relative. The path is not included in the filename result.

See Also

Project CorLib Overview

Class Directory Overview


Directory: GetFileSystemEntries

GetFileSystemEntries

Returns both directories and files that match the specified pattern.

 Public Function GetFileSystemEntries(
      ByRef Path As String,
      Optional ByRef SearchPattern As String = "*",
      Optional SearchOption As SearchOption = TopDirectoryOnly ) As String ( )

Parameters

Path
[ByRef] String. The directory to search for the files and directories.
SearchPattern
[ByRef] Optional. String. The pattern the filenames and directories must match.

Default: "*"

SearchOption
[ByRef] Optional. SearchOption. One of the enumeration values that specifies whether the search operation should include all subdirectories or only the current directory.

Default: TopDirectoryOnly

Return Values

String() - The list of files and directories that matched the pattern. If no files or directories matched the pattern, then an empty, zero-length array is returned.

Remarks

The path can be absolute or relative.

See Also

Project CorLib Overview

Class Directory Overview


Directory: GetLastAccessTime

GetLastAccessTime

Returns the time the directory was last accessed in local time.

 Public Function GetLastAccessTime(
      ByRef Path As String ) As CorDateTime

Parameters

Path
[ByRef] String. The directory to retrieve the last time it was accessed.

Return Values

CorDateTime - A CorDateTime object containing the time the directory was last accessed.

Remarks

The path can be relative or absolute.

See Also

Project CorLib Overview

Class Directory Overview


Directory: GetLastAccessTimeUtc

GetLastAccessTimeUtc

Returns the time the directory was last accessed in UTC time.

 Public Function GetLastAccessTimeUtc(
      ByRef Path As String ) As CorDateTime

Parameters

Path
[ByRef] String. The directory to retrieve the last time it was accessed.

Return Values

CorDateTime - A CorDateTime object containing the time the directory was last accessed.

Remarks

The path can be relative or absolute.

See Also

Project CorLib Overview

Class Directory Overview


Directory: GetLastWriteTime

GetLastWriteTime

Returns the time the directory was last written to in local time.

 Public Function GetLastWriteTime(
      ByRef Path As String ) As CorDateTime

Parameters

Path
[ByRef] String. The directory to retrieve the last time it was written to.

Return Values

CorDateTime - A CorDateTime object containing the last time the directory was written to.

Remarks

The path can relative or absolute.

See Also

Project CorLib Overview

Class Directory Overview


Directory: GetLastWriteTimeUtc

GetLastWriteTimeUtc

Returns the time the directory was last written to in UTC time.

 Public Function GetLastWriteTimeUtc(
      ByRef Path As String ) As CorDateTime

Parameters

Path
[ByRef] String. The directory to retrieve the last time it was written to.

Return Values

CorDateTime - A CorDateTime object containing the last time the directory was written to.

Remarks

The path can relative or absolute.

See Also

Project CorLib Overview

Class Directory Overview


Directory: GetLogicalDrives

GetLogicalDrives

Returns a list of the logical drives installed on this machine.

 Public Function GetLogicalDrives ( ) As String ( )

Return Values

String() - The list of logical drives on this machine.

See Also

Project CorLib Overview

Class Directory Overview


Directory: GetParent

GetParent

Returns the parent of the specified directory.

 Public Function GetParent(
      ByRef Path As String ) As DirectoryInfo

Parameters

Path
[ByRef] String. The directory to retrieve the parent of.

Return Values

DirectoryInfo - A DirectoryInfo object representing the parent directory.

Remarks

The path can be absolute or relative.

See Also

Project CorLib Overview

Class Directory Overview


Directory: Move

Move

Moves a directory and all of its contents to another location.

 Public Sub Move(
      ByRef SourceDirName As String,
      ByRef DestDirName As String )

Parameters

SourceDirName
[ByRef] String. The directory to be moved.
DestDirName
[ByRef] String. The directory to be moved to.

Remarks

The destination directory is the source directory renamed after the moving of the source directory.

See Also

Project CorLib Overview

Class Directory Overview


Directory: SearchOption

SearchOption

Specifies whether to search the current directory, or the current directory and all subdirectories.

 Public Enum SearchOption

Values

AllDirectories
Includes the current directory and all the subdirectories in a search operation. This option includes reparse points like mounted drives and symbolic links in the search.
TopDirectoryOnly
Includes only the current directory in a search.

Remarks

If you choose AllDirectories in your search and the directory structure contains a link that creates a loop, the search operation enters an infinite loop.

Examples

The following code example lists all of the directories and files that begin with the letter "s" in "c:\". In this example, the SearchOption is used to specify not to search all subdirectories.

Public Sub Main()
    Const Path As String = "c:\"
    Const SearchPattern As String = "s*"

    Dim di As DirectoryInfo
    Dim Directories() As DirectoryInfo
    Dim Files() As FileInfo

    Set di = NewDirectoryInfo(Path)
    Directories = di.GetDirectories(SearchPattern, SearchOption.TopDirectoryOnly)
    Files = di.GetFiles(SearchPattern, SearchOption.TopDirectoryOnly)

    Debug.Print "Directories that begin with the letter ""s"" in " & Path

    DisplayFileSystemInfo Directories

    Debug.Print t("\nFiles that begin with the letter ""s"" in ") & Path

    DisplayFileSystemInfo Files
End Sub

Private Sub DisplayFileSystemInfo(ByRef Source As Variant)
    Dim Item As Variant
    Dim Info As FileSystemInfo

    For Each Item In Source
        Set Info = Item
        Debug.Print CorString.Format("{0,-25} {1,25}", Info.FullName, Info.LastWriteTime)
    Next
End Sub

See Also

Project CorLib Overview

Class Directory Overview


Directory: SetCreationTime

SetCreationTime

Sets the creation time of the specified directory to the local time.

 Public Sub SetCreationTime(
      ByRef Path As String,
      ByRef CreationTime As Variant )

Parameters

Path
[ByRef] String. The directory to set the creation time for.
CreationTime
[ByRef] Variant. A Date or CorDateTime object of the new time.

Remarks

The time will have the UTC offset removed before setting the the directory to it. When the time is read, it will be in local time to the timezone.

See Also

Project CorLib Overview

Class Directory Overview


Directory: SetCreationTimeUtc

SetCreationTimeUtc

Sets the creation time of the specified directory to UTC time.

 Public Sub SetCreationTimeUtc(
      ByRef Path As String,
      ByRef CreationTime As Variant )

Parameters

Path
[ByRef] String. The directory to set the creation time for in UTC.
CreationTime
[ByRef] Variant. A Date or CorDateTime object of the new UTC time.

Remarks

The directory is set to the actual time passed in.

See Also

Project CorLib Overview

Class Directory Overview


Directory: SetCurrentDirectory

SetCurrentDirectory

Changes the current directory to the specified directory.

 Public Sub SetCurrentDirectory(
      ByRef Path As String )

Parameters

Path
[ByRef] String. The new directory to set as the current directory.

Remarks

The path can be absolute or relative.

See Also

Project CorLib Overview

Class Directory Overview


Directory: SetLastAccessTime

SetLastAccessTime

Sets the time the directory was last accessed in local time.

 Public Sub SetLastAccessTime(
      ByRef Path As String,
      ByRef LastAccessTime As Variant )

Parameters

Path
[ByRef] String. The directory to set the new time for.
LastAccessTime
[ByRef] Variant. A Date or CorDateTime object of the new time.

Remarks

The UTC offset is removed from the time before setting the directory.

See Also

Project CorLib Overview

Class Directory Overview


Directory: SetLastAccessTimeUtc

SetLastAccessTimeUtc

Sets the time the directory was last accessed in UTC time.

 Public Sub SetLastAccessTimeUtc(
      ByRef Path As String,
      ByRef LastAccessTime As Variant )

Parameters

Path
[ByRef] String. The directory to set the new time for.
LastAccessTime
[ByRef] Variant. A Date or CorDateTime object of the new time.

Remarks

The directory is set to the actual time passed in.

See Also

Project CorLib Overview

Class Directory Overview


Directory: SetLastWriteTime

SetLastWriteTime

Sets the time the directory was last written to in local time.

 Public Sub SetLastWriteTime(
      ByRef Path As String,
      ByRef LastWriteTime As Variant )

Parameters

Path
[ByRef] String. The directory to set the new time for.
LastWriteTime
[ByRef] Variant. A Date or CorDateTime object of the new time.

See Also

Project CorLib Overview

Class Directory Overview


Directory: SetLastWriteTimeUtc

SetLastWriteTimeUtc

Sets the time the directory was last written to in UTC time.

 Public Sub SetLastWriteTimeUtc(
      ByRef Path As String,
      ByRef LastWriteTime As Variant )

Parameters

Path
[ByRef] String. The directory to set the new time for.
LastWriteTime
[ByRef] Variant. A Date or CorDateTime object of the new time.

See Also

Project CorLib Overview

Class Directory Overview


DirectoryInfo

DirectoryInfo

Represents a directory to modify and retrieve information about.

Implements:

FileSystemInfo
IObject

Public:

Properties:

Name | Description
Attributes (get) | Returns the directorys attributes (ReadOnly, Hidden, Archive, ...)
Attributes (let) | Sets the attributes for the directory.
CreationTime (get) | Returns the creation time for this directory in local time.
CreationTime (let) | Sets the creation time for the directory in local time.
CreationTime (set) | Sets the creation time for the directory in local time.
CreationTimeUtc (get) | Returns the creation time as UTC time.
CreationTimeUtc (let) | Sets the creation time as UTC time.
CreationTimeUtc (set) | Sets the creation time as UTC time.
Exists (get) | Checks if the directory actually exists.
Extension (get) | Returns an empty string for directories.
FullName (get) | Returns the name of the directory, including the full path to the directory.
LastAccessTime (get) | Returns the last time the directory was accessed in local time.
LastAccessTime (let) | Sets the time the directory was last accessed in local time.
LastAccessTime (set) | Sets the time the directory was last accessed in local time.
LastAccessTimeUtc (get) | Returns the last time the directory was accessed in UTC time.
LastAccessTimeUtc (let) | Sets the last time the directory was accessed in UTC time.
LastAccessTimeUtc (set) | Sets the last time the directory was accessed in UTC time.
LastWriteTime (get) | Returns the last time the directory was written to in local time.
LastWriteTime (let) | Sets the last time the directory was written to in local time.
LastWriteTime (set) | Sets the last time the directory was written to in local time.
LastWriteTimeUtc (get) | Returns the last time the directory was written to in UTC time.
LastWriteTimeUtc (let) | Sets the last time the directory was written to in UTC time.
LastWriteTimeUtc (set) | Sets the last time the directory was written to in UTC time.
Name (get) | Returns the name of the directory this instance represents.
Parent (get) | Returns the parent directory as a DirectoryInfo object.
Root (get) | Returns a DirectoryInfo object of the root directory of this instance.

Methods:

Name | Description
Create | Creates the path represented by this instance.
CreateSubdirectory | Creates a directory within this instance, returning the new subdirectory.
Delete | Deletes this directory if it is empty, or all of its contents and itself if Recursive is set to True.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetDirectories | Returns a list of directories within this directory.
GetFiles | Returns a list of file matching the pattern in this directory.
GetFileSystemInfos | Returns a list of all entries in the directory that match the pattern.
GetHashCode | Returns a pseudo-unique number identifying this instance.
MoveTo | Moves this directory and its contents to the specified path.
Refresh | Reloads all of the attributes and timestamps for the directory.
ToString | Returns a string representation of this object instance.

Remarks

The DirectoryInfo object does not verify the existence of the directory until information has to be read or written to that directory.

See Also

Project CorLib Overview

Class DirectoryInfo Overview

Constructors


DirectoryInfo: Attributes (get)

Attributes

Returns the directorys attributes (ReadOnly, Hidden, Archive, ...)

 Public Property Get Attributes ( ) As FileAttributes

Return Values

FileAttributes - The directories attributes since the last time Refresh was called.

Remarks

The attributes are not kept current. If the they are changed since last checked, then Refresh must be called to retrieve the current settings.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: Attributes (let)

Attributes

Sets the attributes for the directory.

 Public Property Let Attributes(
      ByVal Value As FileAttributes )

Parameters

Value
[ByVal] FileAttributes. The attributes to set for the directory.

Remarks

Setting just one attribute will clear all the other attributes. To preserve any attributes, then OR must be used with the attributes to be preserved.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: Create

Create

Creates the path represented by this instance.

 Public Sub Create ( )

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: CreateSubdirectory

CreateSubdirectory

Creates a directory within this instance, returning the new subdirectory.

 Public Function CreateSubdirectory(
      ByVal sPath As String ) As DirectoryInfo

Parameters

sPath
[ByVal] String. The new subdirectory to be created.

Return Values

DirectoryInfo - A DirectoryInfo object of the new subdirectory path.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: CreationTime (get)

CreationTime

Returns the creation time for this directory in local time.

 Public Property Get CreationTime ( ) As Variant

Return Values

Variant - A CorDateTime object representing the creation time for this directory.

Remarks

The time returned is the UTC time with the timezone offset applied. For Pacific Coast, a -8 hours is added to the time before returning.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: CreationTime (let)

CreationTime

Sets the creation time for the directory in local time.

 Public Property Let CreationTime(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date of the new time.

Remarks

The time has the UTC timezone offset applied to it before being written to the directory.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: CreationTime (set)

CreationTime

Sets the creation time for the directory in local time.

 Public Property Set CreationTime(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A CorDateTime object of the new time.

Remarks

The time has the UTC timezone offset applied to it before being written to the directory.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: CreationTimeUtc (get)

CreationTimeUtc

Returns the creation time as UTC time.

 Public Property Get CreationTimeUtc ( ) As Variant

Return Values

Variant - A CorDateTime object of the UTC time.

Remarks

The time returned is the time on the directory without any offsets being applied.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: CreationTimeUtc (let)

CreationTimeUtc

Sets the creation time as UTC time.

 Public Property Let CreationTimeUtc(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date value as the new time.

Remarks

The time has the UTC timezone offset removed from it before being written to the directory.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: CreationTimeUtc (set)

CreationTimeUtc

Sets the creation time as UTC time.

 Public Property Set CreationTimeUtc(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A CorDateTime object of the new time.

Remarks

The time has the UTC timezone offset removed from it before being written to the directory.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: Delete

Delete

Deletes this directory if it is empty, or all of its contents and itself if Recursive is set to True.

 Public Sub Delete(
      Optional ByVal Recursive As Boolean )

Parameters

Recursive
[ByVal] Optional. Boolean. Indicates if all entries in the directory should be deleted.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: Exists (get)

Exists

Checks if the directory actually exists.

 Public Property Get Exists ( ) As Boolean

Return Values

Boolean - An indication of the directory existing.

Read Only.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: Extension (get)

Extension

Returns an empty string for directories.

 Public Property Get Extension ( ) As String

Return Values

String - An empty string.

Read Only.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: FileSystemInfo

FileSystemInfo

 Implements FileSystemInfo

Return Values

FileSystemInfo -

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: FullName (get)

FullName

Returns the name of the directory, including the full path to the directory.

 Public Property Get FullName ( ) As String

Return Values

String -

Read Only.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: GetDirectories

GetDirectories

Returns a list of directories within this directory.

 Public Function GetDirectories(
      Optional ByVal SearchPattern As String = "*",
      Optional ByVal SearchOption As SearchOption = TopDirectoryOnly ) As DirectoryInfo ( )

Parameters

SearchPattern
[ByVal] Optional. String. A pattern for all directories to match.

Default: "*"

SearchOption
[ByVal] Optional. SearchOption. One of the enumeration values that specifies whether the search operation should include all subdirectories or only the current directory.

Default: TopDirectoryOnly

Return Values

DirectoryInfo() - A list of all matching directories.

Remarks

If no matching directories were found, then an empty array is returned.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: GetFiles

GetFiles

Returns a list of file matching the pattern in this directory.

 Public Function GetFiles(
      Optional ByVal SearchPattern As String = "*",
      Optional ByVal SearchOption As SearchOption = TopDirectoryOnly ) As FileInfo ( )

Parameters

SearchPattern
[ByVal] Optional. String. The pattern the files must match.

Default: "*"

SearchOption
[ByVal] Optional. SearchOption. One of the enumeration values that specifies whether the search operation should include all subdirectories or only the current directory.

Default: TopDirectoryOnly

Return Values

FileInfo() - A list of files that matched the pattern.

Remarks

If no files matched the pattern, a zero-length array is returned.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: GetFileSystemInfos

GetFileSystemInfos

Returns a list of all entries in the directory that match the pattern.

 Public Function GetFileSystemInfos(
      Optional ByVal SearchPattern As String = "*",
      Optional ByVal SearchOption As SearchOption = TopDirectoryOnly ) As FileSystemInfo ( )

Parameters

SearchPattern
[ByVal] Optional. String. The pattern to match against all entries.

Default: "*"

SearchOption
[ByVal] Optional. SearchOption. One of the enumeration values that specifies whether the search operation should include all subdirectories or only the current directory.

Default: TopDirectoryOnly

Return Values

FileSystemInfo() - A list of all entries that matched the pattern.

Remarks

If no entries matched the pattern, a zero-length array is returned.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: LastAccessTime (get)

LastAccessTime

Returns the last time the directory was accessed in local time.

 Public Property Get LastAccessTime ( ) As Variant

Return Values

Variant - A CorDateTime object of the time.

Remarks

The returned time is the UTC time with the UTC timezone offset applied.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: LastAccessTime (let)

LastAccessTime

Sets the time the directory was last accessed in local time.

 Public Property Let LastAccessTime(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: LastAccessTime (set)

LastAccessTime

Sets the time the directory was last accessed in local time.

 Public Property Set LastAccessTime(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: LastAccessTimeUtc (get)

LastAccessTimeUtc

Returns the last time the directory was accessed in UTC time.

 Public Property Get LastAccessTimeUtc ( ) As Variant

Return Values

Variant - a CorDateTime object of the time.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: LastAccessTimeUtc (let)

LastAccessTimeUtc

Sets the last time the directory was accessed in UTC time.

 Public Property Let LastAccessTimeUtc(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: LastAccessTimeUtc (set)

LastAccessTimeUtc

Sets the last time the directory was accessed in UTC time.

 Public Property Set LastAccessTimeUtc(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: LastWriteTime (get)

LastWriteTime

Returns the last time the directory was written to in local time.

 Public Property Get LastWriteTime ( ) As Variant

Return Values

Variant - A CorDateTime object of the time.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: LastWriteTime (let)

LastWriteTime

Sets the last time the directory was written to in local time.

 Public Property Let LastWriteTime(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: LastWriteTime (set)

LastWriteTime

Sets the last time the directory was written to in local time.

 Public Property Set LastWriteTime(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: LastWriteTimeUtc (get)

LastWriteTimeUtc

Returns the last time the directory was written to in UTC time.

 Public Property Get LastWriteTimeUtc ( ) As Variant

Return Values

Variant - A CorDateTime object of the time.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: LastWriteTimeUtc (let)

LastWriteTimeUtc

Sets the last time the directory was written to in UTC time.

 Public Property Let LastWriteTimeUtc(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: LastWriteTimeUtc (set)

LastWriteTimeUtc

Sets the last time the directory was written to in UTC time.

 Public Property Set LastWriteTimeUtc(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: MoveTo

MoveTo

Moves this directory and its contents to the specified path.

 Public Sub MoveTo(
      ByVal DestDirName As String )

Parameters

DestDirName
[ByVal] String. The new path and name of the directory.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: Name (get)

Name

Returns the name of the directory this instance represents.

 Public Property Get Name ( ) As String

Return Values

String -

Read Only.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: Parent (get)

Parent

Returns the parent directory as a DirectoryInfo object.

 Public Property Get Parent ( ) As DirectoryInfo

Return Values

DirectoryInfo - A DirectroyInfo object of the parent directory, or Nothing if the original directory is a root, such as c:\'

Read Only.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: Refresh

Refresh

Reloads all of the attributes and timestamps for the directory.

 Public Sub Refresh ( )

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: Root (get)

Root

Returns a DirectoryInfo object of the root directory of this instance.

 Public Property Get Root ( ) As DirectoryInfo

Return Values

DirectoryInfo - A DirectoryInfo object of the root.

Read Only.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryInfo: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class DirectoryInfo Overview


DirectoryNotFoundException

DirectoryNotFoundException

An exception that is thrown when a specified directory was not found.

Implements:

Exception
IObject
IOException
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

See Also

Project CorLib Overview

Class DirectoryNotFoundException Overview


DirectoryNotFoundException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class DirectoryNotFoundException Overview


DirectoryNotFoundException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class DirectoryNotFoundException Overview


DirectoryNotFoundException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class DirectoryNotFoundException Overview


DirectoryNotFoundException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class DirectoryNotFoundException Overview


DirectoryNotFoundException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class DirectoryNotFoundException Overview


DirectoryNotFoundException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class DirectoryNotFoundException Overview


DirectoryNotFoundException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class DirectoryNotFoundException Overview


DirectoryNotFoundException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class DirectoryNotFoundException Overview


DirectoryNotFoundException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class DirectoryNotFoundException Overview

Exception


DirectoryNotFoundException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class DirectoryNotFoundException Overview


DirectoryNotFoundException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class DirectoryNotFoundException Overview


DirectoryNotFoundException: IOException

IOException

 Implements IOException

Return Values

IOException -

See Also

Project CorLib Overview

Class DirectoryNotFoundException Overview


DirectoryNotFoundException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewArgumentException.

Read Only.

See Also

Project CorLib Overview

Class DirectoryNotFoundException Overview


DirectoryNotFoundException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryNotFoundException Overview


DirectoryNotFoundException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class DirectoryNotFoundException Overview


DirectoryNotFoundException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class DirectoryNotFoundException Overview


DirectoryNotFoundException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class DirectoryNotFoundException Overview


DivideByZeroException

DivideByZeroException

The exception that is thrown when there is an attempt to divide an integral or decimal value by zero.

Implements:

ArithmeticException
Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

See Also

Project CorLib Overview

Class DivideByZeroException Overview

Constructors

ExceptionMethods

Exception


DivideByZeroException: ArithmeticException

ArithmeticException

 Implements ArithmeticException

Return Values

ArithmeticException -

See Also

Project CorLib Overview

Class DivideByZeroException Overview


DivideByZeroException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class DivideByZeroException Overview


DivideByZeroException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class DivideByZeroException Overview


DivideByZeroException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class DivideByZeroException Overview


DivideByZeroException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class DivideByZeroException Overview


DivideByZeroException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class DivideByZeroException Overview


DivideByZeroException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class DivideByZeroException Overview


DivideByZeroException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class DivideByZeroException Overview


DivideByZeroException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class DivideByZeroException Overview


DivideByZeroException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class DivideByZeroException Overview

Exception


DivideByZeroException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class DivideByZeroException Overview


DivideByZeroException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class DivideByZeroException Overview


DivideByZeroException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewArgumentException.

Read Only.

See Also

Project CorLib Overview

Class DivideByZeroException Overview


DivideByZeroException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class DivideByZeroException Overview


DivideByZeroException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class DivideByZeroException Overview


DivideByZeroException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class DivideByZeroException Overview


DivideByZeroException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class DivideByZeroException Overview


DriveInfo

DriveInfo

Provides methods to access information about a drive.

Implements:

IObject

Public:

Properties:

Name | Description
AvailableFreeSpace (get) | Returns the amount of free space is available allowed for the current account use.
DriveFormat (get) | Returns the drive format (NTFS, FAT32, ...)
DriveType (get) | Returns the type of drive this instance represents.
IsReady (get) | Returns if the drive is ready to be accessed.
Name (get) | Returns the name of the drive.
RootDirectory (get) | Returns a DirectoryInfo of the root directory for the drive.
SerialNumber (get) | Returns the serial number for the drive.
TotalFreeSpace (get) | Returns the amount of free space on the drive.
TotalSize (get) | Returns the amount of storage the drive media is capable of holding.
VolumeLabel (get) | Returns the volume name.
VolumeLabel (let) | Sets the volume name.

Methods:

Name | Description
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
ToString | Returns a string representation of this object instance.

Remarks

A constructor is used to create a new DriveInfo.

 Set info = NewDriveInfo("c:\")

See Also

Project CorLib Overview

Class DriveInfo Overview

DriveInfoStatic

Constructors

FileInfo

DirectoryInfo


DriveInfo: AvailableFreeSpace (get)

AvailableFreeSpace

Returns the amount of free space is available allowed for the current account use.

 Public Property Get AvailableFreeSpace ( ) As Currency

Return Values

Currency - The amount of free space available to the current account.

Read Only.

See Also

Project CorLib Overview

Class DriveInfo Overview


DriveInfo: DriveFormat (get)

DriveFormat

Returns the drive format (NTFS, FAT32, ...)

 Public Property Get DriveFormat ( ) As String

Return Values

String - The drive format.

Read Only.

See Also

Project CorLib Overview

Class DriveInfo Overview


DriveInfo: DriveType (get)

DriveType

Returns the type of drive this instance represents.

 Public Property Get DriveType ( ) As DriveType

Return Values

DriveType - The type of drive.

Read Only.

See Also

Project CorLib Overview

Class DriveInfo Overview


DriveInfo: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class DriveInfo Overview


DriveInfo: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class DriveInfo Overview


DriveInfo: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class DriveInfo Overview


DriveInfo: IsReady (get)

IsReady

Returns if the drive is ready to be accessed.

 Public Property Get IsReady ( ) As Boolean

Return Values

Boolean - Whether the drive is ready to be accessed.

Read Only.

See Also

Project CorLib Overview

Class DriveInfo Overview


DriveInfo: Name (get)

Name

Returns the name of the drive.

 Public Property Get Name ( ) As String

Return Values

String - The name of the drive.

Read Only.

See Also

Project CorLib Overview

Class DriveInfo Overview


DriveInfo: RootDirectory (get)

RootDirectory

Returns a DirectoryInfo of the root directory for the drive.

 Public Property Get RootDirectory ( ) As DirectoryInfo

Return Values

DirectoryInfo - The root directory of the drive.

Read Only.

See Also

Project CorLib Overview

Class DriveInfo Overview


DriveInfo: SerialNumber (get)

SerialNumber

Returns the serial number for the drive.

 Public Property Get SerialNumber ( ) As Long

Return Values

Long - The serial number.

Read Only.

See Also

Project CorLib Overview

Class DriveInfo Overview


DriveInfo: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class DriveInfo Overview


DriveInfo: TotalFreeSpace (get)

TotalFreeSpace

Returns the amount of free space on the drive.

 Public Property Get TotalFreeSpace ( ) As Currency

Return Values

Currency - The amount of free space.

Read Only.

See Also

Project CorLib Overview

Class DriveInfo Overview


DriveInfo: TotalSize (get)

TotalSize

Returns the amount of storage the drive media is capable of holding.

 Public Property Get TotalSize ( ) As Currency

Return Values

Currency - The maximum storage amount.

Read Only.

See Also

Project CorLib Overview

Class DriveInfo Overview


DriveInfo: VolumeLabel (get)

VolumeLabel

Returns the volume name.

 Public Property Get VolumeLabel ( ) As String

Return Values

String - The volume name.

Read/Write.

See Also

Project CorLib Overview

Class DriveInfo Overview


DriveInfo: VolumeLabel (let)

VolumeLabel

Sets the volume name.

 Public Property Let VolumeLabel(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new volume name.

Read/Write.

See Also

Project CorLib Overview

Class DriveInfo Overview


DriveInfoStatic

DriveInfoStatic

Provides static methods for manipulating DriveInfo objects.

Public:

Types:

Name | Description
DriveType | Represents the type of drives a DriveInfo can be.

Methods:

Name | Description
GetDrives | Returns an array of all the local logical drives.

Remark

This class cannot be instantiated directly. To access these methods use the DriveInfo.* syntax.

See Also

Project CorLib Overview

Class DriveInfoStatic Overview

DriveInfo

Constructors


DriveInfoStatic: DriveType

DriveType

Represents the type of drives a DriveInfo can be.

 Public Enum DriveType

Values

Unknown = 0
The device is of an unknown type.
NoRootDirectory = 1
The DriveInfo is no a root directory.
Removable = 2
The drive is a removable storage device.
Fixed = 3
The device is a fixed disk.
Network = 4
The drive is a network drive.
CDRom = 5
The drive is a CD-Rom drive.
RamDisk = 6
The drive is a RAM disk.

See Also

Project CorLib Overview

Class DriveInfoStatic Overview


DriveInfoStatic: GetDrives

GetDrives

Returns an array of all the local logical drives.

 Public Function GetDrives ( ) As DriveInfo ( )

Return Values

DriveInfo() - An array of DriveInfo objects.

See Also

Project CorLib Overview

Class DriveInfoStatic Overview


DriveNotFoundException

DriveNotFoundException

The exception that is thrown when trying to access a drive or share that is not available.

Implements:

Exception
IObject
IOException
SystemException

Public:

Properties:

Name | Description
Data (get) |
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

See Also

Project CorLib Overview

Class DriveNotFoundException Overview


DriveNotFoundException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class DriveNotFoundException Overview


DriveNotFoundException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Remarks

This returns the constant 76 (Path Not Found).

Read Only.

See Also

Project CorLib Overview

Class DriveNotFoundException Overview


DriveNotFoundException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class DriveNotFoundException Overview


DriveNotFoundException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class DriveNotFoundException Overview


DriveNotFoundException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class DriveNotFoundException Overview


DriveNotFoundException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class DriveNotFoundException Overview


DriveNotFoundException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class DriveNotFoundException Overview


DriveNotFoundException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

This returns the constant COR_E_DIRECTORYNOTFOUND (&H80070003).

Read Only.

See Also

Project CorLib Overview

Class DriveNotFoundException Overview

Exception


DriveNotFoundException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class DriveNotFoundException Overview


DriveNotFoundException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class DriveNotFoundException Overview


DriveNotFoundException: IOException

IOException

 Implements IOException

Return Values

IOException -

See Also

Project CorLib Overview

Class DriveNotFoundException Overview


DriveNotFoundException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewException.

Read Only.

See Also

Project CorLib Overview

Class DriveNotFoundException Overview


DriveNotFoundException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class DriveNotFoundException Overview


DriveNotFoundException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class DriveNotFoundException Overview


DriveNotFoundException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class DriveNotFoundException Overview


DriveNotFoundException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class DriveNotFoundException Overview


DSA

DSA

Represents a base interface all DSA (Digital Signature Algorithm) implementations must implement.

Public:

Properties:

Name | Description
KeyExchangeAlgorithm (get) | Gets the name of the Key Exchange algorithm.
KeySize (get) | Gets the key size for the current implementation.
KeySize (let) | Sets the key size for the current implementation.
LegalKeySizes (get) | Gets a set of valid key sizes represented as KeySizes objects.
SignatureAlgorithm (get) | Gets the name of the signature algorithm.

Methods:

Name | Description
Clear | Releases any resources used by the current object.
CreateSignature | Creates a signature for a hash value.
Equals | Returns if the value and the object are equal.
ExportParameters | Exports the DSA key in a DSAParameters object.
FromXmlString | Imports a DSA key from an XML string.
GetHashCode | Returns a semi-unique number identifying this instance.
ImportParameters | Imports a DSA key from a DSAParameters object.
ToString | Returns a string representation of this instance.
ToXmlString | Exports the DSA key to an XML string.
VerifySignature | Verifies a signature for a specified hash value.

See Also

Project CorLib Overview

Class DSA Overview

DSACryptoServiceProvider


DSA: Clear

Clear

Releases any resources used by the current object.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class DSA Overview


DSA: CreateSignature

CreateSignature

Creates a signature for a hash value.

 Public Function CreateSignature(
      ByRef RgbHash ( ) As Byte ) As Byte ( ) :

Parameters

RgbHash
[ByRef] Byte. The hash value to create a signature for.

Return Values

Byte() - The signature created for the hash value.

See Also

Project CorLib Overview

Class DSA Overview


DSA: Equals

Equals

Returns if the value and the object are equal.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to check for equality.

Return Values

Boolean - Returns True if the value and instance are equal, False otherwise.

See Also

Project CorLib Overview

Class DSA Overview


DSA: ExportParameters

ExportParameters

Exports the DSA key in a DSAParameters object.

 Public Function ExportParameters(
      ByVal IncludePrivateParameters As Boolean ) As DSAParameters

Parameters

IncludePrivateParameters
[ByVal] Boolean. A flag indicating if the private portion of the key should be exported.

Return Values

DSAParameters - A DSAParamters object containing the exported key.

See Also

Project CorLib Overview

Class DSA Overview


DSA: FromXmlString

FromXmlString

Imports a DSA key from an XML string.

 Public Sub FromXmlString(
      ByRef XmlString As String )

Parameters

XmlString
[ByRef] String. The XML string containing the DSA key information.

See Also

Project CorLib Overview

Class DSA Overview


DSA: GetHashCode

GetHashCode

Returns a semi-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A semi-unique number.

See Also

Project CorLib Overview

Class DSA Overview


DSA: ImportParameters

ImportParameters

Imports a DSA key from a DSAParameters object.

 Public Sub ImportParameters(
      ByVal Parameters As DSAParameters )

Parameters

Parameters
[ByVal] DSAParameters. The parameters object to import the key from.

See Also

Project CorLib Overview

Class DSA Overview


DSA: KeyExchangeAlgorithm (get)

KeyExchangeAlgorithm

Gets the name of the Key Exchange algorithm.

 Public Property Get KeyExchangeAlgorithm ( ) As String

Return Values

String - The name of the algorithm.

Read Only.

See Also

Project CorLib Overview

Class DSA Overview


DSA: KeySize (get)

KeySize

Gets the key size for the current implementation.

 Public Property Get KeySize ( ) As Long

Return Values

Long - Returns the current key size in bits.

Read/Write.

See Also

Project CorLib Overview

Class DSA Overview


DSA: KeySize (let)

KeySize

Sets the key size for the current implementation.

 Public Property Let KeySize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The new key size in bits.

Read/Write.

See Also

Project CorLib Overview

Class DSA Overview


DSA: LegalKeySizes (get)

LegalKeySizes

Gets a set of valid key sizes represented as KeySizes objects.

 Public Property Get LegalKeySizes ( ) As KeySizes ( ) :

Return Values

KeySizes() - An array of KeySizes objects.

Read Only.

See Also

Project CorLib Overview

Class DSA Overview


DSA: SignatureAlgorithm (get)

SignatureAlgorithm

Gets the name of the signature algorithm.

 Public Property Get SignatureAlgorithm ( ) As String

Return Values

String - The name of the signature algorithm.

Read Only.

See Also

Project CorLib Overview

Class DSA Overview


DSA: ToString

ToString

Returns a string representation of this instance.

 Public Function ToString ( ) As String

Return Values

String - A string representation of this instance.

See Also

Project CorLib Overview

Class DSA Overview


DSA: ToXmlString

ToXmlString

Exports the DSA key to an XML string.

 Public Function ToXmlString(
      ByVal IncludePrivateParameters As Boolean ) As String

Parameters

IncludePrivateParameters
[ByVal] Boolean. A flag indicating if the private portion of the key should be exported.

Return Values

String - An XML string of the DSA key.

See Also

Project CorLib Overview

Class DSA Overview


DSA: VerifySignature

VerifySignature

Verifies a signature for a specified hash value.

 Public Function VerifySignature(
      ByRef RgbHash ( ) As Byte,
      ByRef RgbSignature ( ) As Byte ) As Boolean

Parameters

RgbHash
[ByRef] Byte. The value the signature was created for.
RgbSignature
[ByRef] Byte. The signature to be verified.

Return Values

Boolean - Returns True if the signature is for the hash value, False otherwise.

See Also

Project CorLib Overview

Class DSA Overview


DSACryptoServiceProvider

DSACryptoServiceProvider

Provides a wrapper to access a DSA crypto service provider.

Implements:

AsymmetricAlgorithm
DSA
ICspAsymmetricAlgorithm
IObject

Public:

Properties:

Name | Description
CspKeyContainerInfo (get) | Returns a CspKeyContainerInfo object containing information about this DSACryptoServiceProvider instance.
KeyExchangeAlgorithm (get) | Returns the name of the key exchange algorithm this instance represents.
KeySize (get) | Returns the DSA key size in bits.
KeySize (let) | Sets the key size.
LegalKeySizes (get) | Returns an array of KeySizes objects defining the valid key sizes.
PersistKeyInCsp (get) | Returns if the current key will be stored in the current provider container.
PersistKeyInCsp (let) | Sets if the current key will be stored in the current provider container.
PublicOnly (get) | Returns if the key for this DSA instance is only the public half of the key pair.
SignatureAlgorithm (get) | Returns the signature algorithm.

Methods:

Name | Description
Clear | Releases any resources and disposes the DSA instance.
CreateSignature | Creates a new signature for the hash value.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
ExportCspBlob | Exports the key information as a CryptoAPI PRIVATEKEYBLOB or PUBLICKEYBLOB structure.
ExportParameters | Exports the DSA key parameters.
FromXmlString | Imports a DSA key in the form of an XML string.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function. An override might be necessary if the hashcode should be derived from a value contained within the class.
ImportCspBlob | Imports a CryptoAPI PRIVATEKEYBLOB or PUBLICKEYBLOB into the DSA provider.
ImportParameters | Imports the DSA key parameters.
SignData | Creates a signature for a Stream object or Byte array.
SignHash | Creates a signature for a hash value.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides. A Person class may return the persons name instead.
ToXmlString | Exports the DSA key as an XML string.
VerifyData | Verifies the signature for the specified data.
VerifyHash | Verifies the signature for the specified hash value.
VerifySignature | Verifies the signature for the hash value.

Remarks

This class is used to create signatures for data and hashes and provide verification of those signatures generated.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: AsymmetricAlgorithm

AsymmetricAlgorithm

 Implements AsymmetricAlgorithm

Return Values

AsymmetricAlgorithm -

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: Clear

Clear

Releases any resources and disposes the DSA instance.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: CreateSignature

CreateSignature

Creates a new signature for the hash value.

 Public Function CreateSignature(
      ByRef RgbHash ( ) As Byte ) As Byte ( )

Parameters

RgbHash
[ByRef] Byte. The hash value to be signed.

Return Values

Byte() - The hash value signature.

Remarks

Only SHA1 hash values are supported.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: CspKeyContainerInfo (get)

CspKeyContainerInfo

Returns a CspKeyContainerInfo object containing information about this DSACryptoServiceProvider instance.

 Public Property Get CspKeyContainerInfo ( ) As CspKeyContainerInfo

Return Values

CspKeyContainerInfo - A CspKeyContainerInfo object.

Read Only.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: DSA

DSA

 Implements DSA

Return Values

DSA -

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test equality on.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview

IObject


DSACryptoServiceProvider: ExportCspBlob

ExportCspBlob

Exports the key information as a CryptoAPI PRIVATEKEYBLOB or PUBLICKEYBLOB structure.

 Public Function ExportCspBlob(
      ByVal IncludePrivateParameters As Boolean ) As Byte ( )

Parameters

IncludePrivateParameters
[ByVal] Boolean. A flag indicating if only the public key should be exported or is both the public and private keys should be exported.

Return Values

Byte() - A exported key blob structure.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: ExportParameters

ExportParameters

Exports the DSA key parameters.

 Public Function ExportParameters(
      ByVal IncludePrivateParameters As Boolean ) As DSAParameters

Parameters

IncludePrivateParameters
[ByVal] Boolean. A flag indicating if only the public key should be exported or is both the public and private keys should be exported.

Return Values

DSAParameters - An DSAParameters object containing the parameters of the DSA algorithms.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: FromXmlString

FromXmlString

Imports a DSA key in the form of an XML string.

 Public Sub FromXmlString(
      ByRef XmlString As String )

Parameters

XmlString
[ByRef] String. The XML string containing the key information.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

An override might be necessary if the hashcode should be derived from a value contained within the class.

 Public Function GetHashCode ( ) As Long

Return Values

Long -

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: ICspAsymmetricAlgorithm

ICspAsymmetricAlgorithm

 Implements ICspAsymmetricAlgorithm

Return Values

ICspAsymmetricAlgorithm -

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: ImportCspBlob

ImportCspBlob

Imports a CryptoAPI PRIVATEKEYBLOB or PUBLICKEYBLOB into the DSA provider.

 Public Sub ImportCspBlob(
      ByRef KeyBlob ( ) As Byte )

Parameters

KeyBlob
[ByRef] Byte. The blob key to be imported.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: ImportParameters

ImportParameters

Imports the DSA key parameters.

 Public Sub ImportParameters(
      ByVal Parameters As DSAParameters )

Parameters

Parameters
[ByVal] DSAParameters. The parameters to be imported as the new key.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: KeyExchangeAlgorithm (get)

KeyExchangeAlgorithm

Returns the name of the key exchange algorithm this instance represents.

 Public Property Get KeyExchangeAlgorithm ( ) As String

Return Values

String - The name of the key exchange algorithm.

Remarks

DSACryptoServiceProvider always returns an empty string.

Read Only.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: KeySize (get)

KeySize

Returns the DSA key size in bits.

 Public Property Get KeySize ( ) As Long

Return Values

Long - The key size in bits being used by this DSA instance.

Remarks

By default, the key size is 1024 for high encryption and 512 for base encryption providers.

Read/Write.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: KeySize (let)

KeySize

Sets the key size.

 Public Property Let KeySize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new key size.

Remarks

This property has no affect on the key size. To set the key size, use the Cor.NewDSACryptoServiceProvider constructor.

Read/Write.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: LegalKeySizes (get)

LegalKeySizes

Returns an array of KeySizes objects defining the valid key sizes.

 Public Property Get LegalKeySizes ( ) As KeySizes ( )

Return Values

KeySizes() - An array of KeySizes objects.

Remarks

For high encryption systems, the legal key sizes go from 384 bits to 16384 bits in steps of 8 bits. For base encryption systems, the key sizes go from 384 bits to 512 bits in steps of 8 bits.

Read Only.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: PersistKeyInCsp (get)

PersistKeyInCsp

Returns if the current key will be stored in the current provider container.

 Public Property Get PersistKeyInCsp ( ) As Boolean

Return Values

Boolean - Returns True if the key will be stored, False otherwise.

Remarks

By default this is set to False. If a container is specified using the Cor.NewDSACryptoServiceProvider, then this will be set to True.

A key is stored in the container to allow for each retrieval by any other service that knows where the key is. Only 1 key is stored in a container, therefore, if multiple providers share the same container, then the key may become invalid.

Read/Write.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: PersistKeyInCsp (let)

PersistKeyInCsp

Sets if the current key will be stored in the current provider container.

 Public Property Let PersistKeyInCsp(
      ByVal Value As Boolean )

Parameters

Value
[ByVal] Boolean. Set to True to save the key on exit, False to have the key be deleted.

Remarks

By default this is set to False. If a container is specified using the Cor.NewDSACryptoServiceProvider, then this will be set to True.

A key is stored in the container to allow for each retrieval by any other service that knows where the key is. Only 1 key is stored in a container, therefore, if multiple providers share the same container, then the key may become invalid.

Read/Write.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: PublicOnly (get)

PublicOnly

Returns if the key for this DSA instance is only the public half of the key pair.

 Public Property Get PublicOnly ( ) As Boolean

Return Values

Boolean - Returns True if only the public half of the key is present, False otherwise.

Remarks

DSA uses a private/public key pair to encrypt and decrypt. Only the public part is required to encrypt data. The private key is used to decrypt data.

Read Only.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: SignatureAlgorithm (get)

SignatureAlgorithm

Returns the signature algorithm.

 Public Property Get SignatureAlgorithm ( ) As String

Return Values

String - Always returns http://www.w3.org/2000/09/xmldsig#DSA-sha1'

Read Only.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: SignData

SignData

Creates a signature for a Stream object or Byte array.

 Public Function SignData(
      ByRef InputStreamOrBuffer As Variant,
      Optional ByRef Offset As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

InputStreamOrBuffer
[ByRef] Variant. The input source to be signed. This can be any Stream object or Byte array.
Offset
[ByRef] Optional. Variant. The starting index of the Byte array to begin processing. This is only applied to a Byte array.
Count
[ByRef] Optional. Variant. The number of bytes to be processed. This is only applied to a Byte array.

Return Values

Byte() - A byte array representing the signature for the data.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: SignHash

SignHash

Creates a signature for a hash value.

 Public Function SignHash(
      ByRef RgbHash ( ) As Byte,
      ByRef Str As String ) As Byte ( )

Parameters

RgbHash
[ByRef] Byte. The hash to create a signature for.
Str
[ByRef] String. The type of hash used to create the hash value.

Return Values

Byte() - A byte array representing the signature for the hash value.

Remarks

Only SHA1 hash values are supported.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

A Person class may return the persons name instead.

 Public Function ToString ( ) As String

Return Values

String -

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: ToXmlString

ToXmlString

Exports the DSA key as an XML string.

 Public Function ToXmlString(
      ByVal IncludePrivateParameters As Boolean ) As String

Parameters

IncludePrivateParameters
[ByVal] Boolean. A flag indicating if the private portions of the key should be exported as well.

Return Values

String - An XML string representation of the DSA key.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: VerifyData

VerifyData

Verifies the signature for the specified data.

 Public Function VerifyData(
      ByRef RgbData ( ) As Byte,
      ByRef Signature ( ) As Byte ) As Boolean

Parameters

RgbData
[ByRef] Byte. The data to verify the signature of.
Signature
[ByRef] Byte. The signature to be verified.

Return Values

Boolean - Returns True if the signature if valid for the data, False otherwise.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: VerifyHash

VerifyHash

Verifies the signature for the specified hash value.

 Public Function VerifyHash(
      ByRef RgbHash ( ) As Byte,
      ByRef Str As String,
      ByRef Signature ( ) As Byte ) As Boolean

Parameters

RgbHash
[ByRef] Byte. The hash value to verify the signature of.
Str
[ByRef] String. The type of hash used to create the hash value.
Signature
[ByRef] Byte. The signature to be verified.

Return Values

Boolean - Returns True if the signature is valid for the hash value, False otherwise.

Remarks

Only SHA1 hash values are supported.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSACryptoServiceProvider: VerifySignature

VerifySignature

Verifies the signature for the hash value.

 Public Function VerifySignature(
      ByRef RgbHash ( ) As Byte,
      ByRef RgbSignature ( ) As Byte ) As Boolean

Parameters

RgbHash
[ByRef] Byte. The hash value to verify the signature of.
RgbSignature
[ByRef] Byte. The signature to be verified.

Return Values

Boolean - Returns True if the signature if valid, False otherwise.

Remarks

Only SHA1 hash values are supported.

See Also

Project CorLib Overview

Class DSACryptoServiceProvider Overview


DSAParameters

DSAParameters

Represents the DSA key parameters.

Implements:

IObject

Public:

Properties:

Name | Description
Counter (get) | Gets the Counter value for the DSA key.
Counter (let) | Sets the Counter value for the DSA key.
g (get) | Gets the G parameter of the key.
g (let) | Sets the G parameter of the key.
j (get) | Gets the J parameter of the key.
j (let) | Sets the J parameter of the key.
p (get) | Gets the P parameter of the key.
p (let) | Sets the P parameter of the key.
q (get) | Gets the Q parameter of the key.
q (let) | Sets the Q parameter of the key.
seed (get) | Gets the Seed of the key.
seed (let) | Sets the Seed for the key.
x (get) | Gets the X parameter of the key.
x (let) | Sets the X parameter of the key.
y (get) | Gets the Y parameter of the key.
y (let) | Sets the Y parameter of the key.

Methods:

Name | Description
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
ToString | Returns a string representation of this object instance.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: Counter (get)

Counter

Gets the Counter value for the DSA key.

 Public Property Get Counter ( ) As Long

Return Values

Long - Returns the Counter value.

Read/Write.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: Counter (let)

Counter

Sets the Counter value for the DSA key.

 Public Property Let Counter(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new Counter value.

Read/Write.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: g (get)

g

Gets the G parameter of the key.

 Public Property Get g ( ) As Byte ( )

Return Values

Byte() - The G parameter.

Read/Write.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: g (let)

g

Sets the G parameter of the key.

 Public Property Let g(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new G value.

Read/Write.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: j (get)

j

Gets the J parameter of the key.

 Public Property Get j ( ) As Byte ( )

Return Values

Byte() - The J parameter.

Read/Write.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: j (let)

j

Sets the J parameter of the key.

 Public Property Let j(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new J parameter.

Read/Write.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: p (get)

p

Gets the P parameter of the key.

 Public Property Get p ( ) As Byte ( )

Return Values

Byte() - The P parameter.

Read/Write.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: p (let)

p

Sets the P parameter of the key.

 Public Property Let p(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new P parameter.

Read/Write.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: q (get)

q

Gets the Q parameter of the key.

 Public Property Get q ( ) As Byte ( )

Return Values

Byte() - The Q parameter.

Read/Write.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: q (let)

q

Sets the Q parameter of the key.

 Public Property Let q(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new Q parameter.

Read/Write.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: seed (get)

seed

Gets the Seed of the key.

 Public Property Get seed ( ) As Byte ( )

Return Values

Byte() - The Seed value.

Read/Write.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: seed (let)

seed

Sets the Seed for the key.

 Public Property Let seed(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new Seed value.

Read/Write.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: x (get)

x

Gets the X parameter of the key.

 Public Property Get x ( ) As Byte ( )

Return Values

Byte() - The X parameter.

Read/Write.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: x (let)

x

Sets the X parameter of the key.

 Public Property Let x(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new X parameter.

Read/Write.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: y (get)

y

Gets the Y parameter of the key.

 Public Property Get y ( ) As Byte ( )

Return Values

Byte() - The Y parameter.

Read/Write.

See Also

Project CorLib Overview

Class DSAParameters Overview


DSAParameters: y (let)

y

Sets the Y parameter of the key.

 Public Property Let y(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new Y parameter.

Read/Write.

See Also

Project CorLib Overview

Class DSAParameters Overview


Encoder

Encoder

Provides an interface for encoding unicode characters into bytes.

Public:

Properties:

Name | Description
Fallback (get) | Returns an EncoderFallback object for the current Encoder object.
Fallback (set) | Sets an EncoderFallback object instance for the current Encoder object.
FallbackBuffer (get) | Return an EncoderFallbackBuffer object associated with current Encoder object.

Methods:

Name | Description
Convert | Converts an array of Unicode characters to an encoded byte sequence and stores the result in an array of bytes.
Equals | Used to determine if to objects are of equal value.
GetByteCount | Returns the number of encoded bytes the set of characters would produce.
GetBytes | Returns the encoded bytes generated from a set of unicode characters.
GetHashCode | Returns a pseudo-unique number to identify this instance.
Reset | Clears the internal state of the encoder.
ToString | Returns a string representation of this instance.

See Also

Project CorLib Overview

Class Encoder Overview


Encoder: Convert

Convert

Converts an array of Unicode characters to an encoded byte sequence and stores the result in an array of bytes.

 Public Sub Convert(
      ByRef Chars ( ) As Integer,
      ByVal CharIndex As Long,
      ByVal CharCount As Long,
      ByRef Bytes ( ) As Byte,
      ByVal ByteIndex As Long,
      ByVal ByteCount As Long,
      ByVal Flush As Boolean,
      ByRef CharsUsed As Long,
      ByRef BytesUsed As Long,
      ByRef Completed As Boolean )

Parameters

Chars
[ByRef] Integer. An array of characters to be converted.
CharIndex
[ByVal] Long. The starting position to be converting in the Chars array.
CharCount
[ByVal] Long. The number of characters to be converted.
Bytes
[ByRef] Byte. An array to received the converted characters.
ByteIndex
[ByVal] Long. The starting position to begin receiving converted characters.
ByteCount
[ByVal] Long. The number of bytes in the received buffer to be used.
Flush
[ByVal] Boolean. True if the characters have finished being converted; otherwise False.
CharsUsed
[ByRef] Long. The number characters actually converted from the Chars array.
BytesUsed
[ByRef] Long. The number bytes used for the encoding of the characters.
Completed
[ByRef] Boolean. True if the specificed CharCount had been reached in the conversion; otherwise False.

See Also

Project CorLib Overview

Class Encoder Overview


Encoder: Equals

Equals

Used to determine if to objects are of equal value.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. An object to be compared to this instance for equality.

Return Values

Boolean - An indication of equality.

See Also

Project CorLib Overview

Class Encoder Overview


Encoder: Fallback (get)

Fallback

Returns an EncoderFallback object for the current Encoder object.

 Public Property Get Fallback ( ) As EncoderFallback

Return Values

EncoderFallback - The EncoderFallback associated with the current Encoder object.

Read/Write.

See Also

Project CorLib Overview

Class Encoder Overview


Encoder: Fallback (set)

Fallback

Sets an EncoderFallback object instance for the current Encoder object.

 Public Property Set Fallback(
      ByVal Value As EncoderFallback ) :

Parameters

Value
[ByVal] EncoderFallback. The EncoderFallback object to be associated with the current Encoder object.

Read/Write.

See Also

Project CorLib Overview

Class Encoder Overview


Encoder: FallbackBuffer (get)

FallbackBuffer

Return an EncoderFallbackBuffer object associated with current Encoder object.

 Public Property Get FallbackBuffer ( ) As EncoderFallbackBuffer

Return Values

EncoderFallbackBuffer - The EncoderFallbackBuffer object associated with the current Encoder object.

Read Only.

See Also

Project CorLib Overview

Class Encoder Overview


Encoder: GetByteCount

GetByteCount

Returns the number of encoded bytes the set of characters would produce.

 Public Function GetByteCount(
      ByRef Chars ( ) As Integer,
      ByVal Index As Long,
      ByVal Count As Long,
      ByVal Flush As Boolean ) As Long

Parameters

Chars
[ByRef] Integer. The set of characters that would be used to produce the encoded bytes.
Index
[ByVal] Long. The first character in the array to begin the encoding count.
Count
[ByVal] Long. The number of characters to be included in the encoding count.
Flush
[ByVal] Boolean. True to simulate clearing the internal state of the encoder after the calculation; otherwise, False.

Return Values

Long - The number of bytes produced by encoding the specified characters and any characters in the internal buffer.

Remarks

This method does not affect the state of the encoder.

To calculate the exact array size that GetBytes requires to store the resulting bytes, the application should use GetByteCount.

If GetBytes is called with Flush set to False, the encoder stores trailing characters at the end of the data block in an internal buffer and uses them in the next encoding operation. The application should call GetByteCount on a block of data immediately before calling GetBytes on the same block, so that any trailing characters from the previous block are included in the calculation.

See Also

Project CorLib Overview

Class Encoder Overview


Encoder: GetBytes

GetBytes

Returns the encoded bytes generated from a set of unicode characters.

 Public Function GetBytes(
      ByRef Chars ( ) As Integer,
      ByVal CharIndex As Long,
      ByVal CharCount As Long,
      ByRef Bytes ( ) As Byte,
      ByVal ByteIndex As Long,
      ByVal Flush As Boolean ) As Long

Parameters

Chars
[ByRef] Integer. The unicode characters to be encoded.
CharIndex
[ByVal] Long. The character to begin encoding at.
CharCount
[ByVal] Long. The number of characters to be used in the encoding process.
Bytes
[ByRef] Byte. The encoded set of bytes produced from encoding Chars.
ByteIndex
[ByVal] Long. The starting position in the array to place the encoded bytes.
Flush
[ByVal] Boolean. Indicates if the Encoder should maintain state between calls.

Return Values

Long - The number of bytes actually produced from the encoding.

See Also

Project CorLib Overview

Class Encoder Overview


Encoder: GetHashCode

GetHashCode

Returns a pseudo-unique number to identify this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A pseudo-unique number to identify this instance.

See Also

Project CorLib Overview

Class Encoder Overview


Encoder: Reset

Reset

Clears the internal state of the encoder.

 Public Sub Reset ( )

See Also

Project CorLib Overview

Class Encoder Overview


Encoder: ToString

ToString

Returns a string representation of this instance.

 Public Function ToString ( ) As String

Return Values

String - A string that describes this object instance.

See Also

Project CorLib Overview

Class Encoder Overview


EncoderExceptionFallback

EncoderExceptionFallback

Returns an encoder fallback buffer that throws an exception if it cannot convert a character sequence to a byte sequence.

Implements:

EncoderFallback
IObject

Public:

Properties:

Name | Description
MaxCharCount (get) | Gets the maximum number of characters this instance can return.

Methods:

Name | Description
CreateFallbackBuffer |
Equals | Determines whether the specified value passed in is equal to the current object.
GetHashCode | Serves as the default hash function.
ToString | Returns a string that represents the current object.

See Also

Project CorLib Overview

Class EncoderExceptionFallback Overview


EncoderExceptionFallback: EncoderFallback

EncoderFallback

 Implements EncoderFallback

Return Values

EncoderFallback -

See Also

Project CorLib Overview

Class EncoderExceptionFallback Overview


EncoderExceptionFallback: Equals

Equals

Determines whether the specified value passed in is equal to the current object.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare to the current object.

Return Values

Boolean - True if the specified value is equal to the current object; otherwise, False.

See Also

Project CorLib Overview

Class EncoderExceptionFallback Overview

IObject


EncoderExceptionFallback: GetHashCode

GetHashCode

Serves as the default hash function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A hash code for the current object.

See Also

Project CorLib Overview

Class EncoderExceptionFallback Overview

IObject


EncoderExceptionFallback: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class EncoderExceptionFallback Overview


EncoderExceptionFallback: MaxCharCount (get)

MaxCharCount

Gets the maximum number of characters this instance can return.

 Public Property Get MaxCharCount ( ) As Long

Return Values

Long - This always returns zero.

Read Only.

See Also

Project CorLib Overview

Class EncoderExceptionFallback Overview


EncoderExceptionFallback: ToString

ToString

Returns a string that represents the current object.

 Public Function ToString ( ) As String

Return Values

String - A string the represents the current object.

See Also

Project CorLib Overview

Class EncoderExceptionFallback Overview

IObject


EncoderExceptionFallbackBuffer

EncoderExceptionFallbackBuffer

Throws EncoderFallbackException when an input character cannot be converted to an encoded output byte sequence.

Implements:

EncoderFallbackBuffer
IObject

Public:

Properties:

Name | Description
Remaining (get) | Gets the number of characters in the current EncoderExceptionFallbackBuffer object that remain to be processed.

Methods:

Name | Description
Equals | Determines whether the specified value passed in is equal to the current object.
Fallback | Throws an exception because the input character cannot be encoded. Parameters specify the value and index position of the surrogate pair in the input, and the nominal return value is not used.
GetHashCode | Serves as the default hash function.
GetNextChar | Retrieves the next character in the exception fallback buffer.
MovePrevious | Causes the next call to the GetNextChar method to access the exception data buffer character position that is prior to the current position.
Reset | Initializes all data and state information pertaining to this fallback buffer.
ToString | Returns a string that represents the current object.

See Also

Project CorLib Overview

Class EncoderExceptionFallbackBuffer Overview


EncoderExceptionFallbackBuffer: EncoderFallbackBuffer

EncoderFallbackBuffer

 Implements EncoderFallbackBuffer

Return Values

EncoderFallbackBuffer -

See Also

Project CorLib Overview

Class EncoderExceptionFallbackBuffer Overview


EncoderExceptionFallbackBuffer: Equals

Equals

Determines whether the specified value passed in is equal to the current object.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare to the current object.

Return Values

Boolean - True if the specified value is equal to the current object; otherwise, False.

See Also

Project CorLib Overview

Class EncoderExceptionFallbackBuffer Overview

IObject


EncoderExceptionFallbackBuffer: Fallback

Fallback

Throws an exception because the input character cannot be encoded. Parameters specify the value and index position of the surrogate pair in the input, and the nominal return value is not used.

 Public Function Fallback(
      ByVal UnknownCharOrHighSurrogate As Long,
      Optional ByRef UnknownLowSurrogate As Variant,
      Optional ByVal Index As Long ) As Boolean

Parameters

UnknownCharOrHighSurrogate
[ByVal] Long. The high surrogate of the input pair.
UnknownLowSurrogate
[ByRef] Optional. Variant. The low surrogate of the input pair.
Index
[ByVal] Optional. Long. The index position of the surrogate pair in the input buffer.

Return Values

Boolean - None. No value is returned because the Fallback method always throws an exception.

Exceptions

Exception | Condition
EncoderFallbackException | The character represented by UnknownCharOrHighSurrogate and UnknownLowSurrogate cannot be encoded.
ArgumentOutOfRangeException | Either UnknownCharOrHighSurrogate or UnknownLowSurrogate is invalid.

See Also

Project CorLib Overview

Class EncoderExceptionFallbackBuffer Overview


EncoderExceptionFallbackBuffer: GetHashCode

GetHashCode

Serves as the default hash function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A hash code for the current object.

See Also

Project CorLib Overview

Class EncoderExceptionFallbackBuffer Overview

IObject


EncoderExceptionFallbackBuffer: GetNextChar

GetNextChar

Retrieves the next character in the exception fallback buffer.

 Public Function GetNextChar ( ) As Integer

Return Values

Integer - The return value is always the Unicode character, NULL (U+0000).

See Also

Project CorLib Overview

Class EncoderExceptionFallbackBuffer Overview


EncoderExceptionFallbackBuffer: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class EncoderExceptionFallbackBuffer Overview


EncoderExceptionFallbackBuffer: MovePrevious

MovePrevious

Causes the next call to the GetNextChar method to access the exception data buffer character position that is prior to the current position.

 Public Function MovePrevious ( ) As Boolean

Return Values

Boolean - The return value is always False.

See Also

Project CorLib Overview

Class EncoderExceptionFallbackBuffer Overview


EncoderExceptionFallbackBuffer: Remaining (get)

Remaining

Gets the number of characters in the current EncoderExceptionFallbackBuffer object that remain to be processed.

 Public Property Get Remaining ( ) As Long

Return Values

Long - The return value is always zero.

Read Only.

See Also

Project CorLib Overview

Class EncoderExceptionFallbackBuffer Overview


EncoderExceptionFallbackBuffer: Reset

Reset

Initializes all data and state information pertaining to this fallback buffer.

 Public Sub Reset ( )

See Also

Project CorLib Overview

Class EncoderExceptionFallbackBuffer Overview


EncoderExceptionFallbackBuffer: ToString

ToString

Returns a string that represents the current object.

 Public Function ToString ( ) As String

Return Values

String - A string the represents the current object.

See Also

Project CorLib Overview

Class EncoderExceptionFallbackBuffer Overview

IObject


EncoderFallback

EncoderFallback

Provides a failure-handling mechanism, called a fallback, for an input character that cannot be converted to an encoded output byte sequence.

Public:

Properties:

Name | Description
MaxCharCount (get) | When implemented in a derived class, gets the maximum number of characters the current EncoderFallback object can return.

Methods:

Name | Description
CreateFallbackBuffer | When implemented in a derived class, initializes a new instance of the EncoderFallbackBuffer class.
Equals | Determines whether the specified value passed in is equal to the current object.
GetHashCode | Serves as the default hash function.
ToString | Returns a string that represents the current object.

See Also

Project CorLib Overview

Class EncoderFallback Overview

EncoerFallbackStatic

EncoderExceptionFallback

EncoderReplacementFallback


EncoderFallback: CreateFallbackBuffer

CreateFallbackBuffer

When implemented in a derived class, initializes a new instance of the EncoderFallbackBuffer class.

 Public Function CreateFallbackBuffer ( ) As EncoderFallbackBuffer

Return Values

EncoderFallbackBuffer - An object that provides a fallback buffer for an encoder.

Remarks

This method returns an object derived from EncoderFallbackBuffer that is responsible for performing the fallback operation. For example, of the predefined EncoderFallback implementations in VBCorLib, the EncoderReplacementFallback.CreateFallbackBuffer method returns an EncoderReplacementFallbackBuffer object, and the EncoderExceptionFallback.CreateFallbackBuffer method returns an EncoderExceptionFallbackBuffer object.

See Also

Project CorLib Overview

Class EncoderFallback Overview


EncoderFallback: Equals

Equals

Determines whether the specified value passed in is equal to the current object.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare to the current object.

Return Values

Boolean - True if the specified value is equal to the current object; otherwise, False.

See Also

Project CorLib Overview

Class EncoderFallback Overview

IObject


EncoderFallback: GetHashCode

GetHashCode

Serves as the default hash function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A hash code for the current object.

See Also

Project CorLib Overview

Class EncoderFallback Overview

IObject


EncoderFallback: MaxCharCount (get)

MaxCharCount

When implemented in a derived class, gets the maximum number of characters the current EncoderFallback object can return.

 Public Property Get MaxCharCount ( ) As Long

Return Values

Long - The maximum number of characters the current EncoderFallback object can return.

Remarks

For an exception fallback handler, this property should return zero.

Read Only.

See Also

Project CorLib Overview

Class EncoderFallback Overview


EncoderFallback: ToString

ToString

Returns a string that represents the current object.

 Public Function ToString ( ) As String

Return Values

String - A string the represents the current object.

See Also

Project CorLib Overview

Class EncoderFallback Overview

IObject


EncoderFallbackBuffer

EncoderFallbackBuffer

Provides a buffer that allows a fallback handler to return an alternate string to an encoder when it cannot encode an input character.

Public:

Properties:

Name | Description
Remaining (get) | When implemented in a derived class, gets the number of characters in the current EncoderFallbackBuffer object that remain to be processed.

Methods:

Name | Description
Equals | Determines whether the specified value passed in is equal to the current object.
Fallback | When overridden in a derived class, prepares the fallback buffer to handle the specified surrogate pair.
GetHashCode | Serves as the default hash function.
GetNextChar | When implemented in a derived class, retrieves the next character in the fallback buffer.
MovePrevious | When implemented in a derived class, causes the next call to the GetNextChar method to access the data buffer character position that is prior to the current character position.
Reset | Initializes all data and state information pertaining to this fallback buffer.
ToString | Returns a string that represents the current object.

See Also

Project CorLib Overview

Class EncoderFallbackBuffer Overview


EncoderFallbackBuffer: Equals

Equals

Determines whether the specified value passed in is equal to the current object.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare to the current object.

Return Values

Boolean - True if the specified value is equal to the current object; otherwise, False.

See Also

Project CorLib Overview

Class EncoderFallbackBuffer Overview

IObject


EncoderFallbackBuffer: Fallback

Fallback

When overridden in a derived class, prepares the fallback buffer to handle the specified surrogate pair.

 Public Function Fallback(
      ByVal UnknownCharOrHighSurrogate As Long,
      Optional ByRef UnknownLowSurrogate As Variant,
      Optional ByVal Index As Long ) As Boolean

Parameters

UnknownCharOrHighSurrogate
[ByVal] Long. Can be a non-surrogate charactor or a high surrogate of a surrogate pair.
UnknownLowSurrogate
[ByRef] Optional. Variant. The low surrogate matched with the high surrogate of the surrogate pair.
Index
[ByVal] Optional. Long. The index position of the surrogate pair in the input buffer.

Return Values

Boolean - True if the fallback buffer can process UnknownCharOrHighSurrogate as a non-surrogate or process UnknownCharOrHighSurrogate and LowSurrogate as a surrogate pair; False if the fallback buffer ignores the characters.

See Also

Project CorLib Overview

Class EncoderFallbackBuffer Overview


EncoderFallbackBuffer: GetHashCode

GetHashCode

Serves as the default hash function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A hash code for the current object.

See Also

Project CorLib Overview

Class EncoderFallbackBuffer Overview

IObject


EncoderFallbackBuffer: GetNextChar

GetNextChar

When implemented in a derived class, retrieves the next character in the fallback buffer.

 Public Function GetNextChar ( ) As Integer

Return Values

Integer - The next character in the fallback buffer.

See Also

Project CorLib Overview

Class EncoderFallbackBuffer Overview


EncoderFallbackBuffer: MovePrevious

MovePrevious

When implemented in a derived class, causes the next call to the GetNextChar method to access the data buffer character position that is prior to the current character position.

 Public Function MovePrevious ( ) As Boolean

Return Values

Boolean - True if the MovePrevious operation was successful; otherwise, False.

See Also

Project CorLib Overview

Class EncoderFallbackBuffer Overview


EncoderFallbackBuffer: Remaining (get)

Remaining

When implemented in a derived class, gets the number of characters in the current EncoderFallbackBuffer object that remain to be processed.

 Public Property Get Remaining ( ) As Long

Return Values

Long - The number of characters in the current fallback buffer that have not yet been processed.

Remarks

The Fallback method returns True if Remaining is a nonzero value. For an exception fallback handler, the Remaining method should return zero.

Read Only.

See Also

Project CorLib Overview

Class EncoderFallbackBuffer Overview


EncoderFallbackBuffer: Reset

Reset

Initializes all data and state information pertaining to this fallback buffer.

 Public Sub Reset ( )

Remarks

After calling the Reset method, the Remaining property should return 0, the GetNextChar method should return U+0000, and the MovePrevious method should return False.

See Also

Project CorLib Overview

Class EncoderFallbackBuffer Overview


EncoderFallbackBuffer: ToString

ToString

Returns a string that represents the current object.

 Public Function ToString ( ) As String

Return Values

String - A string the represents the current object.

See Also

Project CorLib Overview

Class EncoderFallbackBuffer Overview

IObject


EncoderFallbackException

EncoderFallbackException

The exception that is thrown when an encoder fallback operation fails. This class cannot be inherited.

Implements:

ArgumentException
Exception
IObject
SystemException

Public:

Properties:

Name | Description
CharUnknown (get) | Gets the unknown character that caused the exception.
CharUnknownHigh (get) | Gets the unknown high character of the surrogate pair that caused the exception.
CharUnknownLow (get) | Gets the unknown low character of the surrogate pair that caused the exception.
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
Index (get) | Gets the position of the character that the encoding failed.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
ParamName (get) | Returns the parameter name that caused the exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: ArgumentException

ArgumentException

 Implements ArgumentException

Return Values

ArgumentException -

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: CharUnknown (get)

CharUnknown

Gets the unknown character that caused the exception.

 Public Property Get CharUnknown ( ) As Integer

Return Values

Integer - The character that cannot be encoded.

Read Only.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: CharUnknownHigh (get)

CharUnknownHigh

Gets the unknown high character of the surrogate pair that caused the exception.

 Public Property Get CharUnknownHigh ( ) As Integer

Return Values

Integer - The high surrogate character that cannot be encoded.

Read Only.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: CharUnknownLow (get)

CharUnknownLow

Gets the unknown low character of the surrogate pair that caused the exception.

 Public Property Get CharUnknownLow ( ) As Integer

Return Values

Integer - The low surrogate character that cannot be encoded.

Read Only.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Read Only.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview

Exception


EncoderFallbackException: Index (get)

Index

Gets the position of the character that the encoding failed.

 Public Property Get Index ( ) As Long

Return Values

Long - The the position of the character that cannot be encoded.

Read Only.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewArgumentException.

Read Only.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: ParamName (get)

ParamName

Returns the parameter name that caused the exception.

 Public Property Get ParamName ( ) As String

Return Values

String - The name of the parameter that caused the exception.

Remarks

Every ArgumentException should contain the name of the parameter that caused the exception.

Read Only.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview

Exception


EncoderFallbackException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class EncoderFallbackException Overview


EncoderFallbackStatic

EncoderFallbackStatic

Provides a failure-handling mechanism, called a fallback, for an input character that cannot be converted to an encoded output byte sequence.

Public:

Properties:

Name | Description
ExceptionFallback (get) | Gets an object that throws an exception when an input character sequence cannot be encoded.
ReplacementFallback (get) | Gets an object that outputs a substitute string in place of an input character sequence that cannot be encoded.

See Also

Project CorLib Overview

Class EncoderFallbackStatic Overview

EncoderExceptionFallback

EncoderReplacementFallback


EncoderFallbackStatic: ExceptionFallback (get)

ExceptionFallback

Gets an object that throws an exception when an input character sequence cannot be encoded.

 Public Property Get ExceptionFallback ( ) As EncoderFallback

Return Values

EncoderFallback - A type derived from the EncoderFallback class.

Remarks

The default value is a EncoderExceptionFallback object.

Read Only.

See Also

Project CorLib Overview

Class EncoderFallbackStatic Overview

EncoderExceptionFallback

EncoderExceptionFallbackBuffer


EncoderFallbackStatic: ReplacementFallback (get)

ReplacementFallback

Gets an object that outputs a substitute string in place of an input character sequence that cannot be encoded.

 Public Property Get ReplacementFallback ( ) As EncoderFallback

Return Values

EncoderFallback - A type derived from the EncoderFallback class.

Remarks

The default value is a EncoderReplacementFallback object that emits the QUESTION MARK character ("?", U+003F) in place of unknown character sequences.

Read Only.

See Also

Project CorLib Overview

Class EncoderFallbackStatic Overview

EncoderReplacementFallback

EncoderReplacementFallbackBuffer


EncoderReplacementFallback

EncoderReplacementFallback

Provides a failure handling mechanism, called a fallback, for an input character that cannot be converted to an output byte sequence. The fallback uses a user-specified replacement string instead of the original input character.

Implements:

EncoderFallback
IObject

Public:

Properties:

Name | Description
DefaultString (get) | Gets the replacement string that is the value of the EncoderReplacementFallback object.
MaxCharCount (get) | Gets the number of characters in the replacement string for the EncoderReplacementFallback object.

Methods:

Name | Description
CreateFallbackBuffer | Creates a EncoderFallbackBuffer object that is initialized with the replacement string of this EncoderReplacementFallback object.
Equals | Determines whether the specified value passed in is equal to the current object.
GetHashCode | Serves as the default hash function.
ToString | Returns a string that represents the current object.

Remarks

A common reason for an encoding or decoding operation to fail is if the underlying encoding class does not provide a mapping between a character and an equivalent byte sequence. For example , an ASCIIEncoding object cannot encode a character having a Unicode code point value that is outside the range U+0000 to U+007F. If the input character cannot be converted to an output byte sequence, a EncoderReplacementFallback object substitutes a specified replacement string for the original input character. The conversion process encodes the replacement string and then continues to process the remainder of the original input.

The replacement string used by an EncoderReplacementFallback object is determined by the call to its class constructor. Two options are available:

  • Replacement with the default character. If you call the New EncoderReplacementFallback() constructor, the replacement character is "?" (U+003F).
  • Replacement with a string of your choice. If you call the NewEncoderReplacementFallback(String) constructor, you provide the replacement string.

If you choose a fallback string to use with this class, make sure that the string is composed entirely of characters that can be encoded in the target encoding. Otherwise, a recursive fallback results, causing an ArgumentException.

See Also

Project CorLib Overview

Class EncoderReplacementFallback Overview


EncoderReplacementFallback: CreateFallbackBuffer

CreateFallbackBuffer

Creates a EncoderFallbackBuffer object that is initialized with the replacement string of this EncoderReplacementFallback object.

 Public Function CreateFallbackBuffer ( ) As EncoderFallbackBuffer

Return Values

EncoderFallbackBuffer - A EncoderFallbackBuffer object equal to this EncoderReplacementFallback object.

See Also

Project CorLib Overview

Class EncoderReplacementFallback Overview


EncoderReplacementFallback: DefaultString (get)

DefaultString

Gets the replacement string that is the value of the EncoderReplacementFallback object.

 Public Property Get DefaultString ( ) As String

Return Values

String - A substitute string that is used in place of an input character that cannot be encoded.

Read Only.

See Also

Project CorLib Overview

Class EncoderReplacementFallback Overview


EncoderReplacementFallback: EncoderFallback

EncoderFallback

 Implements EncoderFallback

Return Values

EncoderFallback -

See Also

Project CorLib Overview

Class EncoderReplacementFallback Overview


EncoderReplacementFallback: Equals

Equals

Determines whether the specified value passed in is equal to the current object.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare to the current object.

Return Values

Boolean - True if the specified value is equal to the current object; otherwise, False.

See Also

Project CorLib Overview

Class EncoderReplacementFallback Overview

IObject


EncoderReplacementFallback: GetHashCode

GetHashCode

Serves as the default hash function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A hash code for the current object.

See Also

Project CorLib Overview

Class EncoderReplacementFallback Overview

IObject


EncoderReplacementFallback: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class EncoderReplacementFallback Overview


EncoderReplacementFallback: MaxCharCount (get)

MaxCharCount

Gets the number of characters in the replacement string for the EncoderReplacementFallback object.

 Public Property Get MaxCharCount ( ) As Long

Return Values

Long - The number of characters in the string used in place of an input character that cannot be encoded.

Read Only.

See Also

Project CorLib Overview

Class EncoderReplacementFallback Overview


EncoderReplacementFallback: ToString

ToString

Returns a string that represents the current object.

 Public Function ToString ( ) As String

Return Values

String - A string the represents the current object.

See Also

Project CorLib Overview

Class EncoderReplacementFallback Overview

IObject


EncoderReplacementFallbackBuffer

EncoderReplacementFallbackBuffer

Represents a substitute input string that is used when the original input character cannot be encoded. This class cannot be inherited.

Implements:

EncoderFallbackBuffer
IObject

Public:

Properties:

Name | Description
Remaining (get) | Gets the number of characters in the replacement fallback buffer that remain to be processed.

Methods:

Name | Description
Equals | Determines whether the specified value passed in is equal to the current object.
Fallback | Indicates whether a replacement string can be used when an input surrogate pair cannot be encoded, or whether the surrogate pair can be ignored. Parameters specify the surrogate pair and the index position of the pair in the input.
GetHashCode | Serves as the default hash function.
GetNextChar | Retrieves the next character in the replacement fallback buffer.
MovePrevious | Causes the next call to the GetNextChar method to access the character position in the replacement fallback buffer prior to the current character position.
Reset | Initializes all internal state information and data in this instance of EncoderReplacementFallbackBuffer.
ToString | Returns a string that represents the current object.

See Also

Project CorLib Overview

Class EncoderReplacementFallbackBuffer Overview


EncoderReplacementFallbackBuffer: EncoderFallbackBuffer

EncoderFallbackBuffer

 Implements EncoderFallbackBuffer

Return Values

EncoderFallbackBuffer -

See Also

Project CorLib Overview

Class EncoderReplacementFallbackBuffer Overview


EncoderReplacementFallbackBuffer: Equals

Equals

Determines whether the specified value passed in is equal to the current object.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare to the current object.

Return Values

Boolean - True if the specified value is equal to the current object; otherwise, False.

See Also

Project CorLib Overview

Class EncoderReplacementFallbackBuffer Overview

IObject


EncoderReplacementFallbackBuffer: Fallback

Fallback

Indicates whether a replacement string can be used when an input surrogate pair cannot be encoded, or whether the surrogate pair can be ignored. Parameters specify the surrogate pair and the index position of the pair in the input.

 Public Function Fallback(
      ByVal UnknownCharOrHighSurrogate As Long,
      Optional ByRef UnknownLowSurrogate As Variant,
      Optional ByVal Index As Long ) As Boolean

Parameters

UnknownCharOrHighSurrogate
[ByVal] Long. The high surrogate of the input pair.
UnknownLowSurrogate
[ByRef] Optional. Variant. The low surrogate of the input pair.
Index
[ByVal] Optional. Long. The index position of the surrogate pair in the input buffer.

Return Values

Boolean - True if the replacement string is not empty; False if the replacement string is empty.

Remarks

The GetBytes and Convert methods call Fallback if they encounter an unknown character in their input. If the return value of Fallback is True, the calling method can invoke the GetNextChar method to obtain each character in the replacement fallback buffer.

Exceptions

Exception | Condition
ArgumentException | This method is called again before the GetNextChar method has read all the replacement string characters.
ArgumentOutOfRangeException | The value of CharUnknownHigh is less than U+D800 or greater than U+D8FF. -or- The value of CharUnknownLow is less than U+DC00 or greater than U+DFFF.

See Also

Project CorLib Overview

Class EncoderReplacementFallbackBuffer Overview


EncoderReplacementFallbackBuffer: GetHashCode

GetHashCode

Serves as the default hash function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A hash code for the current object.

See Also

Project CorLib Overview

Class EncoderReplacementFallbackBuffer Overview

IObject


EncoderReplacementFallbackBuffer: GetNextChar

GetNextChar

Retrieves the next character in the replacement fallback buffer.

 Public Function GetNextChar ( ) As Integer

Return Values

Integer - The next Unicode character in the replacement fallback buffer that the application can encode.

Remarks

The GetBytes and Convert methods call Fallback if they encounter an unknown surrogate pair or character in their input. If the return value of Fallback is True, the calling method can invoke GetNextChar to obtain each character in the replacement fallback buffer.

See Also

Project CorLib Overview

Class EncoderReplacementFallbackBuffer Overview


EncoderReplacementFallbackBuffer: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class EncoderReplacementFallbackBuffer Overview


EncoderReplacementFallbackBuffer: MovePrevious

MovePrevious

Causes the next call to the GetNextChar method to access the character position in the replacement fallback buffer prior to the current character position.

 Public Function MovePrevious ( ) As Boolean

Return Values

Boolean - True if the MovePrevious operation was successful; otherwise, False.

See Also

Project CorLib Overview

Class EncoderReplacementFallbackBuffer Overview


EncoderReplacementFallbackBuffer: Remaining (get)

Remaining

Gets the number of characters in the replacement fallback buffer that remain to be processed.

 Public Property Get Remaining ( ) As Long

Return Values

Long - The number of characters in the replacement fallback buffer that have not yet been processed.

Read Only.

See Also

Project CorLib Overview

Class EncoderReplacementFallbackBuffer Overview


EncoderReplacementFallbackBuffer: Reset

Reset

Initializes all internal state information and data in this instance of EncoderReplacementFallbackBuffer.

 Public Sub Reset ( )

Remarks

The Reset method discards any persisted state information and data that govern emitting a replacement string. Unpredictable results occur if the encoding operation continues after the Reset method is invoked.

See Also

Project CorLib Overview

Class EncoderReplacementFallbackBuffer Overview


EncoderReplacementFallbackBuffer: ToString

ToString

Returns a string that represents the current object.

 Public Function ToString ( ) As String

Return Values

String - A string the represents the current object.

See Also

Project CorLib Overview

Class EncoderReplacementFallbackBuffer Overview

IObject


Encoding

Encoding

Provides an interface for a provider to encode and decode unicode characters to and from bytes. Also contains information on the ability to use the encoded characters in certain situations without integerity loss.

Public:

Properties:

Name | Description
BodyName (get) | Returns the encoding name to be used in with the mail agent body tags.
CodePage (get) | Returns the code page identifier for this encoding.
DecoderFallback (get) | Gets the DecoderFallback object for the current Encoding object.
DecoderFallback (set) | Sets the DecoderFallback object for the current Encoding object.
EncoderFallback (get) | Gets the EncoderFallback object for the current Encoding object.
EncoderFallback (set) | Sets the EncoderFallback for the current Encoding object.
EncodingName (get) | When implemented in a derived class, gets the human-readable description of the current encoding.
HeaderName (get) | Returns the encoding name to be used in with the mail agent header tags.
IsBrowserDisplay (get) | Indicates if this encoding can be used by browsers to display text.
IsBrowserSave (get) | Indicates if this encoding can be used to save data with this encoding.
IsMailNewsDisplay (get) | Indicates if this encoding can be used to display mail and news by mail and news clients.
IsMailNewsSave (get) | Indicates if this encoding can be used to save date by mail and news clients.
IsReadOnly (get) | When implemented in a derived class, gets a value indicating whether the current encoding is read-only.
IsSingleByte (get) | Returns if the current encoding uses single-byte code points.
WebName (get) | Returns the encoding name registered with the Internet Assigned Numbers Authority.
WindowsCodePage (get) | Returns the Windows Operating Systems code page for this encoding.

Methods:

Name | Description
Clone | Creates a shallow copy of the current Encoding object.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetByteCount | Returns the number of bytes that would be produced from the set of characters using this encoding.
GetBytes | Encodes a set of characters into an array of bytes.
GetBytesEx | Encodes a set of characters into an array of bytes, returning the number of bytes produced.
GetCharCount | When implemented in a derived class, calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
GetChars | When implemented in a derived class, decodes all the bytes in the specified byte array into a set of characters.
GetCharsEx | When implemented in a derived class, decodes a sequence of bytes from the specified byte array into the specified character array.
GetDecoder | When implemented in a derived class, obtains a decoder that converts an encoded sequence of bytes into a sequence of characters.
GetEncoder | When implemented in a derived class, obtains an encoder that converts a sequence of Unicode characters into an encoded sequence of bytes.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetMaxByteCount | When implemented in a derived class, calculates the maximum number of bytes produced by encoding the specified number of characters.
GetMaxCharCount | Returns the maximum number of characters than can be decoded from the number of bytes specified.
GetPreamble | When implemented in a derived class, returns a sequence of bytes that specifies the encoding used.
GetString | When implemented in a derived class, decodes all the bytes in the specified byte array into a string.
ToString | Returns a string representation of this object instance.

Remarks

Encoding is the process of transforming a set of Unicode characters into a sequence of bytes. In contrast, decoding is the process of transforming a sequence of encoded bytes into a set of Unicode characters.

Note that Encoding is intended to operate on Unicode characters instead of arbitrary binary data, such as byte arrays. If your application must encode arbitrary binary data into text, it should use a protocol such as uuencode, which is implemented by methods such as Convert.ToBase64CharArray.

VBCorLib provides the following implementations of the Encoding class to support current Unicode encodings and other encodings:

  • ASCIIEncoding encodes Unicode characters as single 7-bit ASCII characters. This encoding only supports character values between U+0000 and U+007F. Code page 20127. Also available through the ASCII property.
  • UTF7Encoding encodes Unicode characters using the UTF-7 encoding. This encoding supports all Unicode character values. Code page 65000. Also available through the UTF7 property.
  • UTF8Encoding encodes Unicode characters using the UTF-8 encoding. This encoding supports all Unicode character values. Code page 65001. Also available through the UTF8 property.
  • UnicodeEncoding encodes Unicode characters using the UTF-16 encoding. Both little endian and big endian byte orders are supported. Also available through the Unicode property and the BigEndianUnicode property.
  • UTF32Encoding encodes Unicode characters using the UTF-32 encoding. Both little endian (code page 12000) and big endian (code page 12001) byte orders are supported. Also available through the UTF32 property.

The Encoding class is primarily intended to convert between different encodings and Unicode. Often one of the derived Unicode classes is the correct choice for your application.

Your applications use the GetEncoding method to obtain other encodings. They should use the GetEncodings method to get a list of all encodings.

If the data to be converted is available only in sequential blocks (such as data read from a stream) or if the amount of data is so large that it needs to be divided into smaller blocks, your application should use the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively, of a derived class.

The UTF-16 and the UTF-32 encoders can use the big endian byte order (most significant byte first) or the little endian byte order (least significant byte first). For example, the Latin Capital Letter A (U+0041) is serialized as follows (in hexadecimal):

  • UTF-16 big endian byte order: 00 41
  • UTF-16 little endian byte order: 41 00
  • UTF-32 big endian byte order: 00 00 00 41
  • UTF-32 little endian byte order: 41 00 00 00

The GetPreamble method retrieves an array of bytes that includes the byte order mark (BOM). If this byte array is prefixed to an encoded stream, it helps the decoder to identify the encoding format used.

For more information on byte order and the byte order mark, see The Unicode Standard at the Unicode home page.

Note that the encoding classes allow errors to:

  • Silently change to a "?" character.
  • Use a "best fit" character.
  • Change to an application-specific behavior through use of the EncoderFallback and DecoderFallback classes with the U+FFFD Unicode replacement character.

Your applications are recommended to throw exceptions on all data stream errors. An application either uses a "throwonerror" flag when applicable or uses the EncoderExceptionFallback and DecoderExceptionFallback classes. Best fit fallback is often not recommended because it can cause data loss or confusion and is slower than simple character replacements. For ANSI encodings, the best fit behavior is the default.

Examples

The following example converts a string from one encoding to another.

Public Sub Main()
    Dim UnicodeString   As String
    Dim AsciiEncoding   As Encoding
    Dim UnicodeEncoding As Encoding
    Dim AsciiBytes()    As Byte
    Dim UnicodeBytes()  As Byte
    Dim AsciiChars()    As Integer
    Dim AsciiString     As String

    Set Console.OutputEncoding = Encoding.UTF8
    UnicodeString = t("This string contains the unicode character Pi (\u03a0)")

    ' Create two different encodings.
    Set AsciiEncoding = Encoding.ASCII
    Set UnicodeEncoding = Encoding.Unicode

    ' Convert the string into a byte array.
    UnicodeBytes = UnicodeEncoding.GetBytes(UnicodeString)

    ' Perform the convertion from one encoding to the other.
    AsciiBytes = Encoding.Convert(UnicodeEncoding, AsciiEncoding, UnicodeBytes)

    ' Convert the new Byte() into a Char() and then into a string.
    AsciiChars = AsciiEncoding.GetChars(AsciiBytes)
    AsciiString = NewString(AsciiChars)

    ' Display the strings created before and after the conversion.
    Console.WriteLine "Original string: " & UnicodeString
    Console.WriteLine "Ascii converted string: " & AsciiString
    Console.ReadKey
End Sub

' This example code produces the following output.
'
'    Original string: This string contains the unicode character Pi (Π)
'    Ascii converted string: This string contains the unicode character Pi (?)

See Also

Project CorLib Overview

Class Encoding Overview

EncodingStatic

ASCIIEncoding

UTF7Encoding

UTF8Encoding

UTF32Encoding

UnicodeEncoding


Encoding: BodyName (get)

BodyName

Returns the encoding name to be used in with the mail agent body tags.

 Public Property Get BodyName ( ) As String

Return Values

String - The body tag compatible encoding name.

Read Only.

See Also

Project CorLib Overview

Class Encoding Overview


Encoding: Clone

Clone

Creates a shallow copy of the current Encoding object.

 Public Function Clone ( ) As Encoding

Return Values

Encoding - A copy of the current Encoding object.

Remarks

The clone is writable even if the original Encoding object is read-only. Therefore, the properties of the clone can be modified.

A shallow copy of an object is a copy of the object only. If the object contains references to other objects, the shallow copy does not create copies of the referred objects. It refers to the original objects instead. In contrast, a deep copy of an object creates a copy of the object and a copy of everything directly or indirectly referenced by that object.

See Also

Project CorLib Overview

Class Encoding Overview


Encoding: CodePage (get)

CodePage

Returns the code page identifier for this encoding.

 Public Property Get CodePage ( ) As Long

Return Values

Long - Code page identifier.

Read Only.

See Also

Project CorLib Overview

Class Encoding Overview


Encoding: DecoderFallback (get)

DecoderFallback

Gets the DecoderFallback object for the current Encoding object.

 Public Property Get DecoderFallback ( ) As DecoderFallback

Return Values

DecoderFallback - The decoder fallback object for the current Encoding object.

Remarks

The DecoderFallback object represents an error handler that is invoked when an encoded byte sequence cannot be decoded into a character. Any one of the following handler types is supported:

  • A replacement fallback handler, which replaces bytes that cannot be decoded with some arbitrary replacement character. VBCorLib includes one replacement fallback handler, DecoderFallback, which by default replaces bytes that cannot be decoded with a question mark ("?") character.
  • An exception fallback handler, which throws an exception when bytes cannot be decoded. VBCorLib includes one exception fallback handler, DecoderExceptionFallback, which throws a DecoderFallbackException when bytes cannot be decoded.

Read/Write.

Exceptions

Exception | Condition
ArgumentNullException | The value in a set operation is Nothing.
InvalidOperationException | A value cannot be assigned in a set operation because the current Encoding object is read-only.

See Also

Project CorLib Overview

Class Encoding Overview

DecoderFallback

DecoderFallbackBuffer


Encoding: DecoderFallback (set)

DecoderFallback

Sets the DecoderFallback object for the current Encoding object.

 Public Property Set DecoderFallback(
      ByVal Value As DecoderFallback ) :

Parameters

Value
[ByVal] DecoderFallback. The DecoderFallback object to set.

Remarks

The DecoderFallback object represents an error handler that is invoked when an encoded byte sequence cannot be decoded into a character. Any one of the following handler types is supported:

  • A replacement fallback handler, which replaces bytes that cannot be decoded with some arbitrary replacement character. VBCorLib includes one replacement fallback handler, DecoderFallback, which by default replaces bytes that cannot be decoded with a question mark ("?") character.
  • An exception fallback handler, which throws an exception when bytes cannot be decoded. VBCorLib includes one exception fallback handler, DecoderExceptionFallback, which throws a DecoderFallbackException when bytes cannot be decoded.

Read/Write.

Exceptions

Exception | Condition
ArgumentNullException | The value in a set operation is Nothing.
InvalidOperationException | A value cannot be assigned in a set operation because the current Encoding object is read-only.

See Also

Project CorLib Overview

Class Encoding Overview

DecoderFallback

DecoderFallbackBuffer


Encoding: EncoderFallback (get)

EncoderFallback

Gets the EncoderFallback object for the current Encoding object.

 Public Property Get EncoderFallback ( ) As EncoderFallback

Return Values

EncoderFallback - The encoder fallback object for the current Encoding object.

Remarks

The EncoderFallback object represents an error handler that is invoked when a character cannot be converted into an encoded byte sequence. Any one of the following handler types is supported:

  • A replacement fallback handler, which replaces characters that cannot be encoded with some arbitrary replacement character. VBCorLib includes one replacement fallback handler, EncoderFallback, which by default replaces characters that cannot be encoded with a question mark ("?") character.
  • An exception fallback handler, which throws an exception when characters cannot be encoded. VBCorLib includes one exception fallback handler, EncoderExceptionFallback, which throws an EncoderFallbackException when characters cannot be decoded.

Read/Write.

Exceptions

Exception | Condition
ArgumentNullException | The value in a set operation is Nothing.
InvalidOperationException | A value cannot be assigned in a set operation because the current Encoding object is read-only.

See Also

Project CorLib Overview

Class Encoding Overview

EncoderFallback

EncoderFallbackBuffer


Encoding: EncoderFallback (set)

EncoderFallback

Sets the EncoderFallback for the current Encoding object.

 Public Property Set EncoderFallback(
      ByVal Value As EncoderFallback ) :

Parameters

Value
[ByVal] EncoderFallback. The EncoderFallback object to set.

Remarks

The EncoderFallback object represents an error handler that is invoked when a character cannot be converted into an encoded byte sequence. Any one of the following handler types is supported:

  • A replacement fallback handler, which replaces characters that cannot be encoded with some arbitrary replacement character. VBCorLib includes one replacement fallback handler, EncoderFallback, which by default replaces characters that cannot be encoded with a question mark ("?") character.
  • An exception fallback handler, which throws an exception when characters cannot be encoded. VBCorLib includes one exception fallback handler, EncoderExceptionFallback, which throws an EncoderFallbackException when characters cannot be decoded.

Read/Write.

Exceptions

Exception | Condition
ArgumentNullException | The value in a set operation is Nothing.
InvalidOperationException | A value cannot be assigned in a set operation because the current Encoding object is read-only.

See Also

Project CorLib Overview

Class Encoding Overview

EncoderFallback

EncoderFallbackBuffer


Encoding: EncodingName (get)

EncodingName

When implemented in a derived class, gets the human-readable description of the current encoding.

 Public Property Get EncodingName ( ) As String

Return Values

String - The human-readable description of the current Encoding.

Remarks

The EncodingName property is intended for display. To find a name that can be passed to the GetEncoding method, use the WebName property.

Read Only.

Examples

The following example retrieves the different names for each encoding and displays the encodings with one or more names that are different from EncodingInfo.Name. It displays EncodingName but does not compare against it.

Public Sub Main()
    Debug.Print "Name                ";
    Debug.Print "CodePage  ";
    Debug.Print "BodyName            ";
    Debug.Print "HeaderName          ";
    Debug.Print "WebName             ";
    Debug.Print "Encoding.EncodingName"

    Dim Item    As Variant
    Dim ei      As EncodingInfo
    Dim e       As Encoding

    For Each Item In Encoding.GetEncodings
        Set ei = Item
        Set e = ei.GetEncoding

        If (ei.Name <> e.BodyName) Or (ei.Name <> e.HeaderName) Or (ei.Name <> e.WebName) Then
            Debug.Print CorString.Format("{0,-18}", ei.Name);
            Debug.Print CorString.Format("{0,-9}", e.CodePage);
            Debug.Print CorString.Format("{0,-18}", e.BodyName);
            Debug.Print CorString.Format("{0,-18}", e.HeaderName);
            Debug.Print CorString.Format("{0,-18}", e.WebName);
            Debug.Print e.EncodingName
        End If
    Next
End Sub

' This code produces the following output.
'
'    Name               CodePage  BodyName           HeaderName         WebName            Encoding.EncodingName
'    shift_jis          932       iso-2022-jp        iso-2022-jp        shift_jis          Japanese (Shift-JIS)
'    windows-1250       1250      iso-8859-2         windows-1250       windows-1250       Central European (Windows)
'    windows-1251       1251      koi8-r             windows-1251       windows-1251       Cyrillic (Windows)
'    Windows-1252       1252      iso-8859-1         Windows-1252       Windows-1252       Western European (Windows)
'    windows-1253       1253      iso-8859-7         windows-1253       windows-1253       Greek (Windows)
'    windows-1254       1254      iso-8859-9         windows-1254       windows-1254       Turkish (Windows)
'    csISO2022JP        50221     iso-2022-jp        iso-2022-jp        csISO2022JP        Japanese (JIS-Allow 1 byte Kana)
'    iso-2022-kr        50225     iso-2022-kr        euc-kr             iso-2022-kr        Korean (ISO)

See Also

Project CorLib Overview

Class Encoding Overview


Encoding: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class Encoding Overview


Encoding: GetByteCount

GetByteCount

Returns the number of bytes that would be produced from the set of characters using this encoding.

 Public Function GetByteCount(
      ByRef Chars As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Chars
[ByRef] Variant. The Integer() or String containing the set of characters to encode.
Index
[ByRef] Optional. Variant. The index of the first character to encode.
Count
[ByRef] Optional. Variant. The number of characters to encode.

Return Values

Long - The number of bytes produced by encoding the specified of characters.

Remarks

To calculate the exact array size required by GetBytesEx to store the resulting bytes, the application should use GetByteCount. To calculate the maximum array size, the application should use GetMaxByteCount. The GetByteCount method generally allows allocation of less memory, while the GetMaxByteCount method generally executes faster.

If the data to be converted is available only in sequential blocks (such as data read from a stream) or if the amount of data is so large that it needs to be divided into smaller blocks, the application should use the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively, of an implemented class.

The GetByteCount method determines how many bytes result in encoding a set of Unicode characters, and the GetBytesEx method performs the actual encoding. The Encoding.GetBytesEx method expects discrete conversions, in contrast to the Encoder.GetBytes method, which handles multiple conversions on a single input stream.

Exceptions

Exception | Condition
ArgumentNullException | Chars is a null array.
ArgumentOutOfRangeException | Index is less than the lower-bound of Chars for an array or less than zero for a string. -or- Count is less than zero. -or- Index and Count do not denote a valid range in Chars.
EncoderFallbackException | A fallback occurred -and- EncoderFallback is set to EncoderExceptionFallback.

Example

The following example determines the number of bytes required to encode a character array, encodes the characters, and displays the resulting bytes.

Public Sub Main()
    Dim MyChars()   As Integer
    Dim U7          As Encoding
    Dim U8          As Encoding
    Dim U16LE       As Encoding
    Dim U16BE       As Encoding
    Dim U32         As Encoding

    ' The characters to encode:
    '    Latin Small Letter Z (U+007A)
    '    Latin Small Letter A (U+0061)
    '    Combining Breve (U+0306)
    '    Latin Small Letter AE With Acute (U+01FD)
    '    Greek Small Letter Beta (U+03B2)
    '    a high-surrogate value (U+D8FF)
    '    a low-surrogate value (U+DCFF)
    MyChars = NewChars("z", "a", &H306, &H1FD, &H3B2, &HD8FF, &HDCFF)

    ' Get different encodings.
    Set U7 = Encoding.UTF7
    Set U8 = Encoding.UTF8
    Set U16LE = Encoding.Unicode
    Set U16BE = Encoding.BigEndianUnicode
    Set U32 = Encoding.UTF32

    ' Encode the entire array, and print out the counts and resulting bytes.
    PrintCountsAndBytes MyChars, U7
    PrintCountsAndBytes MyChars, U8
    PrintCountsAndBytes MyChars, U16LE
    PrintCountsAndBytes MyChars, U16BE
    PrintCountsAndBytes MyChars, U32

    Console.ReadKey
End Sub

Private Sub PrintCountsAndBytes(ByRef Chars() As Integer, ByVal Enc As Encoding)
    ' Display the name of the encoding used.
    Console.WriteValue "{0,-30} :", Enc.ToString

    ' Display the exact byte count.
    Console.WriteValue " {0,-3}", Enc.GetByteCount(Chars)

    ' Display the maximum byte count.
    Console.WriteValue " {0,-3} :", Enc.GetMaxByteCount(CorArray.Length(Chars))

    ' Encode the array of chars.
    Dim Bytes() As Byte
    Bytes = Enc.GetBytes(Chars)

    ' Display all the encoded bytes.
    PrintHexBytes Bytes
End Sub

Private Sub PrintHexBytes(ByRef Bytes() As Byte)
    If CorArray.IsNullOrEmpty(Bytes) Then
        Console.WriteLine "<none>"
    Else
        Dim i As Long

        For i = LBound(Bytes) To UBound(Bytes)
            Console.WriteValue "{0:X2} ", Bytes(i)
        Next

        Console.WriteLine
    End If
End Sub

'This code produces the following output.
'
'System.Text.UTF7Encoding       : 18  23  :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D
'System.Text.UTF8Encoding       : 12  24  :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
'System.Text.UnicodeEncoding    : 14  16  :7A 00 61 00 06 03 FD 01 B2 03 FF D8 FF DC
'System.Text.UnicodeEncoding    : 14  16  :00 7A 00 61 03 06 01 FD 03 B2 D8 FF DC FF
'System.Text.UTF32Encoding      : 24  32  :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00

The following example determines the number of bytes required to encode a string or a range in the string, encodes the characters, and displays the resulting bytes.

Public Sub Main()
    Dim MyStr   As String
    Dim U7      As Encoding
    Dim U8      As Encoding
    Dim U16LE   As Encoding
    Dim U16BE   As Encoding
    Dim U32     As Encoding

    ' The characters to encode:
    '    Latin Small Letter Z (U+007A)
    '    Latin Small Letter A (U+0061)
    '    Combining Breve (U+0306)
    '    Latin Small Letter AE With Acute (U+01FD)
    '    Greek Small Letter Beta (U+03B2)
    '    a high-surrogate value (U+D8FF)
    '    a low-surrogate value (U+DCFF)
    MyStr = t("za\u0306\u01FD\u03B2\uD8FF\uDCFF")

    ' Get different encodings.
    Set U7 = Encoding.UTF7
    Set U8 = Encoding.UTF8
    Set U16LE = Encoding.Unicode
    Set U16BE = Encoding.BigEndianUnicode
    Set U32 = Encoding.UTF32

    ' Encode the entire string, and print out the counts and the resulting bytes.
    Console.WriteLine "Encoding the entire string:"
    PrintCountsAndBytes MyStr, U7
    PrintCountsAndBytes MyStr, U8
    PrintCountsAndBytes MyStr, U16LE
    PrintCountsAndBytes MyStr, U16BE
    PrintCountsAndBytes MyStr, U32

    Console.WriteLine

    ' Encode three characters starting at index 4, and print out the counts and the resulting bytes.
    Console.WriteLine "Encoding the characters from index 4 through 6:"
    PrintCountsAndBytesEx MyStr, 4, 3, U7
    PrintCountsAndBytesEx MyStr, 4, 3, U8
    PrintCountsAndBytesEx MyStr, 4, 3, U16LE
    PrintCountsAndBytesEx MyStr, 4, 3, U16BE
    PrintCountsAndBytesEx MyStr, 4, 3, U32

    Console.ReadKey
End Sub

Private Sub PrintCountsAndBytes(ByRef s As String, ByVal Enc As Encoding)
    ' Display the name of the encoding used.
    Console.WriteValue "{0,-30} :", Enc.ToString

    ' Display the exact byte count.
    Console.WriteValue " {0,-3}", Enc.GetByteCount(s)

    ' Display the maximum byte count.
    Console.WriteValue " {0,-3} :", Enc.GetMaxByteCount(Len(s))

    ' Encode the entire string.
    Dim Bytes() As Byte
    Bytes = Enc.GetBytes(s)

    ' Display all the encoded bytes.
    PrintHexBytes Bytes
End Sub

Private Sub PrintCountsAndBytesEx(ByRef s As String, ByVal Index As Long, ByVal Count As Long, ByVal Enc As Encoding)
    ' Display the name of the encoding used.
    Console.WriteValue "{0,-30} :", Enc.ToString

    ' Display the exact byte count.
    Console.WriteValue " {0,-3}", Enc.GetByteCount(s, Index, Count)

    ' Display the maximum byte count.
    Console.WriteValue " {0,-3} :", Enc.GetMaxByteCount(Count)

    ' Encode the entire string.
    Dim Bytes() As Byte
    Bytes = Enc.GetBytes(s, Index, Count)

    ' Display all the encoded bytes.
    PrintHexBytes Bytes
End Sub

Private Sub PrintHexBytes(ByRef Bytes() As Byte)
    If CorArray.IsNullOrEmpty(Bytes) Then
        Console.WriteLine "<none>"
    Else
        Dim i As Long

        For i = LBound(Bytes) To UBound(Bytes)
            Console.WriteValue "{0:X2} ", Bytes(i)
        Next

        Console.WriteLine
    End If
End Sub

'This code produces the following output.
'
'Encoding the entire string:
'System.Text.UTF7Encoding       : 18  23  :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D
'System.Text.UTF8Encoding       : 12  24  :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
'System.Text.UnicodeEncoding    : 14  16  :7A 00 61 00 06 03 FD 01 B2 03 FF D8 FF DC
'System.Text.UnicodeEncoding    : 14  16  :00 7A 00 61 03 06 01 FD 03 B2 D8 FF DC FF
'System.Text.UTF32Encoding      : 24  32  :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00
'
'Encoding the characters from index 4 through 6:
'System.Text.UTF7Encoding       : 10  11  :2B 41 37 4C 59 2F 39 7A 2F 2D
'System.Text.UTF8Encoding       : 6   12  :CE B2 F1 8F B3 BF
'System.Text.UnicodeEncoding    : 6   8   :B2 03 FF D8 FF DC
'System.Text.UnicodeEncoding    : 6   8   :03 B2 D8 FF DC FF
'System.Text.UTF32Encoding      : 8   16  :B2 03 00 00 FF FC 04 00

See Also

Project CorLib Overview

Class Encoding Overview

GetBytesEx

GetMaxByteCount

GetEncoder


Encoding: GetBytes

GetBytes

Encodes a set of characters into an array of bytes.

 Public Function GetBytes(
      ByRef Chars As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( ) :

Parameters

Chars
[ByRef] Variant. The Integer array or String containing the set of characters to encode.
Index
[ByRef] Optional. Variant. The index of the first character to encode.
Count
[ByRef] Optional. Variant. The number of characters to encode.

Return Values

Byte() - A byte array containing the results of encoding the specified set of characters.

Remarks

If the data to be converted is available only in sequential blocks (such as data read from a stream) or if the amount of data is so large that it needs to be divided into smaller blocks, the application should use the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively, of an implemented class.

The GetByteCount method determines how many bytes result in encoding a set of Unicode characters, and the GetBytes method performs the actual encoding. The Encoding.GetBytes method expects discrete conversions, in contrast to the Encoder.GetBytes method, which handles multiple conversions on a single input stream.

Exceptions

Exception | Condition
ArgumentNullException | Chars is a null array.
ArgumentOutOfRangeException | Index is less than the lower-bound of Chars for an array or less than zero for a string. -or- Count is less than zero. -or- Index and Count do not denote a valid range in Chars.
EncoderFallbackException | A fallback occurred -and- EncoderFallback is set to EncoderExceptionFallback.

Examples

The following example determines the number of bytes required to encode a string or a range in the string, encodes the characters, and displays the resulting bytes.

Public Sub Main()
    Dim MyStr   As String
    Dim U7      As Encoding
    Dim U8      As Encoding
    Dim U16LE   As Encoding
    Dim U16BE   As Encoding
    Dim U32     As Encoding

    MyStr = t("za\u0306\u01FD\u03B2\uD8FF\uDCFF")

    Set U7 = Encoding.UTF7
    Set U8 = Encoding.UTF8
    Set U16LE = Encoding.Unicode
    Set U16BE = Encoding.BigEndianUnicode
    Set U32 = Encoding.UTF32

    Console.WriteLine "Encoding the entire string:"
    PrintCountsAndBytes MyStr, U7
    PrintCountsAndBytes MyStr, U8
    PrintCountsAndBytes MyStr, U16LE
    PrintCountsAndBytes MyStr, U16BE
    PrintCountsAndBytes MyStr, U32

    Console.WriteLine

    Console.WriteLine "Encoding the characters from index 4 through 6:"
    PrintCountsAndBytes2 MyStr, 4, 3, U7
    PrintCountsAndBytes2 MyStr, 4, 3, U8
    PrintCountsAndBytes2 MyStr, 4, 3, U16LE
    PrintCountsAndBytes2 MyStr, 4, 3, U16BE
    PrintCountsAndBytes2 MyStr, 4, 3, U32

    Console.ReadKey
End Sub

Private Sub PrintCountsAndBytes(ByVal s As String, ByVal Enc As Encoding)
    Dim IBC     As Long
    Dim IMBC    As Long
    Dim Bytes() As Byte

    Console.WriteValue "{0,-30} :", Enc.ToString

    IBC = Enc.GetByteCount(s)
    Console.WriteValue " {0,-3}", IBC

    IMBC = Enc.GetMaxByteCount(Len(s))
    Console.WriteValue " {0,-3} :", IMBC

    Bytes = Enc.GetBytes(s)

    PrintHexBytes Bytes
End Sub

Private Sub PrintCountsAndBytes2(ByVal s As String, ByVal Index As Long, ByVal Count As Long, ByVal Enc As Encoding)
    Dim IBC     As Long
    Dim IMBC    As Long
    Dim Bytes() As Byte

    Console.WriteValue "{0,-30} :", Enc.ToString

    IBC = Enc.GetByteCount(s, Index, Count)
    Console.WriteValue " {0,-3}", IBC

    IMBC = Enc.GetMaxByteCount(Count)
    Console.WriteValue " {0,-3} :", IMBC

    Bytes = Enc.GetBytes(s, Index, Count)

    PrintHexBytes Bytes
End Sub

Private Sub PrintHexBytes(ByRef Bytes() As Byte)
    Dim i As Long

    If CorArray.IsNullOrEmpty(Bytes) Then
        Console.WriteLine "<none>"
    Else
        For i = LBound(Bytes) To UBound(Bytes)
            Console.WriteValue "{0:X2} ", Bytes(i)
        Next

        Console.WriteLine
    End If
End Sub

' This example code produces the following output.
'
'    Encoding the entire string:
'    CorLib.UTF7Encoding            : 18  23  :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D
'    CorLib.UTF8Encoding            : 12  24  :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
'    CorLib.UnicodeEncoding         : 14  16  :7A 00 61 00 06 03 FD 01 B2 03 FF D8 FF DC
'    CorLib.UnicodeEncoding         : 14  16  :00 7A 00 61 03 06 01 FD 03 B2 D8 FF DC FF
'    CorLib.UTF32Encoding           : 24  32  :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00
'
'    Encoding the characters from index 4 through 6:
'    CorLib.UTF7Encoding            : 10  11  :2B 41 37 4C 59 2F 39 7A 2F 2D
'    CorLib.UTF8Encoding            : 6   12  :CE B2 F1 8F B3 BF
'    CorLib.UnicodeEncoding         : 6   8   :B2 03 FF D8 FF DC
'    CorLib.UnicodeEncoding         : 6   8   :03 B2 D8 FF DC FF
'    CorLib.UTF32Encoding           : 8   16  :B2 03 00 00 FF FC 04 00

See Also

Project CorLib Overview

Class Encoding Overview

GetBytesEx

GetEncoder

GetByteCount

GetMaxByteCount


Encoding: GetBytesEx

GetBytesEx

Encodes a set of characters into an array of bytes, returning the number of bytes produced.

 Public Function GetBytesEx(
      ByRef Chars As Variant,
      ByVal CharIndex As Long,
      ByVal CharCount As Long,
      ByRef Bytes ( ) As Byte,
      ByVal ByteIndex As Long ) As Long

Parameters

Chars
[ByRef] Variant. The Integer array or String containing the set of characters to encode.
CharIndex
[ByVal] Long. The index of the first character to encode.
CharCount
[ByVal] Long. The number of characters to encode.
Bytes
[ByRef] Byte. The byte array to contain the resulting sequence of bytes.
ByteIndex
[ByVal] Long. The index as which to start writing the resulting sequence of bytes.

Return Values

Long - The number of bytes produce by the encoding.

Remarks

To calculate the exact array size required by GetBytesEx to store the resulting bytes, the application should use GetByteCount. To calculate the maximum array size, the application should use GetMaxByteCount. The GetByteCount method generally allows allocation of less memory, while the GetMaxByteCount method generally executes faster.

If the data to be converted is available only in sequential blocks (such as data read from a stream) or if the amount of data is so large that it needs to be divided into smaller blocks, the application should use the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively, of an implemented class.

The GetByteCount method determines how many bytes result in encoding a set of Unicode characters, and the GetBytesEx method performs the actual encoding. The Encoding.GetBytesEx method expects discrete conversions, in contrast to the Encoder.GetBytes method, which handles multiple conversions on a single input stream.

Exceptions

Exception | Condition
ArgumentNullException | Chars is a null array. -or- Bytes is a null array.
ArgumentOutOfRangeException | CharIndex is less than the lower-bound of Chars for an array or less than zero for a string. -or- CharCount is less than zero. -or- CharIndex and CharCount do not denote a valid range in Chars. -or- ByteIndex is not a valid index in Bytes.
ArgumentException | Bytes does not have enough capacity from ByteIndex to the end of the array to accommodate the resulting bytes.
EncoderFallbackException | A fallback occurred -and- EncoderFallback is set to EncoderExceptionFallback.

Example

The following example determines the number of bytes required to encode three characters from a character array, encodes the characters, and displays the resulting bytes.

Public Sub Main()
    Dim MyChars() As Integer
    Dim U7      As Encoding
    Dim U8      As Encoding
    Dim U16LE   As Encoding
    Dim U16BE   As Encoding
    Dim U32     As Encoding

    MyChars = NewChars("z", "a", &H306, &H1FD, &H3B2, &HD8FF, &HDCFF)

    Set U7 = Encoding.UTF7
    Set U8 = Encoding.UTF8
    Set U16LE = Encoding.Unicode
    Set U16BE = Encoding.BigEndianUnicode
    Set U32 = Encoding.UTF32

    Console.WriteLine "Encoding the characters from index 4 through 6:"
    PrintCountsAndBytes MyChars, 4, 3, U7
    PrintCountsAndBytes MyChars, 4, 3, U8
    PrintCountsAndBytes MyChars, 4, 3, U16LE
    PrintCountsAndBytes MyChars, 4, 3, U16BE
    PrintCountsAndBytes MyChars, 4, 3, U32

    Console.ReadKey
End Sub

Private Sub PrintCountsAndBytes(ByRef Chars() As Integer, ByVal Index As Long, ByVal Count As Long, ByVal Enc As Encoding)
    Dim IBC     As Long
    Dim IMBC    As Long
    Dim Bytes() As Byte

    Console.WriteValue "{0,-30} :", Enc.ToString

    IBC = Enc.GetByteCount(Chars, Index, Count)
    Console.WriteValue " {0,-3}", IBC

    IMBC = Enc.GetMaxByteCount(Count)
    Console.WriteValue " {0,-3} :", IMBC

    ReDim Bytes(0 To IBC - 1)
    Enc.GetBytesEx Chars, Index, Count, Bytes, 0

    PrintHexBytes Bytes
End Sub

Private Sub PrintHexBytes(ByRef Bytes() As Byte)
    Dim i As Long

    If CorArray.IsNullOrEmpty(Bytes) Then
        Console.WriteLine "<none>"
    Else
        For i = LBound(Bytes) To UBound(Bytes)
            Console.WriteValue "{0:X2} ", Bytes(i)
        Next

        Console.WriteLine
    End If
End Sub

' This example code produces the following output.
'
'    Encoding the characters from index 4 through 6:
'    CorLib.UTF7Encoding            : 10  11  :2B 41 37 4C 59 2F 39 7A 2F 2D
'    CorLib.UTF8Encoding            : 6   12  :CE B2 F1 8F B3 BF
'    CorLib.UnicodeEncoding         : 6   8   :B2 03 FF D8 FF DC
'    CorLib.UnicodeEncoding         : 6   8   :03 B2 D8 FF DC FF
'    CorLib.UTF32Encoding           : 8   16  :B2 03 00 00 FF FC 04 00

See Also

Project CorLib Overview

Class Encoding Overview

GetBytes

GetEncoder

GetByteCount

GetMaxByteCount


Encoding: GetCharCount

GetCharCount

When implemented in a derived class, calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.

 Public Function GetCharCount(
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Bytes
[ByRef] Byte. The byte array containing the sequence of bytes to decode.
Index
[ByRef] Optional. Variant. The index of the first byte to decode.
Count
[ByRef] Optional. Variant. The number of bytes to decode.

Return Values

Long - The number of characters produced by decoding the specified sequence of bytes.

Remarks

To calculate the exact array size required by GetChars to store the resulting characters, the application should use GetCharCount. To calculate the maximum array size, the application should use GetMaxCharCount. The GetCharCount method generally allows allocation of less memory, while the GetMaxCharCount method generally executes faster.

The GetCharCount method determines how many characters result in decoding a sequence of bytes, and the GetChars method performs the actual decoding. The GetChars method expects discrete conversions, in contrast to the Decoder.GetChars method, which handles multiple passes on a single input stream.

Exceptions

Exception | Condition
ArgumentNullException | Bytes is null.
ArgumentOutOfRangeException | Index is less than the lower-bound of Bytes. -or- Count is less than zero.
DecoderFallbackException | A fallback occurred -and- DecoderFallback is set to DecoderExceptionFallback.

Examples

The following example encodes a string into an array of bytes, and then decodes the bytes into an array of characters.

Public Sub Main()
    Const Sigma As Integer = &H3A3
    Dim Chars() As Integer
    Dim Bytes() As Byte
    Dim ASCII   As New ASCIIEncoding
    Dim U8      As New UTF8Encoding

    Set Console.OutputEncoding = Encoding.UTF8

    Chars = NewChars("A", "Z", Sigma)
    Bytes = U8.GetBytes(Chars)

    PrintCountsAndChars Bytes, ASCII
    PrintCountsAndChars Bytes, U8

    Console.ReadKey
End Sub

Private Sub PrintCountsAndChars(ByRef Bytes() As Byte, ByVal Enc As Encoding)
    Console.WriteValue "{0,-25} :", Enc
    Console.WriteValue " {0,-3}", Enc.GetCharCount(Bytes)
    Console.WriteValue " {0,-3} :", Enc.GetMaxByteCount(CorArray.Length(Bytes))
    Console.WriteLine Enc.GetString(Bytes)
End Sub

' The previous example code outputs the following.
'
'    CorLib.ASCIIEncoding      : 4   5   :AZ??
'    CorLib.UTF8Encoding       : 3   15  :AZΠ

The following encodes a string into an array of bytes, and then decodes a sub-section of the bytes into an array of characters.

Public Sub Main()
    Const Sigma As Integer = &H3A3
    Dim Chars() As Integer
    Dim Bytes() As Byte
    Dim ASCII   As New ASCIIEncoding
    Dim U8      As New UTF8Encoding

    Set Console.OutputEncoding = Encoding.UTF8

    Chars = NewChars("A", "Z", Sigma)
    Bytes = U8.GetBytes(Chars)

    PrintCountsAndChars Bytes, 2, 2, ASCII
    PrintCountsAndChars Bytes, 2, 2, U8

    Console.ReadKey
End Sub

Private Sub PrintCountsAndChars(ByRef Bytes() As Byte, ByVal StartIndex As Long, ByVal Count As Long, ByVal Enc As Encoding)
    Console.WriteValue "{0,-25} :", Enc
    Console.WriteValue " {0,-3}", Enc.GetCharCount(Bytes, StartIndex, Count)
    Console.WriteValue " {0,-3} :", Enc.GetMaxByteCount(Count)
    Console.WriteLine Enc.GetString(Bytes, StartIndex, Count)
End Sub

' The previous example code outputs the following.
'
'    CorLib.ASCIIEncoding      : 2   3   :??
'    CorLib.UTF8Encoding       : 1   9   :Π

See Also

Project CorLib Overview

Class Encoding Overview

GetCharsEx

GetMaxCharCount

GetDecoder


Encoding: GetChars

GetChars

When implemented in a derived class, decodes all the bytes in the specified byte array into a set of characters.

 Public Function GetChars(
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Integer ( ) :

Parameters

Bytes
[ByRef] Byte. The byte array containing the sequence of bytes to decode.
Index
[ByRef] Optional. Variant. The index of the first byte to decode.
Count
[ByRef] Optional. Variant. The number of bytes to decode.

Return Values

Integer() - A character array containing the results of decoding the specified sequence of bytes.

Remarks

Encoding.GetChars gets characters from an input byte sequence. Encoding.GetChars is different than Decoder.GetChars because Encoding expects discrete conversions, while Decoder is designed for multiple passes on a single input stream.

If the data to be converted is available only in sequential blocks (such as data read from a stream) or if the amount of data is so large that it needs to be divided into smaller blocks, the application should use the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively, of an implemented class.

Note This method is intended to operate on Unicode characters, not on arbitrary binary data, such as byte arrays. If your application needs to encode arbitrary binary data into text, it should use a protocol such as uuencode, which is implemented by methods such as Convert.ToBase64CharArray.

The GetCharCount method determines how many characters result in decoding a sequence of bytes, and the GetChars method performs the actual decoding. The Encoding.GetChars method expects discrete conversions, in contrast to the Decoder.GetChars method, which handles multiple passes on a single input stream.

Several versions of GetCharCount and GetChars are supported. The following are some programming considerations for use of these methods:

  • The application might need to decode multiple input bytes from a code page and process the bytes using multiple calls. In this case, your application probably needs to maintain state between calls, because byte sequences can be interrupted when processed in batches. (For example, part of an ISO-2022 shift sequence may end one GetChars call and continue at the beginning of the next GetChars call. Encoding.GetChars will call the fallback for those incomplete sequences, but Decoder will remember those sequences for the next call.)
  • If the application handles string outputs, it is recommended to use the GetString method. Since this method must check string length and allocate a buffer, it is slightly slower, but the resulting String type is to be preferred.
  • If your application must convert a large amount of data, it should reuse the output buffer. In this case, the GetCharsEx version that supports output character buffers is the best choice.
  • Consider using the Decoder.Convert method instead of GetCharCount. The conversion method converts as much data as possible and throws an exception if the output buffer is too small. For continuous decoding of a stream, this method is often the best choice.

Exceptions

Exception | Condition
ArgumentNullException | Bytes is null.
ArgumentOutOfRangeException | Index is less than the lower-bound of Bytes. -or- Count is less than zero. -or- Index and Count do not denote a valid range in Bytes.
DecoderFallbackException | A fallback occurred -and- DecoderFallback is set to DecoderExceptionFallback.

Examples

The following example encodes a string into an array of bytes, and then decodes the bytes into an array of characters.

Public Sub Main()
    Dim U32LE As Encoding
    Dim U32BE As Encoding
    Dim MyStr As String
    Dim BytesLE() As Byte
    Dim BytesBE() As Byte

    Set Console.OutputEncoding = Encoding.UTF8
    Set U32LE = Encoding.GetEncoding("utf-32")
    Set U32BE = Encoding.GetEncoding("utf-32BE")

    ' Use a string containing the following characters:
    '    Latin Small Letter Z (U+007A)
    '    Latin Small Letter A (U+0061)
    '    Combining Breve (U+0306)
    '    Latin Small Letter AE With Acute (U+01FD)
    '    Greek Small Letter Beta (U+03B2)
    MyStr = "za" & ChrW$(&H306) & ChrW$(&H1FD) & ChrW$(&H3B2)

    ' Encode the string using the big-endian byte order.
    BytesBE = U32BE.GetBytes(MyStr)

    ' Encode the string using the little-endian byte order.
    BytesLE = U32LE.GetBytes(MyStr)

    ' Get the char counts, and decode the byte arrays.
    Console.WriteValue "BE array with BE encoding : "
    PrintCountsAndChars BytesBE, U32BE
    Console.WriteValue "LE array with LE encoding : "
    PrintCountsAndChars BytesLE, U32LE

    Console.ReadKey
End Sub

Private Sub PrintCountsAndChars(ByRef Bytes() As Byte, ByVal Enc As Encoding)
    Dim CharCount As Long
    Dim MaxCount As Long
    Dim Chars() As Integer

    ' Display the name of the encoding used.
    Console.WriteValue "{0,-25} :", Enc.ToString

    ' Display the exact character count.
    CharCount = Enc.GetCharCount(Bytes)
    Console.WriteValue " {0,-3}", CharCount

    ' Display the maximum character count.
    MaxCount = Enc.GetMaxCharCount(CorArray.Length(Bytes))
    Console.WriteValue " {0,-3} :", MaxCount

    ' Decode the bytes and display the characters.
    Chars = Enc.GetChars(Bytes)
    Console.WriteLine NewString(Chars)
End Sub

' This example code produces the following output.
'
'BE array with BE encoding : CorLib.UTF32Encoding      : 5   12  :zăǽβ
'LE array with LE encoding : CorLib.UTF32Encoding      : 5   12  :zăǽβ

See Also

Project CorLib Overview

Class Encoding Overview

GetCharsEx

GetCharCount

GetMaxCharCount

GetDecoder

GetString


Encoding: GetCharsEx

GetCharsEx

When implemented in a derived class, decodes a sequence of bytes from the specified byte array into the specified character array.

 Public Function GetCharsEx(
      ByRef Bytes ( ) As Byte,
      ByVal ByteIndex As Long,
      ByVal ByteCount As Long,
      ByRef Chars ( ) As Integer,
      ByVal CharIndex As Long ) As Long

Parameters

Bytes
[ByRef] Byte. The byte array containing the sequence of bytes to decode.
ByteIndex
[ByVal] Long. The index of the first byte to decode.
ByteCount
[ByVal] Long. The number of bytes to decode.
Chars
[ByRef] Integer. The character array to contain the resulting set of characters.
CharIndex
[ByVal] Long. The index at which to start writing the resulting set of characters.

Return Values

Long - The actual number of characters written into Chars.

Remarks

To calculate the exact array size required by GetCharsEx to store the resulting characters, the application should use GetCharCount. To calculate the maximum array size, the application should use GetMaxCharCount. The GetCharCount method generally allows allocation of less memory, while the GetMaxCharCount method generally executes faster.

Encoding.GetCharsEx gets characters from an input byte sequence. Encoding.GetCharsEx is different than Decoder.GetChars because Encoding expects discrete conversions, while Decoder is designed for multiple passes on a single input stream.

If the data to be converted is available only in sequential blocks (such as data read from a stream) or if the amount of data is so large that it needs to be divided into smaller blocks, the application should use the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively, of a derived class.

Note This method is intended to operate on Unicode characters, not on arbitrary binary data, such as byte arrays. If your application needs to encode arbitrary binary data into text, it should use a protocol such as uuencode, which is implemented by methods such as Convert.ToBase64CharArray.

The GetCharCount method determines how many characters result in decoding a sequence of bytes, and the GetCharsEx method performs the actual decoding. The Encoding.GetCharsEx method expects discrete conversions, in contrast to the Decoder.GetChars method, which handles multiple passes on a single input stream.

Several versions of GetCharCount and GetCharsEx are supported. The following are some programming considerations for use of these methods:

  • The application might need to decode multiple input bytes from a code page and process the bytes using multiple calls. In this case, your application probably needs to maintain state between calls, because byte sequences can be interrupted when processed in batches. (For example, part of an ISO-2022 shift sequence may end one GetCharsEx call and continue at the beginning of the next GetCharsEx call. Encoding.GetCharsEx will call the fallback for those incomplete sequences, but Decoder will remember those sequences for the next call.)
  • If the application handles string outputs, it is recommended to use the GetString method. Since this method must check string length and allocate a buffer, it is slightly slower, but the resulting String type is to be preferred.
  • If your application must convert a large amount of data, it should reuse the output buffer. In this case, the GetCharsEx version that supports output character buffers is the best choice.
  • Consider using the Decoder.Convert method instead of GetCharCount. The conversion method converts as much data as possible and throws an exception if the output buffer is too small. For continuous decoding of a stream, this method is often the best choice.

Exceptions

Exception | Condition
ArgumentNullException | Bytes is uninitialized. -or- Chars is uninitialized.
ArgumentOutOfRangeException | ByteIndex is less than the lower-bound of Bytes. -or- CharIndex is less than the lower-bound of Chars. -or- ByteCount is less than zero. -or- ByteIndex and ByteCount do not denote a valie range in Bytes. -or- CharIndex is not a valid index in Chars
ArgumentException | Chars does not have enough capacity from CharIndex to the end of the array to accommodate the resulting characters.
DecoderFallbackException | A fallback occurred -and- DecoderFallback is set to DecoderExceptionFallback.

Examples

The following example converts a string from one encoding to another.

Public Sub Main()
    Dim UnicodeString   As String
    Dim ASCII           As Encoding
    Dim Unicode         As Encoding
    Dim UnicodeBytes()  As Byte
    Dim ASCIIBytes()    As Byte
    Dim ASCIIChars()    As Integer
    Dim ASCIIString     As String

    Set Console.OutputEncoding = Encoding.UTF8
    UnicodeString = "This string contains the unicode character Pi (" & ChrW$(&H3A0) & ")"

    ' Create two different encodings.
    Set ASCII = Encoding.ASCII
    Set Unicode = Encoding.Unicode

    ' Convert the string into a byte array.
    UnicodeBytes = Unicode.GetBytes(UnicodeString)

    ' Perform the conversion from one encoding to the other.
    ASCIIBytes = Encoding.Convert(Unicode, ASCII, UnicodeBytes)

    ' Convert the new byte array into a char array and then into a string.
    ReDim ASCIIChars(0 To ASCII.GetCharCount(ASCIIBytes) - 1)

    ASCII.GetCharsEx ASCIIBytes, 0, CorArray.Length(ASCIIBytes), ASCIIChars, 0
    ASCIIString = NewString(ASCIIChars)

    ' Display the strings created before and after the conversion.
    Console.WriteLine "Original string: {0}", UnicodeString
    Console.WriteLine "Ascii converted string: {0}", ASCIIString

    Console.ReadKey
End Sub

' This example code produces the following output.
'
'    Original string: This string contains the unicode character Pi (Π)
'    Ascii converted string: This string contains the unicode character Pi (?)

See Also

Project CorLib Overview

Class Encoding Overview

GetChars

GetCharCount

GetMaxCharCount

GetDecoder

GetString


Encoding: GetDecoder

GetDecoder

When implemented in a derived class, obtains a decoder that converts an encoded sequence of bytes into a sequence of characters.

 Public Function GetDecoder ( ) As Decoder

Return Values

Decoder - A Decoder that converts an encoded sequence of bytes into a sequence of characters.

Remarks

The Decoder.GetChars method converts sequential blocks of bytes into sequential blocks of characters, in a manner similar to the GetChars method of this class. However, a Decoder maintains state information between calls so it correctly decodes byte sequences that span blocks. The Decoder also preserves trailing bytes at the end of data blocks and uses the trailing bytes in the next decoding operation. Therefore, GetDecoder and GetEncoder are useful for network transmission and file operations, because those operations often deal with blocks of data instead of a complete data stream.

See Also

Project CorLib Overview

Class Encoding Overview

Decoder

GetChars

GetString

GetCharCount

GetEncoder


Encoding: GetEncoder

GetEncoder

When implemented in a derived class, obtains an encoder that converts a sequence of Unicode characters into an encoded sequence of bytes.

 Public Function GetEncoder ( ) As Encoder

Return Values

Encoder - A Encoder that converts a sequence of Unicode characters into an encoded sequence of bytes.

Remarks

The Encoder.GetBytes method converts sequential blocks of characters into sequential blocks of bytes, in a manner similar to the GetBytes method of this class. However, an Encoder maintains state information between calls so it correctly encodes character sequences that span blocks. The Encoder also preserves trailing characters at the end of data blocks and uses the trailing characters in the next encoding operation. For example, a data block might end with an unmatched high surrogate, and the matching low surrogate might be in the next data block. Therefore, GetDecoder and GetEncoder are useful for network transmission and file operations, because those operations often deal with blocks of data instead of a complete data stream.

See Also

Project CorLib Overview

Class Encoding Overview

Encoder

GetBytes

GetByteCount

GetDecoder


Encoding: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class Encoding Overview


Encoding: GetMaxByteCount

GetMaxByteCount

When implemented in a derived class, calculates the maximum number of bytes produced by encoding the specified number of characters.

 Public Function GetMaxByteCount(
      ByVal CharCount As Long ) As Long

Parameters

CharCount
[ByVal] Long. The number of characters to be encoded.

Return Values

Long -

Remarks

The CharCount parameter actually specifies the number of Char objects that represent the Unicode characters to encode, because Visual Basic 6 internally uses UTF-16 to represent Unicode characters. Consequently, most Unicode characters can be represented by one Char object, but a Unicode character represented by a surrogate pair, for example, requires two Char objects.

To calculate the exact array size required by GetBytes to store the resulting bytes, you should use the GetByteCount method. To calculate the maximum array size, use the GetMaxByteCount method. The GetByteCount method generally allows allocation of less memory, while the GetMaxByteCount method generally executes faster.

GetMaxByteCount retrieves a worst-case number, including the worst case for the currently selected EncoderFallback. If a fallback is chosen with a potentially large string, GetMaxByteCount retrieves large values, particularly in cases where the worst case for the encoding involves switching modes for every character.

In most cases, this method retrieves reasonable values for small strings. For large strings, you might have to choose between using very large buffers and catching errors in the rare case when a more reasonable buffer is too small. You might also want to consider a different approach using GetByteCount or Encoder.Convert.

When using GetMaxByteCount, you should allocate the output buffer based on the maximum size of the input buffer. If the output buffer is constrained in size, you might use the Convert method.

Note that GetMaxByteCount considers potential leftover surrogates from a previous decoder operation. Because of the decoder, passing a value of 1 to the method retrieves 2 for a single-byte encoding, such as ASCII. You should use the IsSingleByte property if this information is necessary.

Note
GetMaxByteCount(N) is not necessarily the same value as N* GetMaxByteCount(1).
Notes to Implementers

All Encoding implementations must guarantee that no buffer overflow exceptions occur if buffers are sized according to the results of this methods calculations.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | CharCount is less than zero.
EncoderFallbackException | A fallback occurred -and- EncoderFallback is set to EncoderExceptionFallback.

Examples

The following example determines the number of bytes required to encode a character array, encodes the characters, and displays the resulting bytes.

Public Sub Main()
    Dim MyChars() As Integer
    Dim U7 As Encoding
    Dim U8 As Encoding
    Dim U16LE As Encoding
    Dim U16BE As Encoding
    Dim U32 As Encoding

    ' The characters to encode:
    '    Latin Small Letter Z (U+007A)
    '    Latin Small Letter A (U+0061)
    '    Combining Breve (U+0306)
    '    Latin Small Letter AE With Acute (U+01FD)
    '    Greek Small Letter Beta (U+03B2)
    '    a high-surrogate value (U+D8FF)
    '    a low-surrogate value (U+DCFF)
    MyChars = NewChars("z", "a", &H306, &H1FD, &H3B2, &HD8FF, &HDCFF)

    ' Get different encodings.
    Set U7 = Encoding.UTF7
    Set U8 = Encoding.UTF8
    Set U16LE = Encoding.Unicode
    Set U16BE = Encoding.BigEndianUnicode
    Set U32 = Encoding.UTF32

    ' Encode the entire array, and print out the counts and the resulting bytes.
    PrintCountsAndBytes MyChars, U7
    PrintCountsAndBytes MyChars, U8
    PrintCountsAndBytes MyChars, U16LE
    PrintCountsAndBytes MyChars, U16BE
    PrintCountsAndBytes MyChars, U32

    Console.ReadKey
End Sub

Private Sub PrintCountsAndBytes(ByRef Chars() As Integer, ByVal Enc As Encoding)
    Dim BC As Long
    Dim MBC As Long
    Dim Bytes() As Byte

    ' Display the name of the encoding used.
    Console.WriteValue "{0,-30} :", Enc.ToString

    ' Display the exact byte count.
    BC = Enc.GetByteCount(Chars)
    Console.WriteValue " {0,-3}", BC

    ' Display the maximum byte count.
    MBC = Enc.GetMaxByteCount(CorArray.Length(Chars))
    Console.WriteValue " {0,-3} :", MBC

    ' Encode the array of chars.
    Bytes = Enc.GetBytes(Chars)

    ' Display all the encoded bytes.
    PrintHexBytes Bytes
End Sub

Private Sub PrintHexBytes(ByRef Bytes() As Byte)
    Dim i As Long

    For i = LBound(Bytes) To UBound(Bytes)
        Console.WriteValue "{0:X2} ", Bytes(i)
    Next

    Console.WriteLine
End Sub

'    This code produces the following output.
'
'    System.Text.UTF7Encoding       : 18  23  :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D
'    System.Text.UTF8Encoding       : 12  24  :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
'    System.Text.UnicodeEncoding    : 14  16  :7A 00 61 00 06 03 FD 01 B2 03 FF D8 FF DC
'    System.Text.UnicodeEncoding    : 14  16  :00 7A 00 61 03 06 01 FD 03 B2 D8 FF DC FF
'    System.Text.UTF32Encoding      : 24  32  :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00

See Also

Project CorLib Overview

Class Encoding Overview

GetBytes

GetByteCount


Encoding: GetMaxCharCount

GetMaxCharCount

Returns the maximum number of characters than can be decoded from the number of bytes specified.

 Public Function GetMaxCharCount(
      ByVal ByteCount As Long ) As Long

Parameters

ByteCount
[ByVal] Long. The number of bytes to be decoded.

Return Values

Long - The maximum number of characters that can be decoded from the specified number of bytes.

Remarks

To calculate the exact array size required by GetChars to store the resulting characters, the application should use GetCharCount. To calculate the maximum array size, it should use GetMaxCharCount. The GetCharCount method generally allows allocation of less memory, while the GetMaxCharCount method generally executes faster.

GetMaxCharCount retrieves a worst-case number, including the worst case for the currently selected DecoderFallback. If a fallback is chosen with a potentially large string, GetMaxCharCount retrieves large values.

In most cases, this method retrieves reasonable numbers for small strings. For large strings, you might have to choose between using very large buffers and catching errors in the rare case that a more reasonable buffer is too small. You might also want to consider a different approach using GetCharCount or Decoder.Convert.

GetMaxCharCount has no relation to GetBytes. If your application needs a similar function to use with GetBytes, it should use GetMaxByteCount.

When using GetMaxCharCount, your application should allocate the output buffer based on the maximum size of the input buffer. If the output buffer is constrained in size, the application might use the Convert method.

Note that GetMaxCharCount considers the worst case for leftover bytes from a previous encoder operation. For most code pages, passing a value of 0 to this method retrieves values greater than or equal to 1.

Note
GetMaxCharCount(N) is not necessarily the same value as N* GetMaxCharCount(1).
Note to Implementers

All Encoding implementations must guarantee that no buffer overflow exceptions occur if buffers are sized according to the results of this methods calculations.

Exception | Condition
ArgumentOutOfRangeException | ByteCount is less than zero.
DecoderFallbackException | A fallback occurrecd -and- DecoderFallback is set to DecoderExceptionFallback.

Examples

The following example encodes a string into an array of bytes, and then decodes the bytes into an array of characters.

Public Sub Main()
    Dim U32LE As Encoding
    Dim U32BE As Encoding
    Dim MyStr As String
    Dim ArrBE() As Byte
    Dim ArrLE() As Byte

    Set Console.OutputEncoding = Encoding.UTF8

    ' Create two instances of UTF32Encoding: one with little-endian byte order and one with big-ending byte order.
    Set U32LE = Encoding.GetEncoding("utf-32")
    Set U32BE = Encoding.GetEncoding("utf-32BE")

    ' Use a string containing the following characters:
    '    Latin Small Letter Z (U+007A)
    '    Latin Small Letter A (U+0061)
    '    Combining Breve (U+0306)
    '    Latin Small Letter AE With Acute (U+01FD)
    '    Greek Small Letter Beta (U+03B2)
    MyStr = t("za\u0306\u01FD\u03B2")

    ' Encode the string using the big-endian byte order.
    ArrBE = U32BE.GetBytes(MyStr)

    ' Encode the string using the little-endian byte order.
    ArrLE = U32LE.GetBytes(MyStr)

    ' Get the char counts, and decode the byte arrays.
    Console.WriteValue "BE array with BE encoding : "
    PrintCountsAndChars ArrBE, U32BE
    Console.WriteValue "LE array with LE encoding : "
    PrintCountsAndChars ArrLE, U32LE

    Console.ReadKey
End Sub

Private Sub PrintCountsAndChars(ByRef Bytes() As Byte, ByVal Enc As Encoding)
    Dim CC As Long
    Dim MCC As Long
    Dim Chars() As Integer

    ' Display the name of the encoding used.
    Console.WriteValue "{0,-25} :", Enc.ToString

    ' Display the exact character count.
    CC = Enc.GetCharCount(Bytes)
    Console.WriteValue " {0,-3}", CC

    ' Display the maximum character count.
    MCC = Enc.GetMaxCharCount(CorArray.Length(Bytes))
    Console.WriteValue " {0,-3} :", MCC

    ' Decode the bytes and display the characters.
    Chars = Enc.GetChars(Bytes)
    Console.WriteLine NewString(Chars)
End Sub

' This code produces the following output.
'
'    BE array with BE encoding : CorLib.UTF32Encoding      : 5   12  :zăǽß
'    LE array with LE encoding : CorLib.UTF32Encoding      : 5   12  :zăǽß

See Also

Project CorLib Overview

Class Encoding Overview

GetChars

GetString

GetCharCount

GetDecoder


Encoding: GetPreamble

GetPreamble

When implemented in a derived class, returns a sequence of bytes that specifies the encoding used.

 Public Function GetPreamble ( ) As Byte ( ) :

Return Values

Byte() - A byte array containg the bytes to be used to identify this encoding type.
-or-
A byte array of length zero, if a preamble is not required.

Remarks

Optionally, the Encoding object provides a preamble that is an array of bytes that can be prefixed to the sequence of bytes resulting from the encoding process. If the preamble contains a byte order mark (in Unicode, code point U+FEFF), it helps the decoder determine the byte order and the transformation format or UTF.

The Unicode byte order mark (BOM) is serialized as follows (in hexadecimal):

  • UTF-8: EF BB BF
  • UTF-16 big endian byte order: FE FF
  • UTF-16 little endian byte order: FF FE
  • UTF-32 big endian byte order: 00 00 FE FF
  • UTF-32 little endian byte order: FF FE 00 00

Your applications are recommended to use the BOM, because it provides nearly certain identification of an encoding for files that otherwise have lost reference to the Encoding object, for example, untagged or improperly tagged web data or random text files stored when a business did not have international concerns or other data. Often user problems might be avoided if data is consistently and properly tagged, preferably in UTF-8 or UTF-16.

For standards that provide an encoding type, a BOM is somewhat redundant. However, it can be used to help a server send the correct encoding header. Alternatively, it can be used as a fallback in case the encoding is otherwise lost.

There are some disadvantages to using a BOM. For example, knowing how to limit the database fields that use a BOM can be difficult. Concatenation of files can be a problem also, for example, when files are merged in such a way that an unnecessary character can end up in the middle of data. In spite of the few disadvantages, however, the use of a BOM is highly recommended.

For more information on byte order and the byte order mark, see The Unicode Standard at the Unicode home page.

Caution
To ensure that the encoded bytes are decoded properly, your application should prefix encoded bytes with a preamble. However, most encodings do not provide a preamble. To ensure that the encoded bytes are decoded properly, the application should use a Unicode encoding, that is, UTF8Encoding, UnicodeEncoding, or UTF32Encoding, with a preamble.

Examples

The following example determines the byte order of the encoding based on the preamble.

Public Sub Main()
    Dim Unicode As Encoding
    Dim Preamble() As Byte

    Set Unicode = Encoding.Unicode

    ' Get the preamble for the Unicode encoder.
    ' In this case the preamble contains the byte order mark (BOM).
    Preamble = Unicode.GetPreamble

    ' Make sure a preamble was returned
    ' and is large enough to contain a BOM.
    If CorArray.Length(Preamble) >= 2 Then
        If Preamble(0) = &HFE And Preamble(1) = &HFF Then
            Debug.Print "The Unicode encoder is encoding in big-endian order."
        ElseIf Preamble(0) = &HFF And Preamble(1) = &HFE Then
            Debug.Print "The Unicode encoder is encoding in little-endian order."
        End If
    End If
End Sub

' This code produces the following output.
'
'   The Unicode encoder is encoding in little-endian order.

See Also

Project CorLib Overview

Class Encoding Overview


Encoding: GetString

GetString

When implemented in a derived class, decodes all the bytes in the specified byte array into a string.

 Public Function GetString(
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As String

Parameters

Bytes
[ByRef] Byte. The byte array containing the sequence of bytes to decode.
Index
[ByRef] Optional. Variant. The index of the first byte to decode.
Count
[ByRef] Optional. Variant. The number of bytes to decode.

Return Values

String - A String containing the results of decoding the specified sequence of bytes.

Remarks

If the data to be converted is available only in sequential blocks (such as data read from a stream) or if the amount of data is so large that it needs to be divided into smaller blocks, the application should use the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively, of a derived class.

See the Remarks under Encoding.GetChars for more discussion of decoding techniques and considerations.

Exceptions

Exception | Condition
ArgumentException | The byte array contains invalid Unicode code points.
ArgumentNullException | Bytes is uninitialized.
ArgumentOutOfRangeException | Index is less than the lower-bound of Bytes. -or- Count is less than zero. -or- Index and Count do not denote a valid range in Bytes.
DecoderFallbackException | A fallback occurred -and- DecoderFallback is set to DecoderExceptionFallback.

Examples

The following example converts a string from one encoding to another.

Public Sub Main()
    Dim UnicodeString   As String
    Dim ASCII           As Encoding
    Dim Unicode         As Encoding
    Dim UnicodeBytes()  As Byte
    Dim ASCIIBytes()    As Byte
    Dim ASCIIChars()    As Integer
    Dim ASCIIString     As String

    Set Console.OutputEncoding = Encoding.UTF8
    UnicodeString = "This string contains the unicode character Pi (" & ChrW$(&H3A0) & ")"

    ' Create two different encodings.
    Set ASCII = Encoding.ASCII
    Set Unicode = Encoding.Unicode

    ' Convert the string into a byte array.
    UnicodeBytes = Unicode.GetBytes(UnicodeString)

    ' Perform the conversion from one encoding to the other.
    ASCIIBytes = Encoding.Convert(Unicode, ASCII, UnicodeBytes)

    ' Convert the new byte array into a string.
    ASCIIString = ASCII.GetString(ASCIIBytes)

    ' Display the strings created before and after the conversion.
    Console.WriteLine "Original string: {0}", UnicodeString
    Console.WriteLine "Ascii converted string: {0}", ASCIIString

    Console.ReadKey
End Sub

' This example code produces the following output.
'
'    Original string: This string contains the unicode character Pi (Π)
'    Ascii converted string: This string contains the unicode character Pi (?)

See Also

Project CorLib Overview

Class Encoding Overview

GetChars

GetDecoder

GetCharCount

GetMaxCharCount


Encoding: HeaderName (get)

HeaderName

Returns the encoding name to be used in with the mail agent header tags.

 Public Property Get HeaderName ( ) As String

Return Values

String - The header tag compatible encoding name.

Read Only.

See Also

Project CorLib Overview

Class Encoding Overview


Encoding: IsBrowserDisplay (get)

IsBrowserDisplay

Indicates if this encoding can be used by browsers to display text.

 Public Property Get IsBrowserDisplay ( ) As Boolean

Return Values

Boolean - The indication for browser display capable.

Read Only.

See Also

Project CorLib Overview

Class Encoding Overview


Encoding: IsBrowserSave (get)

IsBrowserSave

Indicates if this encoding can be used to save data with this encoding.

 Public Property Get IsBrowserSave ( ) As Boolean

Return Values

Boolean - The indication for the browser saving capable.

Read Only.

See Also

Project CorLib Overview

Class Encoding Overview


Encoding: IsMailNewsDisplay (get)

IsMailNewsDisplay

Indicates if this encoding can be used to display mail and news by mail and news clients.

 Public Property Get IsMailNewsDisplay ( ) As Boolean

Return Values

Boolean - Indication for mail and news client capable.

Read Only.

See Also

Project CorLib Overview

Class Encoding Overview


Encoding: IsMailNewsSave (get)

IsMailNewsSave

Indicates if this encoding can be used to save date by mail and news clients.

 Public Property Get IsMailNewsSave ( ) As Boolean

Return Values

Boolean - Indication for the mail and news clients to use this encoding for saving.

Read Only.

See Also

Project CorLib Overview

Class Encoding Overview


Encoding: IsReadOnly (get)

IsReadOnly

When implemented in a derived class, gets a value indicating whether the current encoding is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - True if the current Encoding is read-only; otherwise, False. The default is True.

Read Only.

See Also

Project CorLib Overview

Class Encoding Overview


Encoding: IsSingleByte (get)

IsSingleByte

Returns if the current encoding uses single-byte code points.

 Public Property Get IsSingleByte ( ) As Boolean

Return Values

Boolean - Returns True for single-byte, False for multi-byte code points.

Read Only.

See Also

Project CorLib Overview

Class Encoding Overview


Encoding: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class Encoding Overview


Encoding: WebName (get)

WebName

Returns the encoding name registered with the Internet Assigned Numbers Authority.

 Public Property Get WebName ( ) As String

Return Values

String - The registered encoding name.

Read Only.

See Also

Project CorLib Overview

Class Encoding Overview


Encoding: WindowsCodePage (get)

WindowsCodePage

Returns the Windows Operating Systems code page for this encoding.

 Public Property Get WindowsCodePage ( ) As Long

Return Values

Long - The Windows code page for this encoding.

Read Only.

See Also

Project CorLib Overview

Class Encoding Overview


EncodingInfo

EncodingInfo

Contains information about a specific encoding.

Implements:

IObject

Public:

Properties:

Name | Description
CodePage (get) | Returns the code page for the specific encoding.
DisplayName (get) | Returns the displayable name of the encoding.
Name (get) | Returns the normal name of the encoding.

Methods:

Name | Description
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetEncoding | Returns an encoding object that used the code page specified by this encoding.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides. A Person class may return the persons name instead.

See Also

Project CorLib Overview

Class EncodingInfo Overview


EncodingInfo: CodePage (get)

CodePage

Returns the code page for the specific encoding.

 Public Property Get CodePage ( ) As Long

Return Values

Long - The code page.

Read Only.

See Also

Project CorLib Overview

Class EncodingInfo Overview


EncodingInfo: DisplayName (get)

DisplayName

Returns the displayable name of the encoding.

 Public Property Get DisplayName ( ) As String

Return Values

String - A displayable name.

Read Only.

See Also

Project CorLib Overview

Class EncodingInfo Overview


EncodingInfo: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test for equality.

Return Values

Boolean - Returns True if they value is equal, False otherwise.

See Also

Project CorLib Overview

Class EncodingInfo Overview


EncodingInfo: GetEncoding

GetEncoding

Returns an encoding object that used the code page specified by this encoding.

 Public Function GetEncoding ( ) As Encoding

Return Values

Encoding - A new encoding object using the code page of this encoding.

See Also

Project CorLib Overview

Class EncodingInfo Overview


EncodingInfo: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long -

See Also

Project CorLib Overview

Class EncodingInfo Overview


EncodingInfo: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class EncodingInfo Overview


EncodingInfo: Name (get)

Name

Returns the normal name of the encoding.

 Public Property Get Name ( ) As String

Return Values

String - The normal encoding name.

Read Only.

See Also

Project CorLib Overview

Class EncodingInfo Overview


EncodingInfo: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

A Person class may return the persons name instead.

 Public Function ToString ( ) As String

Return Values

String -

See Also

Project CorLib Overview

Class EncodingInfo Overview


EncodingStatic

EncodingStatic

Provides static methods used to retrieve existing encodings and convert between encodings.

Public:

Properties:

Name | Description
ASCII (get) | Gets an encoding for the ASCII (7-bit) character set.
BigEndianUnicode (get) | Gets an encoding for the UTF-16 format that uses the big endian byte order.
Default (get) | Gets an encoding for the operating systems current ANSI code page.
Unicode (get) | Gets an encoding for the UTF-16 format using the little endian byte order.
UTF32 (get) | Gets an encoding for the UTF-32 format using the little endian byte order.
UTF7 (get) | Gets an encoding for the UTF-7 format.
UTF8 (get) | Gets an encoding for the UTF-8 format.

Methods:

Name | Description
Convert | Converts a set of bytes from one encoding to another encoding.
GetEncoding | Returns the encoding associated with the specified code page identifier or name. Optional parameters specify an error handler for characters that cannot be encoded and byte sequences that cannot be decoded.
GetEncodings | Returns a list of minimal information about each encoding.

Remarks

Encoding is the process of transforming a set of Unicode characters into a sequence of bytes. In contrast, decoding is the process of transforming a sequence of encoded bytes into a set of Unicode characters.

Note that Encoding is intended to operate on Unicode characters instead of arbitrary binary data, such as byte arrays. If your application must encode arbitrary binary data into text, it should use a protocol such as uuencode, which is implemented by methods such as Convert.ToBase64CharArray.

VBCorLib provides the following implementations of the Encoding class to support current Unicode encodings and other encodings:

  • ASCIIEncoding encodes Unicode characters as single 7-bit ASCII characters. This encoding only supports character values between U+0000 and U+007F. Code page 20127. Also available through the ASCII property.
  • UTF7Encoding encodes Unicode characters using the UTF-7 encoding. This encoding supports all Unicode character values. Code page 65000. Also available through the UTF7 property.
  • UTF8Encoding encodes Unicode characters using the UTF-8 encoding. This encoding supports all Unicode character values. Code page 65001. Also available through the UTF8 property.
  • UnicodeEncoding encodes Unicode characters using the UTF-16 encoding. Both little endian and big endian byte orders are supported. Also available through the Unicode property and the BigEndianUnicode property.
  • UTF32Encoding encodes Unicode characters using the UTF-32 encoding. Both little endian (code page 12000) and big endian (code page 12001) byte orders are supported. Also available through the UTF32 property.

The Encoding class is primarily intended to convert between different encodings and Unicode. Often one of the derived Unicode classes is the correct choice for your application.

Your applications use the GetEncoding method to obtain other encodings. They should use the GetEncodings method to get a list of all encodings.

If the data to be converted is available only in sequential blocks (such as data read from a stream) or if the amount of data is so large that it needs to be divided into smaller blocks, your application should use the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively, of a derived class.

The UTF-16 and the UTF-32 encoders can use the big endian byte order (most significant byte first) or the little endian byte order (least significant byte first). For example, the Latin Capital Letter A (U+0041) is serialized as follows (in hexadecimal):

  • UTF-16 big endian byte order: 00 41
  • UTF-16 little endian byte order: 41 00
  • UTF-32 big endian byte order: 00 00 00 41
  • UTF-32 little endian byte order: 41 00 00 00

The GetPreamble method retrieves an array of bytes that includes the byte order mark (BOM). If this byte array is prefixed to an encoded stream, it helps the decoder to identify the encoding format used.

For more information on byte order and the byte order mark, see The Unicode Standard at the Unicode home page.

Note that the encoding classes allow errors to:

  • Silently change to a "?" character.
  • Use a "best fit" character.
  • Change to an application-specific behavior through use of the EncoderFallback and DecoderFallback classes with the U+FFFD Unicode replacement character.

Your applications are recommended to throw exceptions on all data stream errors. An application either uses a "throwonerror" flag when applicable or uses the EncoderExceptionFallback and DecoderExceptionFallback classes. Best fit fallback is often not recommended because it can cause data loss or confusion and is slower than simple character replacements. For ANSI encodings, the best fit behavior is the default.

Examples

The following example converts a string from one encoding to another.

Public Sub Main()
    Dim UnicodeString   As String
    Dim AsciiEncoding   As Encoding
    Dim UnicodeEncoding As Encoding
    Dim AsciiBytes()    As Byte
    Dim UnicodeBytes()  As Byte
    Dim AsciiChars()    As Integer
    Dim AsciiString     As String

    Set Console.OutputEncoding = Encoding.UTF8
    UnicodeString = t("This string contains the unicode character Pi (\u03a0)")

    ' Create two different encodings.
    Set AsciiEncoding = Encoding.ASCII
    Set UnicodeEncoding = Encoding.Unicode

    ' Convert the string into a byte array.
    UnicodeBytes = UnicodeEncoding.GetBytes(UnicodeString)

    ' Perform the convertion from one encoding to the other.
    AsciiBytes = Encoding.Convert(UnicodeEncoding, AsciiEncoding, UnicodeBytes)

    ' Convert the new Byte() into a Char() and then into a string.
    AsciiChars = AsciiEncoding.GetChars(AsciiBytes)
    AsciiString = NewString(AsciiChars)

    ' Display the strings created before and after the conversion.
    Console.WriteLine "Original string: " & UnicodeString
    Console.WriteLine "Ascii converted string: " & AsciiString
    Console.ReadKey
End Sub

' This example code produces the following output.
'
'    Original string: This string contains the unicode character Pi (Π)
'    Ascii converted string: This string contains the unicode character Pi (?)

See Also

Project CorLib Overview

Class EncodingStatic Overview

Encoding

ASCIIEncoding

UTF7Encoding

UTF8Encoding

UTF32Encoding

UnicodeEncoding


EncodingStatic: ASCII (get)

ASCII

Gets an encoding for the ASCII (7-bit) character set.

 Public Property Get ASCII ( ) As ASCIIEncoding

Return Values

ASCIIEncoding - An encoding for the ASCII (7-bit) character set.

Remarks

ASCII characters are limited to the lowest 128 Unicode characters, from U+0000 to U+007F.

When selecting the ASCII encoding for your applications, consider the following:

  • The ASCII encoding is usually appropriate for protocols that require ASCII.
  • If your application requires 8-bit encoding (which is sometimes incorrectly referred to as "ASCII"), the UTF-8 encoding is recommended over the ASCII encoding. For the characters 0-7F, the results are identical, but use of UTF-8 avoids data loss by allowing representation of all Unicode characters that are representable. Note that the ASCII encoding has an 8th bit ambiguity that can allow malicious use, but the UTF-8 encoding removes ambiguity about the 8th bit.

The ASCIIEncoding object that is returned by this property might not have the appropriate behavior for your application. It uses replacement fallback to replace each string that it cannot encode and each byte that it cannot decode with a question mark ("?") character. Instead, you can call the GetEncoding method to instantiate an ASCIIEncoding object whose fallback is either an EncoderFallbackException or a DecoderFallbackException, as the following example illustrates.

Public Sub Main()
    Dim Enc     As Encoding
    Dim Value   As String
    Dim Value2  As String
    Dim Bytes() As Byte
    Dim Byt     As Variant

    Set Enc = Encoding.GetEncoding("us-ascii", New EncoderExceptionFallback, New DecoderExceptionFallback)
    Value = t("\u00C4 \u00F6 \u00AE")

    On Error GoTo Catch
    Bytes = Enc.GetBytes(Value)

    For Each Byt In Bytes
        Debug.Print Object.ToString(Byt, "X2")
    Next
    Debug.Print

    Value2 = Enc.GetString(Bytes)
    Debug.Print Value2
    Exit Sub

Catch:
    Dim Ex As EncoderFallbackException
    Catch Ex, Err

    Debug.Print CorString.Format("Unable to encode {0} at index {1}", IIf(Ex.CharUnknownHigh <> 0, _
                                CorString.Format("U+{0:X4} U+{1:X4}", Ex.CharUnknownHigh, Ex.CharUnknownLow), _
                                CorString.Format("U+{0:X4}", Ex.CharUnknown)), _
                                Ex.Index)
End Sub

' This example displays the following output:
'       Unable to encode U+00C4 at index 0

Read Only.

Examples

The following example demonstrates the effect of the ASCII encoding on characters that are outside the ASCII range.

Public Sub Main()
    Dim ASCII           As Encoding
    Dim UnicodeString   As String
    Dim IndexOfPi       As Long
    Dim IndexOfSigma    As Long
    Dim EncodedBytes()  As Byte
    Dim DecodedString   As String
    Dim b As Variant

    Set Console.OutputEncoding = Encoding.UTF8
    Set ASCII = Encoding.ASCII

    ' A Unicode string with two characters outside the ASCII code range.
    UnicodeString = t("This unicode string contains two characters with codes outside the ASCII code range, Pi (\u03a0) and Sigma (\u03a3).")
    Console.WriteLine "Original string:"
    Console.WriteLine UnicodeString

    ' Save the positions of the special characters for later reference.
    IndexOfPi = InStr(UnicodeString, ChrW$(&H3A0))
    IndexOfSigma = InStr(UnicodeString, ChrW$(&H3A3))

    ' Encode the string.
    EncodedBytes = ASCII.GetBytes(UnicodeString)
    Console.WriteLine
    Console.WriteLine "Encoded bytes:"

    For Each b In EncodedBytes
        Console.WriteValue "[{0}]", b
    Next
    Console.WriteLine

    ' Notice that the special characters have been replaced with
    ' the value 63, which is the ASCII character code for '?'.
    Console.WriteLine
    Console.WriteLine "Value as position of Pi character: {0}", EncodedBytes(IndexOfPi - 1)
    Console.WriteLine "Value as position of Sigma character: {0}", EncodedBytes(IndexOfSigma - 1)

    ' Decode bytes back to a string.
    ' Notice missing the Pi and Sigma characters.
    DecodedString = ASCII.GetString(EncodedBytes)
    Console.WriteLine
    Console.WriteLine "Decoded bytes:"
    Console.WriteLine DecodedString
    Console.ReadKey
End Sub

' This example displays the following output:
'
' Original string:
' This unicode string contains two characters with codes outside the ASCII code range, Pi (Π) and Sigma (Σ).
'
' Encoded Bytes:
' [84][104][105][115][32][117][110][105][99][111][100][101][32][115][116][114][105][110][103][32][99][111][110][116][97][105][110][115][32][116][119][111][32][99][104][97][114][97][99][116][101][114][115][32][119][105][116][104][32][99][111][100][101][115][32][111][117][116][115][105][100][101][32][116][104][101][32][65][83][67][73][73][32][99][111][100][101][32][114][97][110][103][101][44][32][80][105][32][40][63][41][32][97][110][100][32][83][105][103][109][97][32][40][63][41][46]
'
' Value at position of Pi character: 63
' Value at position of Sigma character: 63
'
' Decoded Bytes:
' This unicode string contains two characters with codes outside the ASCII code range, Pi (?) and Sigma (?).

See Also

Project CorLib Overview

Class EncodingStatic Overview


EncodingStatic: BigEndianUnicode (get)

BigEndianUnicode

Gets an encoding for the UTF-16 format that uses the big endian byte order.

 Public Property Get BigEndianUnicode ( ) As UnicodeEncoding

Return Values

UnicodeEncoding - An encoding object for the UTF-16 format that uses the big endian byte order.

Remarks

The UnicodeEncoding object that is returned by this property may not have the appropriate behavior for your application. It uses replacement fallback to replace each string that it cannot encode and each byte that it cannot decode with a question mark ("?") character. Instead, you can call the NewUnicodeEncoding(Boolean, Boolean, Boolean) constructor to instantiate a big endian UnicodeEncoding object whose fallback is either an EncoderFallbackException or a DecoderFallbackException, as the following example illustrates.

Public Sub Main()
    Dim Bytes() As Byte
    Dim Enc     As UnicodeEncoding
    Dim Value   As String

    Bytes = NewBytes(&H0, &H20, &HD8, &H1, &H0, &H68, &HA7, &H0)
    Set Enc = NewUnicodeEncoding(True, True, True)

    On Error GoTo Catch
    Value = Enc.GetString(Bytes)
    Debug.Print CorString.Format("'{0}'", Value)
    Exit Sub

Catch:
    Dim Ex As DecoderFallbackException

    Catch Ex, Err
    Debug.Print CorString.Format("Unable to decode {0} at index {1}", ShowBytes(Ex.BytesUnknown), Ex.Index)
End Sub

Private Function ShowBytes(ByRef Bytes() As Byte) As String
    Dim Byt As Variant
    Dim ReturnString As New StringBuilder

    For Each Byt In Bytes
        ReturnString.AppendFormat "0x{0:X2} ", Byt
    Next

    ShowBytes = Trim$(ReturnString.ToString)
End Function

' The example displays the following output:
'        Unable to decode 0xD8 0x01 at index 4

Read Only.

Examples

The following example reads a text file with a UTF-16 encoding using the big endian byte order.

Public Sub Main()
    Dim Reader  As StreamReader
    Dim Line    As String

    Set Reader = NewStreamReader("TextFile.txt", Encoding.BigEndianUnicode)

    Line = Reader.ReadLine

    Do While Not CorString.IsNull(Line)
        Debug.Print Line
        Line = Reader.ReadLine
    Loop
End Sub

The following example determines the number of bytes required to encode a character array, encodes the characters, and displays the resulting bytes.

Public Sub Main()
    Dim Chars() As Integer
    Dim U7      As Encoding
    Dim U8      As Encoding
    Dim U16LE   As Encoding
    Dim U16BE   As Encoding
    Dim U32     As Encoding

    ' The characters to encode:
    '    Latin Small Letter Z (U+007A)
    '    Latin Small Letter A (U+0061)
    '    Combining Breve (U+0306)
    '    Latin Small Letter AE With Acute (U+01FD)
    '    Greek Small Letter Beta (U+03B2)
    '    a high-surrogate value (U+D8FF)
    '    a low-surrogate value (U+DCFF)
    Chars = NewChars("z", "a", ChrW$(&H306), ChrW$(&H1FD), ChrW$(&H3B2), ChrW$(&HD8FF), ChrW$(&HDCFF))

    Set U7 = Encoding.UTF7
    Set U8 = Encoding.UTF8
    Set U16LE = Encoding.Unicode
    Set U16BE = Encoding.BigEndianUnicode
    Set U32 = Encoding.UTF32

    PrintCountsAndBytes Chars, U7
    PrintCountsAndBytes Chars, U8
    PrintCountsAndBytes Chars, U16LE
    PrintCountsAndBytes Chars, U16BE
    PrintCountsAndBytes Chars, U32
End Sub

Private Sub PrintCountsAndBytes(ByRef Chars() As Integer, ByVal Enc As Encoding)
    Dim IBC     As Long
    Dim IMBC    As Long
    Dim Bytes() As Byte

    Debug.Print CorString.Format("{0,-30} :", Enc.ToString);

    IBC = Enc.GetByteCount(Chars)
    Debug.Print CorString.Format(" {0,-3}", IBC);

    IMBC = Enc.GetMaxByteCount(CorArray.Length(Chars))
    Debug.Print CorString.Format(" {0, -3} :", IMBC);

    Bytes = Enc.GetBytes(Chars)

    PrintHexBytes Bytes
End Sub

Private Sub PrintHexBytes(ByRef Bytes() As Byte)
    Dim i As Long

    If CorArray.IsNullOrEmpty(Bytes) Then
        Debug.Print "<none>"
    Else
        For i = 0 To UBound(Bytes)
            Debug.Print CorString.Format("{0:X2} ", Bytes(i));
        Next

        Debug.Print
    End If
End Sub

' This code produces the following output.
'
'    CorLib.UTF7Encoding            : 18  23  :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D
'    CorLib.UTF8Encoding            : 12  24  :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
'    CorLib.UnicodeEncoding         : 14  16  :7A 00 61 00 06 03 FD 01 B2 03 FF D8 FF DC
'    CorLib.UnicodeEncoding         : 14  16  :00 7A 00 61 03 06 01 FD 03 B2 D8 FF DC FF
'    CorLib.UTF32Encoding           : 24  32  :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00

See Also

Project CorLib Overview

Class EncodingStatic Overview


EncodingStatic: Convert

Convert

Converts a set of bytes from one encoding to another encoding.

 Public Function Convert(
      ByVal SrcEncoding As Encoding,
      ByVal DstEncoding As Encoding,
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

SrcEncoding
[ByVal] Encoding. The encoding of the source array, Bytes.
DstEncoding
[ByVal] Encoding. The encoding of the output array.
Bytes
[ByRef] Byte. The array of bytes to convert.
Index
[ByRef] Optional. Variant. The index of the first element of Bytes to convert.
Count
[ByRef] Optional. Variant. The number of bytes to convert.

Return Values

Byte() - An array of bytes containing the result of converting a range of bytes in bytes from SrcEncoding to DstEncoding.

Exceptions

Exception | Condition
ArgumentNullException | SrcEncoding is Nothing. -or- DstEncoding is Nothing. -or- Bytes is uninitialized.
ArgumentOutOfRangeException | Index and Count do not specify a valid range in the byte array.
DecoderFallbackException | A fallback occurred -and- SrcEncoding.DecoderFallback is set to DecoderExceptionFallback.
EncoderFallbackException | A fallback occurred -and- DstEncoding.EncoderFallback is set to EncoderExceptionFallback.

See Also

Project CorLib Overview

Class EncodingStatic Overview


EncodingStatic: Default (get)

Default

Gets an encoding for the operating systems current ANSI code page.

 Public Property Get Default ( ) As Encoding

Return Values

Encoding - An encoding for the operating systems current ANSI code page.

Remarks

Caution
Different computers can use different encodings as the default, and the default encoding can even change on a single computer. Therefore, data streamed from one computer to another or even retrieved at different times on the same computer might be translated incorrectly. In addition, the encoding returned by the Default property uses best-fit fallback to map unsupported characters to characters supported by the code page. For these two reasons, using the default encoding is generally not recommended. To ensure that encoded bytes are decoded properly, your application should use a Unicode encoding, such as UTF8Encoding or UnicodeEncoding, with a preamble. Another option is to use a higher-level protocol to ensure that the same format is used for encoding and decoding.

The system ANSI code page defined by Default covers the ASCII set of characters, but the encoding is different from the encoding for ASCII. Because all Default encodings lose data, your application might use UTF8 instead. UTF-8 is often identical in the U+00 to U+7F range, but can encode other characters without loss.

Read Only.

See Also

Project CorLib Overview

Class EncodingStatic Overview


EncodingStatic: GetEncoding

GetEncoding

Returns the encoding associated with the specified code page identifier or name. Optional parameters specify an error handler for characters that cannot be encoded and byte sequences that cannot be decoded.

 Public Function GetEncoding(
      ByRef CodePageOrName As Variant,
      Optional ByVal EncoderFallback As EncoderFallback,
      Optional ByVal DecoderFallback As DecoderFallback ) As Encoding

Parameters

CodePageOrName
[ByRef] Variant. The code page number or name to encode with or 0 (zero) to use the default encoding.
EncoderFallback
[ByVal] Optional. EncoderFallback. An object that provides an error-handling procedure when a character cannot be encoded with the current encoding.
DecoderFallback
[ByVal] Optional. DecoderFallback. An object that provides an error-handling procedure when a byte sequence cannot be decoded with the current encoding.

Return Values

Encoding - An encoding for a specific codepage or name.

Remarks

Note
Some unsupported code pages cause the exception ArgumentException to be thrown, whereas others cause NotSupportedException. Therefore, your code must catch all exceptions indicated in the Exceptions section.

The GetEncoding method relies on the underlying platform to support most code pages. However, VBCorLib natively supports some encodings.

Note
The ANSI code pages can be different on different computers, or can be changed for a single computer, leading to data corruption. For this reason, we do not recommend encoding and decoding data by using the default code page returned by Encoding.GetEncoding(0). For the most consistent results, use Unicode, such as UTF-8 (code page 65001) or UTF-16, instead of a specific code page.

To get the encoding associated with the default ANSI code page in the operating systems regional and language settings, you can either use a setting of 0 for the codepage parameter or use the Default property. To determine the default code pages used on the system, use the Windows GetSystemDefaultLangID function. To determine the current ANSI code page, use the Windows GetACP function.

GetEncoding returns a cached instance with default settings. The application should use the constructors of derived classes to get an instance with different settings. For example, the UTF32Encoding class provides a constructor that lets you enable error detection.

Exceptions

Exception | Condition
ArgumentException | CodePageOrName is not a valid code page. -or- The code page indicated by CodePageOrName is not supported by the underlying platform.

Examples

The following example demonstrates the Encoding.GetEncoding(String, EncoderFallback, DecoderFallback) method.

Public Sub Main()
    Dim ae              As Encoding
    Dim InputString     As String
    Dim EncodedBytes()  As Byte
    Dim DecodedString   As String
    Dim NumBytes        As Long
    Dim b               As Variant
    Dim c               As Variant
    Dim ix              As Long

    Set Console.OutputEncoding = Encoding.UTF8

    ' Create an encoding, which is equivalent to calling the
    ' ASCIIEncoding class constructor.
    ' The EncoderReplacementFallback parameter specifies that the
    ' string, "(unknown)", replace characters that cannot be encoded.
    ' A decoder replacement fallback is also specified, but in this
    ' code example the decoding operation cannot fail.
    Set ae = Encoding.GetEncoding("us-ascii", NewEncoderReplacementFallback("(unknown)"), NewDecoderReplacementFallback("(error)"))

    ' The input string consists of the Unicode characters LEFT POINTING
    ' DOUBLE ANGLE QUOTATION MARK (U+00AB), 'X' (U+0058), and RIGHT POINTING
    ' DOUBLE ANGLE QUOTATION MARK (U+00BB).
    ' The encoding can only encode characters in the US-ASCII range of U+0000
    ' through U+007F. Consequently, the characters bracketing the 'X' character
    ' are replaced with the fallback replacement string, "(unknown)".
    InputString = t("\u00abX\u00bb")

    ReDim EncodedBytes(0 To ae.GetByteCount(InputString) - 1)

    ' Display the name of encoding.
    Console.WriteLine "The name of the encoding is ""{0}"".{1}", ae.WebName, vbCrLf

    ' Display the input string text.
    Console.WriteLine "Input string ({0} characters): ""{1}""", Len(InputString), InputString

    ' Display the input string in hexadecimal.
    Console.WriteValue "Input string in hexadecimal: "

    For Each c In CorString.ToCharArray(InputString)
        Console.WriteValue "0x{0:X2} ", c
    Next

    ' Encode the input string.
    Console.WriteLine "Encode the input string..."
    NumBytes = ae.GetBytesEx(InputString, 0, Len(InputString), EncodedBytes, 0)

    ' Display the encoded bytes.
    Console.WriteLine "Encoded bytes in hexadecimal ({0} bytes):{1}", NumBytes, vbCrLf

    For Each b In EncodedBytes
        Console.WriteValue "0x{0:X2} ", b
        ix = ix + 1

        If ix Mod 6 = 0 Then
            Console.WriteLine
        End If
    Next

    Console.WriteLine vbCrLf

    ' Decode the encoded bytes, yielding a reconstituted string.
    DecodedString = ae.GetString(EncodedBytes)

    ' Display then input string and the decoded string for comparison
    Console.WriteLine "Input string: ""{0}""", InputString
    Console.WriteLine "Decoded string: ""{0}""", DecodedString

    Console.ReadKey
End Sub

' This code produces the following output.
'
'    The name of the encoding is "us-ascii".
'
'    Input string (3 characters): "«X»"
'    Input string in hexadecimal: 0xAB 0x58 0xBB
'
'    Encode the input string...
'    Encoded bytes in hexadecimal (19 bytes):
'
'    0x28 0x75 0x6E 0x6B 0x6E 0x6F
'    0x77 0x6E 0x29 0x58 0x28 0x75
'    0x6E 0x6B 0x6E 0x6F 0x77 0x6E
'    0x29
'
'    Decode the encoded bytes...
'    Input string:  "«X»"
'    Decoded string:"(unknown)X(unknown)"

See Also

Project CorLib Overview

Class EncodingStatic Overview


EncodingStatic: GetEncodings

GetEncodings

Returns a list of minimal information about each encoding.

 Public Function GetEncodings ( ) As EncodingInfo ( )

Return Values

EncodingInfo() - An array of classes containing a minimal of information.

See Also

Project CorLib Overview

Class EncodingStatic Overview


EncodingStatic: Unicode (get)

Unicode

Gets an encoding for the UTF-16 format using the little endian byte order.

 Public Property Get Unicode ( ) As UnicodeEncoding

Return Values

UnicodeEncoding - An encoding for the UTF-16 format using the little endian byte order.

Remarks

The UnicodeEncoding object that is returned by this property may not have the appropriate behavior for your application. It uses replacement fallback to replace each string that it cannot encode and each byte that it cannot decode with a question mark ("?") character. Instead, you can call the NewUnicodeEncoding(Boolean, Boolean, Boolean) constructor to instantiate a little endian UnicodeEncoding object whose fallback is either an EncoderFallbackException or a DecoderFallbackException, as the following example illustrates.

Public Sub Main()
    Dim Bytes() As Byte
    Dim Enc     As UnicodeEncoding
    Dim Value   As String

    Bytes = NewBytes(&H20, &H0, &H1, &HD8, &H68, &H0, &HA7, &H0)
    Set Enc = NewUnicodeEncoding(False, True, True)

    On Error GoTo Catch
    Value = Enc.GetString(Bytes)
    Debug.Print CorString.Format("'{0}'", Value)
    Exit Sub

Catch:
    Dim Ex As DecoderFallbackException

    Catch Ex, Err
    Debug.Print CorString.Format("Unable to decode {0} at index {1}", ShowBytes(Ex.BytesUnknown), Ex.Index)
End Sub

Private Function ShowBytes(ByRef Bytes() As Byte) As String
    Dim Byt As Variant
    Dim ReturnString As New StringBuilder

    For Each Byt In Bytes
        ReturnString.AppendFormat "0x{0:X2} ", Byt
    Next

    ShowBytes = Trim$(ReturnString.ToString)
End Function

' The example displays the following output:
'        Unable to decode 0x01 0xD8 at index 4

Read Only.

Examples

The following example determines the number of bytes required to encode a character array, encodes the characters, and displays the resulting bytes.

Public Sub Main()
    Dim Chars() As Integer
    Dim U7      As Encoding
    Dim U8      As Encoding
    Dim U16LE   As Encoding
    Dim U16BE   As Encoding
    Dim U32     As Encoding

    ' The characters to encode:
    '    Latin Small Letter Z (U+007A)
    '    Latin Small Letter A (U+0061)
    '    Combining Breve (U+0306)
    '    Latin Small Letter AE With Acute (U+01FD)
    '    Greek Small Letter Beta (U+03B2)
    '    a high-surrogate value (U+D8FF)
    '    a low-surrogate value (U+DCFF)
    Chars = NewChars("z", "a", ChrW$(&H306), ChrW$(&H1FD), ChrW$(&H3B2), ChrW$(&HD8FF), ChrW$(&HDCFF))

    Set U7 = Encoding.UTF7
    Set U8 = Encoding.UTF8
    Set U16LE = Encoding.Unicode
    Set U16BE = Encoding.BigEndianUnicode
    Set U32 = Encoding.UTF32

    PrintCountsAndBytes Chars, U7
    PrintCountsAndBytes Chars, U8
    PrintCountsAndBytes Chars, U16LE
    PrintCountsAndBytes Chars, U16BE
    PrintCountsAndBytes Chars, U32
End Sub

Private Sub PrintCountsAndBytes(ByRef Chars() As Integer, ByVal Enc As Encoding)
    Dim IBC     As Long
    Dim IMBC    As Long
    Dim Bytes() As Byte

    Debug.Print CorString.Format("{0,-30} :", Enc.ToString);

    IBC = Enc.GetByteCount(Chars)
    Debug.Print CorString.Format(" {0,-3}", IBC);

    IMBC = Enc.GetMaxByteCount(CorArray.Length(Chars))
    Debug.Print CorString.Format(" {0, -3} :", IMBC);

    Bytes = Enc.GetBytes(Chars)

    PrintHexBytes Bytes
End Sub

Private Sub PrintHexBytes(ByRef Bytes() As Byte)
    Dim i As Long

    If CorArray.IsNullOrEmpty(Bytes) Then
        Debug.Print "<none>"
    Else
        For i = 0 To UBound(Bytes)
            Debug.Print CorString.Format("{0:X2} ", Bytes(i));
        Next

        Debug.Print
    End If
End Sub

' This code produces the following output.
'
'    CorLib.UTF7Encoding            : 18  23  :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D
'    CorLib.UTF8Encoding            : 12  24  :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
'    CorLib.UnicodeEncoding         : 14  16  :7A 00 61 00 06 03 FD 01 B2 03 FF D8 FF DC
'    CorLib.UnicodeEncoding         : 14  16  :00 7A 00 61 03 06 01 FD 03 B2 D8 FF DC FF
'    CorLib.UTF32Encoding           : 24  32  :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00

See Also

Project CorLib Overview

Class EncodingStatic Overview


EncodingStatic: UTF32 (get)

UTF32

Gets an encoding for the UTF-32 format using the little endian byte order.

 Public Property Get UTF32 ( ) As UTF32Encoding

Return Values

UTF32Encoding - An encoding object for the UTF-32 format using the little endian byte order.

Remarks

The UTF32Encoding object that is returned by this property may not have the appropriate behavior for your application. It uses replacement fallback to replace each string that it cannot encode and each byte that it cannot decode with the Unicode REPLACEMENT CHARACTER (U+FFFE). Instead, you can call the NewUTF32Encoding(Boolean, Boolean, Boolean) constructor to instantiate a UTF32Encoding object whose fallback is either an EncoderFallbackException or a DecoderFallbackException, as the following example illustrates.

Public Sub Main()
    Dim Enc     As UTF32Encoding
    Dim Value   As String
    Dim Value2  As String
    Dim Bytes() As Byte
    Dim Byt     As Variant

    Set Enc = NewUTF32Encoding(False, True, True)
    Value = t("\u00C4 \uD802\u0033 \u00AE")

    On Error GoTo Catch
    Bytes = Enc.GetBytes(Value)

    For Each Byt In Bytes
        Debug.Print CorString.Format("{0:X2} ", Byt);
    Next
    Debug.Print

    Value2 = Enc.GetString(Bytes)
    Debug.Print Value2
    Exit Sub

Catch:
    Dim Ex As EncoderFallbackException

    Catch Ex, Err
    Debug.Print CorString.Format("Unable to encode {0} as index {1}", _
                IIf(Ex.CharUnknownHigh <> 0, _
                    CorString.Format("U+{0:X4} U+{1:X4}", Ex.CharUnknownHigh, Ex.CharUnknownLow), _
                    CorString.Format("U+{0:X4}", Ex.CharUnknown)), _
                    Ex.Index)
End Sub

' The example displays the following output:
'        Unable to encode U+D802 at index 2

Read Only.

Examples

The following example determines the number of bytes required to encode a character array, encodes the characters, and displays the resulting bytes.

Public Sub Main()
    Dim Chars() As Integer
    Dim U7      As Encoding
    Dim U8      As Encoding
    Dim U16LE   As Encoding
    Dim U16BE   As Encoding
    Dim U32     As Encoding

    ' The characters to encode:
    '    Latin Small Letter Z (U+007A)
    '    Latin Small Letter A (U+0061)
    '    Combining Breve (U+0306)
    '    Latin Small Letter AE With Acute (U+01FD)
    '    Greek Small Letter Beta (U+03B2)
    '    a high-surrogate value (U+D8FF)
    '    a low-surrogate value (U+DCFF)
    Chars = NewChars("z", "a", ChrW$(&H306), ChrW$(&H1FD), ChrW$(&H3B2), ChrW$(&HD8FF), ChrW$(&HDCFF))

    Set U7 = Encoding.UTF7
    Set U8 = Encoding.UTF8
    Set U16LE = Encoding.Unicode
    Set U16BE = Encoding.BigEndianUnicode
    Set U32 = Encoding.UTF32

    PrintCountsAndBytes Chars, U7
    PrintCountsAndBytes Chars, U8
    PrintCountsAndBytes Chars, U16LE
    PrintCountsAndBytes Chars, U16BE
    PrintCountsAndBytes Chars, U32
End Sub

Private Sub PrintCountsAndBytes(ByRef Chars() As Integer, ByVal Enc As Encoding)
    Dim IBC     As Long
    Dim IMBC    As Long
    Dim Bytes() As Byte

    Debug.Print CorString.Format("{0,-30} :", Enc.ToString);

    IBC = Enc.GetByteCount(Chars)
    Debug.Print CorString.Format(" {0,-3}", IBC);

    IMBC = Enc.GetMaxByteCount(CorArray.Length(Chars))
    Debug.Print CorString.Format(" {0, -3} :", IMBC);

    Bytes = Enc.GetBytes(Chars)

    PrintHexBytes Bytes
End Sub

Private Sub PrintHexBytes(ByRef Bytes() As Byte)
    Dim i As Long

    If CorArray.IsNullOrEmpty(Bytes) Then
        Debug.Print "<none>"
    Else
        For i = 0 To UBound(Bytes)
            Debug.Print CorString.Format("{0:X2} ", Bytes(i));
        Next

        Debug.Print
    End If
End Sub

' This code produces the following output.
'
'    CorLib.UTF7Encoding            : 18  23  :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D
'    CorLib.UTF8Encoding            : 12  24  :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
'    CorLib.UnicodeEncoding         : 14  16  :7A 00 61 00 06 03 FD 01 B2 03 FF D8 FF DC
'    CorLib.UnicodeEncoding         : 14  16  :00 7A 00 61 03 06 01 FD 03 B2 D8 FF DC FF
'    CorLib.UTF32Encoding           : 24  32  :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00

See Also

Project CorLib Overview

Class EncodingStatic Overview


EncodingStatic: UTF7 (get)

UTF7

Gets an encoding for the UTF-7 format.

 Public Property Get UTF7 ( ) As UTF7Encoding

Return Values

UTF7Encoding - An encoding for the UTF-7 format.

Remarks

UTF-7 encoding is used primarily in environments that historically have been restricted to 7 bits, such as NNTP and some email applications. Because of issues with robustness and security, you should not use UTF7 encoding in 8-bit environments where UTF-8 encoding can be used instead.

Read Only.

Examples

The following example determines the number of bytes required to encode a character array, encodes the characters, and displays the resulting bytes.

Public Sub Main()
    Dim Chars() As Integer
    Dim U7      As Encoding
    Dim U8      As Encoding
    Dim U16LE   As Encoding
    Dim U16BE   As Encoding
    Dim U32     As Encoding

    ' The characters to encode:
    '    Latin Small Letter Z (U+007A)
    '    Latin Small Letter A (U+0061)
    '    Combining Breve (U+0306)
    '    Latin Small Letter AE With Acute (U+01FD)
    '    Greek Small Letter Beta (U+03B2)
    '    a high-surrogate value (U+D8FF)
    '    a low-surrogate value (U+DCFF)
    Chars = NewChars("z", "a", ChrW$(&H306), ChrW$(&H1FD), ChrW$(&H3B2), ChrW$(&HD8FF), ChrW$(&HDCFF))

    Set U7 = Encoding.UTF7
    Set U8 = Encoding.UTF8
    Set U16LE = Encoding.Unicode
    Set U16BE = Encoding.BigEndianUnicode
    Set U32 = Encoding.UTF32

    PrintCountsAndBytes Chars, U7
    PrintCountsAndBytes Chars, U8
    PrintCountsAndBytes Chars, U16LE
    PrintCountsAndBytes Chars, U16BE
    PrintCountsAndBytes Chars, U32
End Sub

Private Sub PrintCountsAndBytes(ByRef Chars() As Integer, ByVal Enc As Encoding)
    Dim IBC     As Long
    Dim IMBC    As Long
    Dim Bytes() As Byte

    Debug.Print CorString.Format("{0,-30} :", Enc.ToString);

    IBC = Enc.GetByteCount(Chars)
    Debug.Print CorString.Format(" {0,-3}", IBC);

    IMBC = Enc.GetMaxByteCount(CorArray.Length(Chars))
    Debug.Print CorString.Format(" {0, -3} :", IMBC);

    Bytes = Enc.GetBytes(Chars)

    PrintHexBytes Bytes
End Sub

Private Sub PrintHexBytes(ByRef Bytes() As Byte)
    Dim i As Long

    If CorArray.IsNullOrEmpty(Bytes) Then
        Debug.Print "<none>"
    Else
        For i = 0 To UBound(Bytes)
            Debug.Print CorString.Format("{0:X2} ", Bytes(i));
        Next

        Debug.Print
    End If
End Sub

' This code produces the following output.
'
'    CorLib.UTF7Encoding            : 18  23  :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D
'    CorLib.UTF8Encoding            : 12  24  :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
'    CorLib.UnicodeEncoding         : 14  16  :7A 00 61 00 06 03 FD 01 B2 03 FF D8 FF DC
'    CorLib.UnicodeEncoding         : 14  16  :00 7A 00 61 03 06 01 FD 03 B2 D8 FF DC FF
'    CorLib.UTF32Encoding           : 24  32  :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00

See Also

Project CorLib Overview

Class EncodingStatic Overview


EncodingStatic: UTF8 (get)

UTF8

Gets an encoding for the UTF-8 format.

 Public Property Get UTF8 ( ) As UTF8Encoding

Return Values

UTF8Encoding - An encoding for the UTF-8 format.

Remarks

This property returns a UTF8Encoding object that encodes Unicode characters into a sequence of one to four bytes per character, and that decodes a UTF-8-encoded byte array to Unicode characters.

The UTF8Encoding object that is returned by this property may not have the appropriate behavior for your application. It uses replacement fallback to replace each string that it cannot encode and each byte that it cannot decode with a question mark ("?") character. Instead, you can call the NewUTF8Encoding(Boolean, Boolean) constructor to instantiate a UTF8Encoding object whose fallback is either an EncoderFallbackException or a DecoderFallbackException, as the following example illustrates.

Public Sub Main()
    Dim Enc     As UTF8Encoding
    Dim Value   As String
    Dim Value2  As String
    Dim Bytes() As Byte
    Dim Byt     As Variant

    Set Enc = NewUTF8Encoding(True, True)
    Value = t("\u00C4 \uD802\u0033 \u00AE")

    On Error GoTo Catch
    Bytes = Enc.GetBytes(Value)

    For Each Byt In Bytes
        Debug.Print Object.ToString(Byt, "X2");
    Next
    Debug.Print

    Value2 = Enc.GetString(Bytes)
    Debug.Print Value2
    Exit Sub

Catch:
    Dim Ex As EncoderFallbackException

    Catch Ex, Err
    Debug.Print CorString.Format("Unable to encode {0} at index {1}", IIf(Ex.CharUnknownHigh <> 0, _
                    CorString.Format("U+{0:X4} U+{1:X4}", Ex.CharUnknownHigh, Ex.CharUnknownLow), _
                    CorString.Format("U+{0:X4}", Ex.CharUnknown)), Ex.Index)
End Sub

' The example displays the following output:
'        Unable to encode U+D802 at index 2

Read Only.

Examples

The following example determines the number of bytes required to encode a character array, encodes the characters, and displays the resulting bytes.

Public Sub Main()
    Dim Chars() As Integer
    Dim U7      As Encoding
    Dim U8      As Encoding
    Dim U16LE   As Encoding
    Dim U16BE   As Encoding
    Dim U32     As Encoding

    ' The characters to encode:
    '    Latin Small Letter Z (U+007A)
    '    Latin Small Letter A (U+0061)
    '    Combining Breve (U+0306)
    '    Latin Small Letter AE With Acute (U+01FD)
    '    Greek Small Letter Beta (U+03B2)
    '    a high-surrogate value (U+D8FF)
    '    a low-surrogate value (U+DCFF)
    Chars = NewChars("z", "a", ChrW$(&H306), ChrW$(&H1FD), ChrW$(&H3B2), ChrW$(&HD8FF), ChrW$(&HDCFF))

    Set U7 = Encoding.UTF7
    Set U8 = Encoding.UTF8
    Set U16LE = Encoding.Unicode
    Set U16BE = Encoding.BigEndianUnicode
    Set U32 = Encoding.UTF32

    PrintCountsAndBytes Chars, U7
    PrintCountsAndBytes Chars, U8
    PrintCountsAndBytes Chars, U16LE
    PrintCountsAndBytes Chars, U16BE
    PrintCountsAndBytes Chars, U32
End Sub

Private Sub PrintCountsAndBytes(ByRef Chars() As Integer, ByVal Enc As Encoding)
    Dim IBC     As Long
    Dim IMBC    As Long
    Dim Bytes() As Byte

    Debug.Print CorString.Format("{0,-30} :", Enc.ToString);

    IBC = Enc.GetByteCount(Chars)
    Debug.Print CorString.Format(" {0,-3}", IBC);

    IMBC = Enc.GetMaxByteCount(CorArray.Length(Chars))
    Debug.Print CorString.Format(" {0, -3} :", IMBC);

    Bytes = Enc.GetBytes(Chars)

    PrintHexBytes Bytes
End Sub

Private Sub PrintHexBytes(ByRef Bytes() As Byte)
    Dim i As Long

    If CorArray.IsNullOrEmpty(Bytes) Then
        Debug.Print "<none>"
    Else
        For i = 0 To UBound(Bytes)
            Debug.Print CorString.Format("{0:X2} ", Bytes(i));
        Next

        Debug.Print
    End If
End Sub

' This code produces the following output.
'
'    CorLib.UTF7Encoding            : 18  23  :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D
'    CorLib.UTF8Encoding            : 12  24  :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
'    CorLib.UnicodeEncoding         : 14  16  :7A 00 61 00 06 03 FD 01 B2 03 FF D8 FF DC
'    CorLib.UnicodeEncoding         : 14  16  :00 7A 00 61 03 06 01 FD 03 B2 D8 FF DC FF
'    CorLib.UTF32Encoding           : 24  32  :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00

See Also

Project CorLib Overview

Class EncodingStatic Overview


EndOfStreamException

EndOfStreamException

An exception that is thrown when an attempt to read passed the end of a stream occurs.

Implements:

Exception
IObject
IOException
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

See Also

Project CorLib Overview

Class EndOfStreamException Overview

Constructors

ExceptionMethods

Exception


EndOfStreamException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class EndOfStreamException Overview


EndOfStreamException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class EndOfStreamException Overview


EndOfStreamException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class EndOfStreamException Overview


EndOfStreamException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class EndOfStreamException Overview


EndOfStreamException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class EndOfStreamException Overview


EndOfStreamException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class EndOfStreamException Overview


EndOfStreamException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class EndOfStreamException Overview


EndOfStreamException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class EndOfStreamException Overview


EndOfStreamException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class EndOfStreamException Overview

Exception


EndOfStreamException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class EndOfStreamException Overview


EndOfStreamException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class EndOfStreamException Overview


EndOfStreamException: IOException

IOException

 Implements IOException

Return Values

IOException -

See Also

Project CorLib Overview

Class EndOfStreamException Overview


EndOfStreamException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewArgumentException.

Read Only.

See Also

Project CorLib Overview

Class EndOfStreamException Overview


EndOfStreamException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class EndOfStreamException Overview


EndOfStreamException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class EndOfStreamException Overview


EndOfStreamException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class EndOfStreamException Overview


EndOfStreamException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class EndOfStreamException Overview


EnumeratorBase

EnumeratorBase

Used to manage an enumeration index into a set of items.

Implements:

ICloneable

Public:

Properties:

Name | Description
Index (get) | Gets the current index.

Methods:

Name | Description
Clone | Creates a new instance of the enumerator base at the current index position.
MoveNext | Advances the current index, returning if the advancement succeeded.
Reset | Resets the index back to the initial starting position.

Remarks

Use this class to handle the starting, advancing and finishing of an index.

The class itself does not access a list of items. Instead, it manages an index into a list of items that are being enumerated. It deals with ensuring the enumeration starts correctly and when the enumeration has finished.

To create a new instance use the NewEnumeratorBase method.

Examples

The following example demonstrates an implementation of the IEnumerable and IEnumerator interfaces by creating a simple container class with an associated enumerator.

The example consists of three files. Two of the files are classes named Container and ContainerEnumerator. There is also one BAS file that contains the Main method.

The Container class implementation.
Option Explicit
Implements IEnumerable

Private mItems() As Variant
Private mCount As Long

Public Property Get Count() As Long
    Count = mCount
End Property

Public Sub Add(ByRef Value As Variant)
    If mCount > UBound(mItems) Then
        ReDim Preserve mItems(0 To UBound(mItems) * 2)
    End If

    CopyVariant mItems(mCount), Value
    mCount = mCount + 1
End Sub

Public Property Get Item(ByVal Index As Long) As Variant
    CopyVariant Item, mItems(Index)
End Property

Public Function GetEnumerator() As IEnumerator
    Dim En As New ContainerEnumerator

    En.Init Me
    Set GetEnumerator = En
End Function

Public Function NewEnum() As IUnknown
    Set NewEnum = CreateEnumerator(GetEnumerator)
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   Constructors
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub Class_Initialize()
    ReDim mItems(4)
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IEnumerable
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IEnumerable_GetEnumerator() As CorLib.IEnumerator
    Set IEnumerable_GetEnumerator = GetEnumerator
End Function

Private Function IEnumerable_NewEnum() As stdole.IUnknown
    Set IEnumerable_NewEnum = NewEnum
End Function

The ContainerEnumerator class implementation.
Option Explicit
Implements IEnumerator

Private mBase As EnumeratorBase
Private mContainer As Container

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   Constructors
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Sub Init(ByVal Container As Container)
    Set mBase = NewEnumeratorBase(0, Container.Count)
    Set mContainer = Container
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IEnumerator
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Property Get IEnumerator_Current() As Variant
    MoveVariant IEnumerator_Current, mContainer.Item(mBase.Index)
End Property

Private Function IEnumerator_MoveNext() As Boolean
    IEnumerator_MoveNext = mBase.MoveNext
End Function

Private Sub IEnumerator_Reset()
    mBase.Reset
End Sub

The Main method implemented in a BAS module.
Public Sub Main()
    Dim Items As New Container

    Items.Add "The"
    Items.Add "fox"
    Items.Add "jumps"
    Items.Add "over"
    Items.Add "the"
    Items.Add "lazy"
    Items.Add "dog."

    Debug.Print "Enumerate using 'For Each'."
    EnumerateWithForEach Items

    Debug.Print t("\nEnumerate using 'IEnumerator' interface.")
    EnumerateWithEnumerator Items
End Sub

Private Sub EnumerateWithForEach(ByVal Source As IEnumerable)
    Dim Value As Variant

    Debug.Print "   ";

    For Each Value In Source
        Debug.Print Value & " ";
    Next

    Debug.Print
End Sub

Private Sub EnumerateWithEnumerator(ByVal Source As IEnumerable)
    Dim En As IEnumerator

    Debug.Print "   ";

    Set En = Source.GetEnumerator

    Do While En.MoveNext
        Debug.Print En.Current & " ";
    Loop

    Debug.Print
End Sub

' The example code produces the following output.
'
'    Enumerate using 'For Each'.
'       The fox jumps over the lazy dog.
'
'    Enumerate using 'IEnumerator' interface.
'       The fox jumps over the lazy dog.

See Also

Project CorLib Overview

Class EnumeratorBase Overview

Constructors


EnumeratorBase: Clone

Clone

Creates a new instance of the enumerator base at the current index position.

 Public Function Clone ( ) As EnumeratorBase

Return Values

EnumeratorBase - Returns a clone of the current enumerator base class.

See Also

Project CorLib Overview

Class EnumeratorBase Overview


EnumeratorBase: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class EnumeratorBase Overview


EnumeratorBase: Index (get)

Index

Gets the current index.

 Public Property Get Index ( ) As Long

Return Values

Long - The current index.

Read Only.

Exceptions

Exception | Condition
InvalidOperationException | Attempted to get the current index before enumeration has started. -or- Attempted to get the current index after enumeration has finished. -or- The underlying collection has changed.

See Also

Project CorLib Overview

Class EnumeratorBase Overview


EnumeratorBase: MoveNext

MoveNext

Advances the current index, returning if the advancement succeeded.

 Public Function MoveNext ( ) As Boolean

Return Values

Boolean - True if the index was advanced; otherwise False.

Remarks

MoveNext will return False when the enumeration initially finishes. If additional calls are made to MoveNext an InvalidOperationException will be thrown.

Exceptions

Exception | Condition
InvalidOperationException | The enumeration has already finished. -or- The collection was modified after the enumerator was created.

See Also

Project CorLib Overview

Class EnumeratorBase Overview


EnumeratorBase: Reset

Reset

Resets the index back to the initial starting position.

 Public Sub Reset ( )

See Also

Project CorLib Overview

Class EnumeratorBase Overview


Environment

Environment

The Environment class provides functions for retrieving information about the local machine

Public:

Types:

Name | Description
EnvironmentVariableTarget | Used to indicate the source or destination of the environment variables when read from or written to the system.
SpecialFolder | This enum represents a list of folders accessible using GetFolderPath. These definitions are from the Microsoft Dot NET 1.1 MSDN Library.

Properties:

Name | Description
CommandLine (get) | Returns the command specified when executing the current application, including any arguments typed after the application name.
CurrentDirectory (get) | Returns the current directy of the executing application.
CurrentDirectory (let) | Sets the current directory for the executing application.
Is64BitOperatingSystem (get) | Determines whether the current operating system is a 64-bit operating system.
MachineName (get) | Returns the name of the local computer.
NewLine (get) | Returns string of a newline character for the local computer.
OSVersion (get) | Returns an object representing the current operating system.
ProcessorCount (get) | Returns the number of processors on the current machine.
SystemDirectory (get) | Returns the System directory for the current OS.
TickCount (get) | Returns the number of milliseconds the system has been running since it started.
UserDomainName (get) | Returns the name of the local machine within a domain
UserInteractive (get) | Determines if the current application is allowed to have user interaction.
UserName (get) | Returns the name of the currently logged in user of the local computer.
WorkingSet (get) | Returns the amount of physical memory the current application is allocated.

Methods:

Name | Description
ExpandEnvironmentVariables | Replaces environment tags within a string with the actual values.
GetCommandLineArgs | Returns an array of parsed Arguments from the command line.
GetEnvironmentVariable | Returns an environment variable value.
GetEnvironmentVariables | Returns an IDictionary object containing all environment variables as name/value pairs.
GetFolderPath | Returns the path for a specified folder type.
GetLogicalDrives | Returns the logical drives installed on the local machine.
ParseCommandLineArgs | Provides a mechanism to parse arguments from a command line string.
SetEnvironmentVariable | Sets, creates, or deletes an environment variable in the specified region.

Remarks

This class cannot be directly instantiated. In order to access the methods, use the class name directly.

 Debug.Print Environment.MachineName
 Debug.Print Environment.UserName

See Also

Project CorLib Overview

Class Environment Overview


Environment: CommandLine (get)

CommandLine

Returns the command specified when executing the current application, including any arguments typed after the application name.

 Public Property Get CommandLine ( ) As String

Return Values

String - The command line typed in at a command prompt.

Read Only.

See Also

Project CorLib Overview

Class Environment Overview


Environment: CurrentDirectory (get)

CurrentDirectory

Returns the current directy of the executing application.

 Public Property Get CurrentDirectory ( ) As String

Return Values

String - The current directory.

Read/Write.

See Also

Project CorLib Overview

Class Environment Overview


Environment: CurrentDirectory (let)

CurrentDirectory

Sets the current directory for the executing application.

 Public Property Let CurrentDirectory(
      ByVal Value As String )

Parameters

Value
[ByVal] String. The new directory to change to.

Read/Write.

See Also

Project CorLib Overview

Class Environment Overview


Environment: EnvironmentVariableTarget

EnvironmentVariableTarget

Used to indicate the source or destination of the environment variables when read from or written to the system.

 Public Enum EnvironmentVariableTarget

Values

Machine = 0
The source of the variable is machine wide. These are variables that are defined for the system and all users.
Process = 1
The source of the variable is for the current process. This combines both machine and user level variables, giving priority to the user level variables.
User = 2
The source of the variable is of the current user.

Remarks

Machine and User are not supported on Windows 95, 98 or ME.

See Also

Project CorLib Overview

Class Environment Overview


Environment: ExpandEnvironmentVariables

ExpandEnvironmentVariables

Replaces environment tags within a string with the actual values.

 Public Function ExpandEnvironmentVariables(
      ByRef Name As String ) As String

Parameters

Name
[ByRef] String. A string containing environment variable tags to be replaced.

Return Values

String - A string containing actual environment variable values in place of tags.

Remarks

The environment variables are tagged using %. A string such as My OS is %OS%.' would become 'My OS is Windows_NT.' for NT machines.

See Also

Project CorLib Overview

Class Environment Overview


Environment: GetCommandLineArgs

GetCommandLineArgs

Returns an array of parsed Arguments from the command line.

 Public Function GetCommandLineArgs ( ) As String ( )

Return Values

String() - An array of command line Arguments, including the application name.

Remarks

The application is the first Argument in the array. Arguments are separated by spaces. If spaces are embedded in an Arguments and should not be used to separate the Arguments, then the Arguments must be surrounded in quotes.

See Also

Project CorLib Overview

Class Environment Overview


Environment: GetEnvironmentVariable

GetEnvironmentVariable

Returns an environment variable value.

 Public Function GetEnvironmentVariable(
      ByRef Name As String,
      Optional ByVal Target As EnvironmentVariableTarget = EnvironmentVariableTarget. Process ) As String

Parameters

Name
[ByRef] String. The name of the environment variable to return.
Target
[ByVal] Optional. EnvironmentVariableTarget. The system region to retrieve the variable from.

Default: EnvironmentVariableTarget . Process

Return Values

String - The value of the environment variable.

Remarks

If the variable does not exist, then an empty string is returned.

A Target of Process will retrieve the variable from the current process. Other targets will retrieve the variable value from the registry.

See Also

Project CorLib Overview

Class Environment Overview


Environment: GetEnvironmentVariables

GetEnvironmentVariables

Returns an IDictionary object containing all environment variables as name/value pairs.

 Public Function GetEnvironmentVariables(
      Optional ByVal Target As EnvironmentVariableTarget = Process ) As IDictionary

Parameters

Target
[ByVal] Optional. EnvironmentVariableTarget. The system region to retrieve the environment variable from.

Default: Process

Return Values

IDictionary - A dictionary containing the name/value pairs.

Remarks

The hidden environment variables are not included in the dictionary.

A Target of Process will retrieve the variable from the current process. Other targets will retrieve the variable value from the registry.

See Also

Project CorLib Overview

Class Environment Overview


Environment: GetFolderPath

GetFolderPath

Returns the path for a specified folder type.

 Public Function GetFolderPath(
      ByVal Folder As SpecialFolder ) As String

Parameters

Folder
[ByVal] SpecialFolder. The folder to return the path of.

Return Values

String - The path for the specified folder.

See Also

Project CorLib Overview

Class Environment Overview


Environment: GetLogicalDrives

GetLogicalDrives

Returns the logical drives installed on the local machine.

 Public Function GetLogicalDrives ( ) As String ( )

Return Values

String() - An array containing all of the logical drives installed.

See Also

Project CorLib Overview

Class Environment Overview


Environment: Is64BitOperatingSystem (get)

Is64BitOperatingSystem

Determines whether the current operating system is a 64-bit operating system.

 Public Property Get Is64BitOperatingSystem ( ) As Boolean

Return Values

Boolean - True if the operating system is 64-bit; otherwise, False.

Read Only.

See Also

Project CorLib Overview

Class Environment Overview


Environment: MachineName (get)

MachineName

Returns the name of the local computer.

 Public Property Get MachineName ( ) As String

Return Values

String - The name of the local computer.

Read Only.

See Also

Project CorLib Overview

Class Environment Overview


Environment: NewLine (get)

NewLine

Returns string of a newline character for the local computer.

 Public Property Get NewLine ( ) As String

Return Values

String - The newline characters.

Remarks

Being this always going to be in VB, the return is just vbCrLf.

Read Only.

See Also

Project CorLib Overview

Class Environment Overview


Environment: OSVersion (get)

OSVersion

Returns an object representing the current operating system.

 Public Property Get OSVersion ( ) As OperatingSystem

Return Values

OperatingSystem - The OperatingSystem object that represents the current OS.

Read Only.

See Also

Project CorLib Overview

Class Environment Overview


Environment: ParseCommandLineArgs

ParseCommandLineArgs

Provides a mechanism to parse arguments from a command line string.

 Public Function ParseCommandLineArgs(
      ByRef Line As String ) As String ( )

Parameters

Line
[ByRef] String. The string to parse the arguments from.

Return Values

String() - An array of arguments.

See Also

Project CorLib Overview

Class Environment Overview


Environment: ProcessorCount (get)

ProcessorCount

Returns the number of processors on the current machine.

 Public Property Get ProcessorCount ( ) As Long

Return Values

Long - The processor count.

Read Only.

See Also

Project CorLib Overview

Class Environment Overview


Environment: SetEnvironmentVariable

SetEnvironmentVariable

Sets, creates, or deletes an environment variable in the specified region.

 Public Sub SetEnvironmentVariable(
      ByRef Variable As String,
      ByRef Value As String,
      Optional ByVal Target As EnvironmentVariableTarget = Process )

Parameters

Variable
[ByRef] String. The name of the variable to set the value for.
Value
[ByRef] String. The value of the variable.
Target
[ByVal] Optional. EnvironmentVariableTarget. The region the variable is located in the system.

Default: Process

Remarks

Setting the variable in the Process region only affects the current process that is setting the variable. Setting a variable in a User or Machine region will set the values in the registry.

by setting the value to an empty string, the variable will be deleted.

See Also

Project CorLib Overview

Class Environment Overview


Environment: SpecialFolder

SpecialFolder

This enum represents a list of folders accessible using GetFolderPath. These definitions are from the Microsoft Dot NET 1.1 MSDN Library.

 Public Enum SpecialFolder

Values

AdminTools = Win32Native . CSIDL_ADMINTOOLS
The file system directory that is used to store administrative tools for an individual user. The Microsoft Management Console (MMC) will save customized consoles to this directory, and it will roam with the user.
ApplicationData = Win32Native . CSIDL_APPDATA
The directory that serves as a common repository for application-specific data for the current roaming user. A roaming user works on more than one computer on a network. A roaming users profile is kept on a server on the network and is loaded onto a system when the user logs on.
CDBurning = Win32Native . CSIDL_CDBURN_AREA
The file system directory that acts as a staging area for files waiting to be written to a CD.
CommonAdminTools = Win32Native . CSIDL_COMMON_ADMINTOOLS
The file system directory that contains administrative tools for all users of the computer.
CommonApplicationData = Win32Native . CSIDL_COMMON_APPDATA
The directory that serves as a common repository for application-specific data that is used by all users.
CommonDesktopDirectory = Win32Native . CSIDL_COMMON_DESKTOPDIRECTORY
The file system directory that contains files and folders that appear on the desktop for all users. This special folder is valid only for Windows NT systems.
CommonDocuments = Win32Native . CSIDL_COMMON_DOCUMENTS
The file system directory that contains documents that are common to all users. This special folder is valid for Windows NT systems, Windows 95, and Windows 98 systems with Shfolder.dll installed.
CommonMusic = Win32Native . CSIDL_COMMON_MUSIC
The file system directory that serves as a repository for music files common to all users.
CommonOemLinks = Win32Native . CSIDL_COMMON_OEM_LINKS
This value is recognized in Windows Vista for backward compatibility, but the special folder itself is no longer used.
CommonPictures = Win32Native . CSIDL_COMMON_PICTURES
The file system directory that serves as a repository for image files common to all users.
CommonPrograms = Win32Native . CSIDL_COMMON_PROGRAMS
A folder for components that are shared across applications. This special folder is valid only for Windows NT, Windows 2000, and Windows XP systems.
CommonProgramFiles = Win32Native . CSIDL_PROGRAM_FILES_COMMON
The directory for components that are shared across applications. To get the x86 common program files directory on a non-x86 system, use the ProgramFilesX86 member.
CommonProgramFilesX86 = Win32Native . CSIDL_PROGRAM_FILES_COMMONX86
The Program Files folder.
CommonStartMenu = Win32Native . CSIDL_COMMON_STARTMENU
The file system directory that contains the programs and folders that appear on the Start menu for all users. This special folder is valid only for Windows NT systems.
CommonStartup = Win32Native . CSIDL_COMMON_STARTUP
The file system directory that contains the programs that appear in the Startup folder for all users. This special folder is valid only for Windows NT systems.
CommonTemplates = Win32Native . CSIDL_COMMON_TEMPLATES
The file system directory that contains the templates that are available to all users. This special folder is valid only for Windows NT systems.
CommonVideos = Win32Native . CSIDL_COMMON_VIDEO
The file system directory that serves as a repository for video files common to all users.
Cookies = Win32Native . CSIDL_COOKIES
The directory that serves as a common repository for Internet cookies.
Desktop = Win32Native . CSIDL_DESKTOP
The logical Desktop rather than the physical file system location.
DesktopDirectory = Win32Native . CSIDL_DESKTOPDIRECTORY
The directory used to physically store file objects on the desktop. Do not confuse this directory with the desktop folder itself, which is a virtual folder.
Fonts = Win32Native . CSIDL_FONTS
A virtual folder that contains fonts.
Favorites = Win32Native . CSIDL_FAVORITES
The directory that serves as a common repository for the users favorite items.
History = Win32Native . CSIDL_HISTORY
The directory that serves as a common repository for Internet history items.
InternetCache = Win32Native . CSIDL_INTERNET_CACHE
The directory that serves as a common repository for temporary Internet files.
LocalApplicationData = Win32Native . CSIDL_LOCAL_APPDATA
The directory that serves as a common repository for application-specific data that is used by the current, non-roaming user.
LocalizedResources = Win32Native . CSIDL_RESOURCES_LOCALIZED
The file system directory that contains localized resource data.
MyComputer = Win32Native . CSIDL_DRIVES
The My Computer folder.
MyDocuments = Win32Native . CSIDL_PERSONAL
The My Documents folder. This member is equivalent to Personal.
MyMusic = Win32Native . CSIDL_MYMUSIC
The My Music folder.
MyPictures = Win32Native . CSIDL_MYPICTURES
The My Pictures folder.
MyVideos = Win32Native . CSIDL_MYVIDEO
The file system directory that serves as a repository for videos that belong to a user.
NetworkShortcuts = Win32Native . CSIDL_NETHOOD
A file system directory that contains the link objects that may exist in the My Network Places virtual folder.
Personal = Win32Native . CSIDL_PERSONAL
The directory that serves as a common repository for documents (My Documents).
PrinterShortcuts = Win32Native . CSIDL_PRINTHOOD
The file system directory that contains the link objects that can exist in the Printers virtual folder.
ProgramFiles = Win32Native . CSIDL_PROGRAM_FILES
The program files folder.
ProgramFilesX86 = Win32Native . CSIDL_PROGRAM_FILESX86
The Program Files folder. On an x86 system, passing the ProgramFilesX86 member to the Environment.GetFolderPath method returns an empty string; use the ProgramFiles member instead. You can determine whether Windows is a 32-bit operating system by calling the Environment.Is64BitOperatingSystem property.
Programs = Win32Native . CSIDL_PROGRAMS
The directory that contains the users program groups.
Recent = Win32Native . CSIDL_RECENT
The directory that contains the users most recently used documents.
Resources = Win32Native . CSIDL_RESOURCES
The file system directory that contains resource data.
SendTo = Win32Native . CSIDL_SENDTO
The directory that contains the Send To menu items.
StartMenu = Win32Native . CSIDL_STARTMENU
The directory that contains the Start menu items.
Startup = Win32Native . CSIDL_STARTUP
The directory that corresponds to the users Startup program group. The system starts these programs whenever a user logs on or starts Windows NT or later, or starts Windows 98.
SystemDir = Win32Native . CSIDL_SYSTEM
The system directory.
SystemX86 = Win32Native . CSIDL_SYSTEMX86
The Windows System folder.
Templates = Win32Native . CSIDL_TEMPLATES
The directory that serves as a common repository for document templates.
UserProfile = Win32Native . CSIDL_PROFILE
The users profile folder. Applications should not create files or folders at this level; they should put their data under the locations referred to by ApplicationData.
Windows = Win32Native . CSIDL_WINDOWS
The windows directory.

See Also

Project CorLib Overview

Class Environment Overview


Environment: SystemDirectory (get)

SystemDirectory

Returns the System directory for the current OS.

 Public Property Get SystemDirectory ( ) As String

Return Values

String - The system directory.

Remarks

Generally this will be C:\Windows\System32 or C:\Winnt\System32 for NT4 system.

Read Only.

See Also

Project CorLib Overview

Class Environment Overview


Environment: TickCount (get)

TickCount

Returns the number of milliseconds the system has been running since it started.

 Public Property Get TickCount ( ) As Long

Return Values

Long - Number of milliseconds since the system booted up.

Remarks

Once the maximum value is reached, it will wrap around to be negative, at which point negative values will be returned until 0 is reached. Wrapping to negative will take place in approximatively 24.85 days.

Read Only.

See Also

Project CorLib Overview

Class Environment Overview


Environment: UserDomainName (get)

UserDomainName

Returns the name of the local machine within a domain

 Public Property Get UserDomainName ( ) As String

Return Values

String - The computer name within a domain.

Remarks

Typically the domain name is the name of the machine, but can change depending on the application being deployed.

UserDomainName is not supported on Windows 95, 98, ME platforms and will throw a PlatformNotSupportedException exception.

Read Only.

See Also

Project CorLib Overview

Class Environment Overview


Environment: UserInteractive (get)

UserInteractive

Determines if the current application is allowed to have user interaction.

 Public Property Get UserInteractive ( ) As Boolean

Return Values

Boolean - Indication if user interaction is allowed.

Remarks

This is used primarily for when the application is a service. It can be used to supress message dialogs and user entry when not allowed.

Read Only.

See Also

Project CorLib Overview

Class Environment Overview


Environment: UserName (get)

UserName

Returns the name of the currently logged in user of the local computer.

 Public Property Get UserName ( ) As String

Return Values

String - The currently logged in users name.

Read Only.

See Also

Project CorLib Overview

Class Environment Overview


Environment: WorkingSet (get)

WorkingSet

Returns the amount of physical memory the current application is allocated.

 Public Property Get WorkingSet ( ) As Currency

Return Values

Currency - The amount of memory allocated to the application.

Remarks

This method only works for NT installations. 95, 98, and ME will receive a 0 when this method is called.

Read Only.

See Also

Project CorLib Overview

Class Environment Overview


EqualityComparerStatic

EqualityComparerStatic

Provides static methods to support IEqualityComparer interface.

Public:

Properties:

Name | Description
Default (get) | Returns a default equality comparer.

See Also

Project CorLib Overview

Class EqualityComparerStatic Overview


EqualityComparerStatic: Default (get)

Default

Returns a default equality comparer.

 Public Property Get Default ( ) As IEqualityComparer

Return Values

IEqualityComparer - A default equality comparer.

Remarks

The default IEqualityComparer implementation simply forwards the Equals and GetHashCode methods to the Object.Equals and Object.GetHashCode methods.

Access this property using EqualityComparer.Default.

Read Only.

See Also

Project CorLib Overview

Class EqualityComparerStatic Overview


EventArgs

EventArgs

Represents the base class for classes that contain event data, and provides a value to use for events that do not include event data.

Implements:

IObject

Public:

Methods:

Name | Description
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory. This should be overriden for different forms of equality. An example would be if this class contained a Name property and equality is determined by the names.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function. An override might be necessary if the hashcode should be derived from a value contained within the class.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides. A Person class may return the persons name instead.

Remarks

This class serves as the base class for all classes that represent event data. To create a custom event data class, create a class that implements from the EventArgs class and provide the properties to store the necessary data. The name of your custom event data class should end with EventArgs.

To pass an object that does not contain any data, use the EmptyArgs field.

See Also

Project CorLib Overview

Class EventArgs Overview


EventArgs: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

This should be overriden for different forms of equality. An example would be if this class contained a Name property and equality is determined by the names.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare this instance to.

Return Values

Boolean - True if Value is equal to this instance, False otherwise.

See Also

Project CorLib Overview

Class EventArgs Overview


EventArgs: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

An override might be necessary if the hashcode should be derived from a value contained within the class.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A hash code for the current object.

See Also

Project CorLib Overview

Class EventArgs Overview


EventArgs: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class EventArgs Overview


EventArgs: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

A Person class may return the persons name instead.

 Public Function ToString ( ) As String

Return Values

String - A string that represents the current object.

See Also

Project CorLib Overview

Class EventArgs Overview


EventArgsStatic

EventArgsStatic

Represents an event with no data.

Public:

Properties:

Name | Description
EmptyArgs (get) |

See Also

Project CorLib Overview

Class EventArgsStatic Overview


Exception

Exception

This is the base class from which all exception derive their interface.

Implements:

IObject

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

Remarks

This class is the base class for all exceptions. When an error occurs, either the system or the currently executing application reports it by throwing an exception containing information about the error. Once thrown, an exception is handled by the application or by the default exception handler. There are two methods of raising an error: Using the classical VB approach Err.Raise. This method does not place an exception object in holding to be caught. In order to catch the error using the Catch method, call Catch passing in an exception variable and also the Err object. This will create an Exception object with the Err information. Use this method if an error might be raised by code that does not use the Throw method. Using the VBCorLib approach of Throw {exception object}. This method does place the exception in holding to be caught. It then raises an error using the standard Err.Raise method giving the information within the exception object. This allows for the error to be caught by error traps not utilzing the Throw/Catch style. To catch the exception using Catch, an error trap is still required. Once in the trap call Catch passing in an exception variable that is set to the held exception object. Catch will return True if an exception was caught, False otherwise.

Example:

This example demonstrates catching an exception and determining the type of exception caught. The FileNotFoundException type is tested for to show how exception types can be determined.
 Private Sub Form_Load()
     Dim fs As FileStream

     On Error GoTo CatchIt
     Set fs = NewFileStream("missing.txt", OpenExisting)

 CatchIt:
     Dim ex As Exception
     If Catch(ex) Then
         If TypeOf ex Is FileNotFoundException Then
             Call Console.WriteLine("FileNotFoundException Handler: {0}", ex.ToString)
         Else
             Call Console.WriteLine("Generic Exception Handler: {0}", ex.ToString)
         End If
     End If
 End Sub

See Also

Project CorLib Overview

Class Exception Overview


Exception: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Read Only.

See Also

Project CorLib Overview

Class Exception Overview


Exception: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class Exception Overview


Exception: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class Exception Overview


Exception: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class Exception Overview


Exception: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class Exception Overview


Exception: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class Exception Overview


Exception: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class Exception Overview


Exception: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class Exception Overview

Exception


Exception: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class Exception Overview


Exception: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class Exception Overview


Exception: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewException.

Read Only.

See Also

Project CorLib Overview

Class Exception Overview


Exception: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class Exception Overview


Exception: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class Exception Overview


Exception: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class Exception Overview


ExceptionBase

ExceptionBase

This is a helper class to easily manage an exception type class.

Public:

Properties:

Name | Description
Data (get) | Returns a key/value set of data that is associated to the exception.
ErrorNumber (get) | Returns the current VB error number associated with this exception.
ErrorNumber (let) | Sets the VB error number for this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HResult the current exception represents.
HResult (let) | Sets the HResult the current exception represents.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
InnerException (set) | Sets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Message (let) | Sets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.
TypeName (get) |

Methods:

Name | Description
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetValue | Returns a value being maintained in the exception base class.
SetValue | Sets a value that can be associated with the exception without needing to maintain the value in the Subclass exception class.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

Remarks

This class should be used as a contained object that functions can be delegated to and performed with. This class contains the primary functions and properties common to all exceptions.

If the user-derived exception class needs to handle more information than this base class manages, then the developer needs to implement those additional features directly into the derived class.

See Also

Project CorLib Overview

Class ExceptionBase Overview


ExceptionBase: Data (get)

Data

Returns a key/value set of data that is associated to the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - a key/value set of data that is associated to the exception.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class ExceptionBase Overview


ExceptionBase: ErrorNumber (get)

ErrorNumber

Returns the current VB error number associated with this exception.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - The VB error number.

Remarks

This is equivelant to the Err.Number value.

Read/Write.

See Also

Project CorLib Overview

Class ExceptionBase Overview


ExceptionBase: ErrorNumber (let)

ErrorNumber

Sets the VB error number for this exception instance.

 Public Property Let ErrorNumber(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new VB error number to set this instance to.

Remarks

This is equivelant to the Err.Number value.

Read/Write.

See Also

Project CorLib Overview

Class ExceptionBase Overview


ExceptionBase: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then the Subclass is returned as the base exception because it did not have an inner exception, so it is assumed that the Subclass exception is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class ExceptionBase Overview


ExceptionBase: GetValue

GetValue

Returns a value being maintained in the exception base class.

 Public Function GetValue(
      ByRef Name As String,
      Optional ByRef Default As Variant ) As Variant

Parameters

Name
[ByRef] String. The name of the value to retrieve.
Default
[ByRef] Optional. Variant. The value to be returned if the value doesnt exist.

Return Values

Variant -

See Also

Project CorLib Overview

Class ExceptionBase Overview


ExceptionBase: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class ExceptionBase Overview


ExceptionBase: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class ExceptionBase Overview


ExceptionBase: HResult (get)

HResult

Gets the HResult the current exception represents.

 Public Property Get HResult ( ) As Long

Return Values

Long - The HResult.

Remarks

This is the same as Err.Number in most cases. Since this is a helper base class, it can hold any custom value needed for use by the Subclass.

This property can be set in the constructor NewExceptionBase.

Read/Write.

See Also

Project CorLib Overview

Class ExceptionBase Overview


ExceptionBase: HResult (let)

HResult

Sets the HResult the current exception represents.

 Public Property Let HResult(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new HResult value.

Remarks

This is the same as Err.Number in most cases. Since this is a helper base class, it can hold any custom value needed for use by the Subclass.

This property can be set in the constructor NewExceptionBase.

Read/Write.

See Also

Project CorLib Overview

Class ExceptionBase Overview


ExceptionBase: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read/Write.

See Also

Project CorLib Overview

Class ExceptionBase Overview


ExceptionBase: InnerException (set)

InnerException

Sets the exception that caused the Subclassed exception to be thrown.

 Public Property Set InnerException(
      ByVal Value As Exception )

Parameters

Value
[ByVal] Exception. The exception that caused this Subclass exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

The Subclass exception should not allow the InnerException to be changed.

Read/Write.

See Also

Project CorLib Overview

Class ExceptionBase Overview


ExceptionBase: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass.

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewExceptionBase.

Read/Write.

See Also

Project CorLib Overview

Class ExceptionBase Overview


ExceptionBase: Message (let)

Message

Sets the error message associated with the Subclass exception.

 Public Property Let Message(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The message to set the base to. Setting this to vbNullString will cause Environment.GetResourceString to return the default message.

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewExceptionBase.

Read/Write.

See Also

Project CorLib Overview

Class ExceptionBase Overview


ExceptionBase: SetValue

SetValue

Sets a value that can be associated with the exception without needing to maintain the value in the Subclass exception class.

 Public Sub SetValue(
      ByRef Name As String,
      ByRef Value As Variant )

Parameters

Name
[ByRef] String. The name of the value to set.
Value
[ByRef] Variant. The value to set.

Remarks

If the value already exists, it will be replaced.

See Also

Project CorLib Overview

Class ExceptionBase Overview


ExceptionBase: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class ExceptionBase Overview


ExceptionBase: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class ExceptionBase Overview


ExceptionBase: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString(
      Optional ByRef FormattedMessage As String )

Parameters

FormattedMessage
[ByRef] Optional. String. This allows the Subclass to pass in a formatted version of the original message to be used in creating the resulting string. If the message is not passed in, then the internal Environment.GetResourceString method will be used.

Return Values

Variant - A formatted message containing both the name of the parent subclass and the message itself.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class ExceptionBase Overview


ExceptionMethods

ExceptionMethods

Defines public exception management functions Throw and Catch.

Public:

Methods:

Name | Description
Catch | Catch provides a mechanism for retrieving an exception object that was set using the Throw function.
CatchArgument |
CatchArgumentNull |
CatchArgumentOutOfRange |
CatchDirectoryNotFound |
CatchFileNotFound |
CatchPathTooLong |
ClearException | Clears any exception that may not have been caught yet.
PeekException |
TakeException |
Throw | Raises an error using the supplied exception object. The exception is then set and ready to be caught using Catch.

Remarks

Error processing can be a fundamental process in creating robust applications in Visual Basic. VBCorLib provides a wide range of exception classes that can be used to capture details for an error that may occur.

By using Throw and Catch to handle exception objects, a robust error handling mechanism can be created.

See Also

Project CorLib Overview

Class ExceptionMethods Overview

Exception


ExceptionMethods: Catch

Catch

Catch provides a mechanism for retrieving an exception object that was set using the Throw function.

 Public Function Catch(
      ByRef Ex As Exception,
      Optional ByVal Err As ErrObject ) As Boolean

Parameters

Ex
[ByRef] Exception. ex is set to the exception object that is caught.
Err
[ByVal] Optional. ErrObject. Used when the exception was not thrown by VBCorLib directly.

Return Values

Boolean - Indicates if an exception was actually caught.

Remarks

Returns True if an exception has been caught, setting the ex parameter to the exception object. By retrieving an exception object, the error that occurred can be determined along with any specific details included. In order to catch an exception, error trapping must be used as normal. During error trapping procedures, a call to Catch will attempt to retrieve an exception, returning an indication on whether an exception was caught.

If Throw was not used to raise an error, then the ErrObject must be passed into the function to retrieve the error information. This is because each loaded module (dll, exe, ...) will have its own ErrObject, so VBCorLib has no way of retrieving the error information for modules other than itself. If errors outside of VBCorLib are created using Throw, then the ErrObject does not need to be passed into the Catch function.

If the source of the error will always be from VBCorLib then the ErrObject does not need to be supplied. If the source is not VBCorLib or is unknown, then pass in the ErrObject. Passing in the ErrObject will not affect catching exceptions thrown by VBCorLib.

To clear an existing exception, call Catch and pass in Nothing as the exception variable.

Example

This shows how to catch an exception thrown within the same function.
     On Error Goto errTrap
     Throw NewFileNotFoundException("Could not find your file.")

    '... code

 errTrap:
     Dim ex As Exception

     If Catch(ex) Then
         If TypeOf ex Is FileNotFoundException Then
             MsgBox "You will need to enter another filename."
         Else
             MsgBox "Error: " & ex.Message
         End If
     End If
Once an exception has been caught, it can be inspected to determine the appropriate course of action.

The error trap section is a typical implementation of catching a VBCorLib exception.

If an error is raised using the Throw function, then the exception object will remain ready to be caught until Catch is called. This is similar to using On Error Resume Next and not clearing any errors that may occur. The ErrObject will contain any error information until some event clears it. This can lead to problems later on in the code when an exception is checked using Catch, and an older exception is still set. The exception may need to be cleared to prevent unwanted exceptions from being caught.

See Also

Project CorLib Overview

Class ExceptionMethods Overview

Constructors

Exception


ExceptionMethods: ClearException

ClearException

Clears any exception that may not have been caught yet.

 Public Sub ClearException ( )

Remarks

Sometimes an exception can be thrown, but ignored and not caught. This could cause problems later in code if the Catch method is called and an exception has not been thrown. The previous exception may still remain ready to be caught even though the error trapping has passed for that previous exception.

See Also

Project CorLib Overview

Class ExceptionMethods Overview

Exception


ExceptionMethods: Throw

Throw

Raises an error using the supplied exception object. The exception is then set and ready to be caught using Catch.

 Public Sub Throw(
      Optional ByVal Ex As Object )

Parameters

Ex
[ByVal] Optional. Object. The exception object used to raise an error. This will accept any object that implements the Exception interface or an ErrObject. All exception classes in VBCorLib implement Exception.

Remarks

VBCorLib provides a wide range of exception objects that can be used to define specific errors that occur during the execution of an application. In order to use the exception objects through VBCorLib, they must first be Thrown. Throwing an exception object is similar to raising an error using Visual Basics standard method of Err.Raise.

To throw an exception, it must be passed into the Throw function. This will store the exception object so it can be retrieved (Caught) during error trapping.

 ' Throwing an exception directly is the simplest method.
 Throw New Exception
This creates a new Exception object and passes it directly into the Throw function. The function then sets the object to be caught and raises an error using the HResult, Source, and Message properties. These properties corrispond to the Err.Number, Err.Source, and Err.Description parameters used when raising an error.

Exceptions that are to be thrown should be constructed with meaningful information before being passed into the Throw function.

An Exception that occurs but is not caught using Catch can be rethrown by calling Throw without any parameters. This causes the Throw function to check if a pending Exception already exists, and if so, rethrow it. This does not clear an exception.

See Also

Project CorLib Overview

Class ExceptionMethods Overview

Constructors

Exception


ExternalException

ExternalException

Returns a key/value collection used to contain user-defined specific information about the exception.

Implements:

Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) |
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

See Also

Project CorLib Overview

Class ExternalException Overview


ExternalException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class ExternalException Overview


ExternalException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class ExternalException Overview


ExternalException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class ExternalException Overview


ExternalException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class ExternalException Overview


ExternalException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class ExternalException Overview


ExternalException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class ExternalException Overview


ExternalException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class ExternalException Overview


ExternalException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class ExternalException Overview

Exception


ExternalException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class ExternalException Overview


ExternalException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class ExternalException Overview


ExternalException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewException.

Read Only.

See Also

Project CorLib Overview

Class ExternalException Overview


ExternalException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class ExternalException Overview


ExternalException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class ExternalException Overview


ExternalException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class ExternalException Overview


ExternalException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class ExternalException Overview


File

File

Provides static methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of FileStream objects.

Public:

Methods:

Name | Description
AppendAllText | Appends the specified string to the file, creating the file if it does not already exist.
AppendText | Creates a StreamWriter that appends UTF-8 encoded text to an existing file.
Copy | Copies an existing file to a new file. Overwriting a file of the same name is allowed.
Create | Creates or overwrites the specified file.
CreateText | Creates or opens a file for writing UTF-8 encoded text.
Delete | Deletes the specified file.
Exists | Determines if a file exists.
GetAttributes | Returns the file attributes (ReadOnly, Hidden, ...)
GetCreationTime | Returns the time the file was created in local time.
GetCreationTimeUtc | Returns the time the file was created in UTC time.
GetLastAccessTime | Returns the time the file was accessed in local time.
GetLastAccessTimeUtc | Returns The last time a file was accessed in UTC time.
GetLastWriteTime | Returns the last time the file was written to in local time.
GetLastWriteTimeUtc | Returns the last time the file was written to in UTC time.
Move | Moves a file from one location to another.
OpenFile | Opens a file with a FileStream
OpenRead | Opens a file for reading as a FileStream.
OpenText | Opens a file for reading through a StreamReader.
OpenWrite | Opens a file for writing as a FileStream.
ReadAllBytes | Reads an entire file into a byte array.
ReadAllLines | Opens a file, reads all lines in a file into an array and closes the files.
ReadAllText | Reads the entire contents of a file and returns it as a String.
SetAttributes | Sets the file attributes (ReadOnly, Hidden, ...)
SetCreationTime | Sets the time of creation for a file in local time.
SetCreationTimeUtc | Sets the time of creation for a file in UTC time.
SetLastAccessTime | Sets the last time the file was accessed in local time.
SetLastAccessTimeUtc | Sets the last time the file was accessed in UTC time.
SetLastWriteTime | Sets the last time the file was written to in local time.
SetLastWriteTimeUtc | Sets the last time the file was written to in UTC time.
WriteAllbytes | Opens a file, writes all bytes to the file, then closes the file.
WriteAllLines | Opens a file, writes all strings to the file with appended new line values, then closes the file.
WriteAllText | Opens a files, writes out all contents to the file, then closes the file.

Remarks

Use the File class for typical operations such as copying, moving, renaming, creating, opening, deleting, and appending to files. You can also use the File class to get and set file attributes or date and time information related to the creation, access, and writing of a file.

Many of the File methods return other I/O types when you create or open files. You can use these other types to further manipulate a file. For more information, see specific File members such as OpenText, CreateText, or Create.

Because all File methods are static, it might be more efficient to use a File method rather than a corresponding FileInfo instance method if you want to perform only one action. All File methods require the path to the file that you are manipulating.

By default, full read/write access to new files is granted to all users.

The following table describes the enumerations that are used to customize the behavior of various File methods.

Enumeration | Description
FileAccess | Specifies read and write access to a file.
FileShare | Specifies the level of access permitted for a file that is already in use.
FileMode | Specifies whether the contents of an existing file are preserved or overwritten, and whether requests to create an existing file cause an exception.
Note
In members that accept a path as an input string, that path must be well-formed or an exception is raised. For example, if a path is fully qualified but begins with a space, the path is not trimmed in methods of the class. Therefore, the path is malformed and an exception is raised. Similarly, a path or a combination of paths cannot be fully qualified twice. For example, "c:\temp c:\windows" also raises an exception in most cases. Ensure that your paths are well-formed when using methods that accept a path string.

In members that accept a path, the path can refer to a file or just a directory. The specified path can also refer to a relative path or a Universal Naming Convention (UNC) path for a server and share name. For example, all the following are acceptable paths:

  • "c:\MyDir\MyFile.txt"
  • "c:\MyDir"
  • "MyDir\MySubDir"
  • "\\MyServer\MyShare"

Examples

The following example demonstrates how to use the File class to check whether a file exists, and depending on the result, either create a new file and write to it, or open the existing file and read from it.

Public Sub Main()
    Const Path As String = "c:\temp\MyTest.txt"

    If Not File.Exists(Path) Then
        ' Create a file to write to.
        Dim sw As StreamWriter
        Set sw = File.CreateText(Path)
        sw.WriteLine "Hello"
        sw.WriteLine "And"
        sw.WriteLine "Welcome"
        sw.Flush
    End If

    ' Open the file to read from.
    Dim sr As StreamReader
    Set sr = File.OpenText(Path)
    Do While sr.Peek >= 0
        Debug.Print sr.ReadLine
    Loop
End Sub

See Also

Project CorLib Overview

Class File Overview


File: AppendAllText

AppendAllText

Appends the specified string to the file, creating the file if it does not already exist.

 Public Sub AppendAllText(
      ByRef Path As String,
      ByRef Contents As String,
      Optional ByVal Encoding As Encoding )

Parameters

Path
[ByRef] String. The file to append the specified string to.
Contents
[ByRef] String. The string to append to the file.
Encoding
[ByVal] Optional. Encoding. The character encoding to use (Default UTF8).

Remarks

Given a string and a file path, this method opens the specified file, appends the string to the end of the file using the specified encoding, and then closes the file. The file handle is guaranteed to be closed by this method, even if exceptions are raised.

Exceptions

Exception | Condition
UnauthorizedAccessException | Path is read-only. -or- Path is a directory.
ArgumentException | Path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by GetInvalidPathChars.
PathTooLongException | The specified path, file name, or both exceed the system-defined maximum length. On Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
DirectoryNotFoundException | The specified path is invalid (for example, it is on an unmapped drive).
NotSupportedException | Path is in an invalid format.

Examples

The following code example demonstrates the use of the AppendAllText method to add extra text to the end of a file. In this example a file is created, if it doesnt already exist, and text is added to it.

Public Sub Main()
    Const Path As String = "c:\temp\MyTest.txt"
    Dim sw As StreamWriter

    ' This text is added only once to the file.
    If Not File.Exists(Path) Then

        ' Create a file to write to.
        Dim CreateText As String
        CreateText = "Hello and Welcome" & Environment.NewLine
        File.WriteAllText Path, CreateText, Encoding.UTF8
    End If

    ' This text is always added, making the file longer over time
    ' if it is not deleted.
    Dim AppendText As String
    AppendText = "This is extra text" & Environment.NewLine
    File.AppendAllText Path, AppendText, Encoding.UTF8

    ' Open the file to read from.
    Dim ReadText As String
    ReadText = File.ReadAllText(Path)
    Debug.Print ReadText
End Sub

See Also

Project CorLib Overview

Class File Overview


File: AppendText

AppendText

Creates a StreamWriter that appends UTF-8 encoded text to an existing file.

 Public Function AppendText(
      ByRef Path As String ) As StreamWriter

Parameters

Path
[ByRef] String. The path to the file to append to.

Return Values

StreamWriter - A StreamWriter that appends UTF-8 encoded text to an existing file.

Remarks

This method is equivalent to the NewStreamWriter(String, Boolean) constructor. If the file specified by Path does not exist, it is created. If the file does exist, write operations to the StreamWriter append text to the file. Additional threads are permitted to read the file while it is open.

The Path parameter is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see GetCurrentDirectory.

The Path parameter is not case-sensitive.

Exceptions

Exception | Condition
UnauthorizedAccessException | Path is read-only. -or- Path is a directory.
ArgumentException | Path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by GetInvalidPathChars.
PathTooLongException | The specified path, file name, or both exceed the system-defined maximum length. On Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
DirectoryNotFoundException | The specified path is invalid (for example, it is on an unmapped drive).
NotSupportedException | Path is in an invalid format.

Examples

The following example appends text to a file.

Public Sub Main()
    Const Path As String = "c:\temp\MyTest.txt"
    Dim sw As StreamWriter

    ' This text is added only once to the file.
    If Not File.Exists(Path) Then
        ' Create a file to write to.
        Set sw = File.CreateText(Path)

        sw.WriteLine "Hello"
        sw.WriteLine "And"
        sw.WriteLine "Welcome"
        sw.Flush
        sw.CloseWriter
    End If

    ' This text is always added, making the file longer over time
    ' if it is not deleted.
    Set sw = File.AppendText(Path)
    sw.WriteLine "This"
    sw.WriteLine "is Extra"
    sw.WriteLine "Text"
    sw.Flush
    sw.CloseWriter

    ' Open the file to read from.
    Dim sr As StreamReader
    Dim s As String

    Set sr = File.OpenText(Path)

    Do While sr.Peek >= 0
        s = sr.ReadLine
        Debug.Print s
    Loop

    sr.CloseReader
End Sub

See Also

Project CorLib Overview

Class File Overview

StreamWriter


File: Copy

Copy

Copies an existing file to a new file. Overwriting a file of the same name is allowed.

 Public Sub Copy(
      ByRef SourceFileName As String,
      ByRef DestFileName As String,
      Optional ByVal OverWrite As Boolean = False )

Parameters

SourceFileName
[ByRef] String. The file to copy.
DestFileName
[ByRef] String. The name of the destination file. This cannot be a directory.
OverWrite
[ByVal] Optional. Boolean. True if the destination file can be overwritten; otherwise, False.

Default: False

Remarks

The SourceFileName and DestFileName parameters can specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory.

Exceptions

Exception | Condition
UnauthorizedAccessException | DestFileName is read-only. -or- DestFileName is a directory.
ArgumentException | Path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by GetInvalidPathChars.
PathTooLongException | The specified path, file name, or both exceed the system-defined maximum length. On Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
DirectoryNotFoundException | The specified path is invalid (for example, it is on an unmapped drive).
NotSupportedException | Path is in an invalid format.

Examples

The following example copies files to the C:\archives\2008 backup folder. It uses the two overloads of the Copy method as follows:

  • It first uses the File.Copy(String, String) method overload to copy text (.txt) files. The code demonstrates that this overload does not allow overwriting files that were already copied.
  • It then uses the File.Copy(String, String, Boolean) method overload to copy pictures (.jpg files). The code demonstrates that this overload does allow overwriting files that were already copied.
Public Sub Main()
    Const SourceDir As String = "c:\current"
    Const BackupDir As String = "c:\archives\2008"

    Dim PicList() As String
    Dim TxtList() As String
    Dim FName As String
    Dim f As Variant

    PicList = Directory.GetFiles(SourceDir, "*.jpg")
    TxtList = Directory.GetFiles(SourceDir, "*.txt")

    ' Copy picture files.
    For Each f In PicList
        'Remove path from the file name.

        FName = Path.GetFileName(CStr(f))

        ' Use the Path.Combine method to safely append the file name to the path.
        ' Will overwrite if the destination file already exists.
        File.Copy Path.Combine(SourceDir, FName), Path.Combine(BackupDir, FName), True
    Next

    ' Copy text files.
    For Each f In TxtList
        'Remove path from the file name.
        FName = Path.GetFileName(CStr(f))

        On Error GoTo CopyError
        ' Will not overwrite if the destination file already exists.
        File.Copy Path.Combine(SourceDir, FName), Path.Combine(BackupDir, FName)
        GoTo EndTry

        ' Catch exception if the file was already copied.
CopyError:
        Dim CopyError As Exception
        Catch CopyError, Err
        Debug.Print CopyError.Message
EndTry:
    Next

    For Each f In TxtList
        File.Delete CStr(f)
    Next

    For Each f In PicList
        File.Delete CStr(f)
    Next

DirNotFound:
    Dim DirNotFound As Exception
    Catch DirNotFound, Err
    Debug.Print DirNotFound.Message
End Sub

See Also

Project CorLib Overview

Class File Overview


File: Create

Create

Creates or overwrites the specified file.

 Public Function Create(
      ByRef Path As String,
      Optional ByVal BufferSize As Long = 4096 ) As FileStream

Parameters

Path
[ByRef] String. The name of the file.
BufferSize
[ByVal] Optional. Long. The number of bytes buffered for reads and writes to the file.

Default: 4096

Return Values

FileStream - A FileStream with the specified buffer size that provides read/write access to the file specified in Path.

Remarks

The FileStream object created by this method has a default FileShare value of None; no other process or code can access the created file until the original file handle is closed.

The Path parameter is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see GetCurrentDirectory.

This method is equivalent to the NewFileStream(String, FileMode, FileAccess, FileShare, Int32) constructor. If the specified file does not exist, it is created; if it does exist and it is not read-only, the contents are overwritten.

By default, full read/write access to new files is granted to all users. The file is opened with read/write access and must be closed before it can be opened by another application.

Exceptions

Exception | Condition
ArgumentException | Path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by GetInvalidPathChars.
PathTooLongException | The specified path, file name, or both exceed the system-defined maximum length. On Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
DirectoryNotFoundException | The specified path is invalid (for example, it is on an unmapped drive).
NotSupportedException | Path is in an invalid format.

Examples

The following example creates a file with the specified buffer size.

Public Sub Main()
    Const Path As String = "c:\temp\MyTest.txt"

    ' Delete the file if it exists.
    If File.Exists(Path) Then
        File.Delete Path
    End If

    ' Create the file.
    Dim fs As FileStream
    Dim Info() As Byte

    Set fs = File.Create(Path, 1024)
    Info = NewUTF8Encoding(True).GetBytes("This is some text in the file.")

    ' Add some information to the file.
    fs.WriteBlock Info, 0, CorArray.Length(Info)
    fs.CloseStream

    ' Open the stream and read it back.
    Dim sr As StreamReader
    Set sr = File.OpenText(Path)

    Do While sr.Peek() >= 0
        Debug.Print sr.ReadLine
    Loop

    sr.CloseReader
End Sub

See Also

Project CorLib Overview

Class File Overview


File: CreateText

CreateText

Creates or opens a file for writing UTF-8 encoded text.

 Public Function CreateText(
      ByRef Path As String ) As StreamWriter

Parameters

Path
[ByRef] String. The file to be opened for writing.

Return Values

StreamWriter - A StreamWriter that writes to the specified file using UTF-8 encoding.

Remarks

This method is equivalent to the NewStreamWriter(String) constructor overload with the append parameter set to false. If the file specified by path does not exist, it is created. If the file does exist, its contents are overwritten. Additional threads are permitted to read the file while it is open.

The Path parameter is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see GetCurrentDirectory.

Exceptions

Exception | Condition
UnauthorizedAccessException | The caller does not have the required permission.
ArgumentException | Path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by GetInvalidPathChars.
PathTooLongException | The specified path, file name, or both exceed the system-defined maximum length. On Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
DirectoryNotFoundException | The specified path is invalid (for example, it is on an unmapped drive).
NotSupportedException | Path is in an invalid format.

Examples

The following example creates a file for text writing and reading.

Public Sub Main()
    Const Path As String = "C:\Temp\MyTest.txt"

    If Not File.Exists(Path) Then
        ' Create a file to write to.
        Dim sw As StreamWriter
        Set sw = File.CreateText(Path)

        sw.WriteLine "Hello"
        sw.WriteLine "And"
        sw.WriteLine "Welcome"
        sw.Flush
        sw.CloseWriter
    End If

    ' Open the file to read from.
    Dim sr As StreamReader
    Set sr = File.OpenText(Path)

    Do While sr.Peek >= 0
        Debug.Print sr.ReadLine
    Loop

    sr.CloseReader
End Sub

See Also

Project CorLib Overview

Class File Overview

StreamWriter


File: Delete

Delete

Deletes the specified file.

 Public Sub Delete(
      ByRef Path As String )

Parameters

Path
[ByRef] String. The name of the file to be deleted. Wildcard characters are not supported.

Remarks

If the file did not exist, nothing happens.

See Also

Project CorLib Overview

Class File Overview


File: Exists

Exists

Determines if a file exists.

 Public Function Exists(
      ByRef Path As String ) As Boolean

Parameters

Path
[ByRef] String. The file to check for existence.

Return Values

Boolean - Whether the file exists or not.

See Also

Project CorLib Overview

Class File Overview


File: GetAttributes

GetAttributes

Returns the file attributes (ReadOnly, Hidden, ...)

 Public Function GetAttributes(
      ByRef Path As String ) As FileAttributes

Parameters

Path
[ByRef] String. The file to retrieve the attributes for.

Return Values

FileAttributes - A value with individual bits representing if an attribute is applied to the file.

Remarks

To determine if a specific attribute is being used, the return value will need to be ANDed with the specific FileAttributes flag.

 If Attr And FileAttributes.ReadOnly Then
     '... file is readonly
 End If

See Also

Project CorLib Overview

Class File Overview


File: GetCreationTime

GetCreationTime

Returns the time the file was created in local time.

 Public Function GetCreationTime(
      ByRef Path As String ) As CorDateTime

Parameters

Path
[ByRef] String. The file to retrieve the creation time of.

Return Values

CorDateTime - A CorDateTime object representing the creation time.

See Also

Project CorLib Overview

Class File Overview


File: GetCreationTimeUtc

GetCreationTimeUtc

Returns the time the file was created in UTC time.

 Public Function GetCreationTimeUtc(
      ByRef Path As String ) As CorDateTime

Parameters

Path
[ByRef] String. The file to retrieve the creation time of.

Return Values

CorDateTime - A CorDateTime object representing the creation time.

See Also

Project CorLib Overview

Class File Overview


File: GetLastAccessTime

GetLastAccessTime

Returns the time the file was accessed in local time.

 Public Function GetLastAccessTime(
      ByRef Path As String ) As CorDateTime

Parameters

Path
[ByRef] String. The file to retrieve the last access time for.

Return Values

CorDateTime - A CorDateTime object that represents the last time the file was accessed.

See Also

Project CorLib Overview

Class File Overview


File: GetLastAccessTimeUtc

GetLastAccessTimeUtc

Returns The last time a file was accessed in UTC time.

 Public Function GetLastAccessTimeUtc(
      ByRef Path As String ) As CorDateTime

Parameters

Path
[ByRef] String. The file to get the last accessed time for.

Return Values

CorDateTime - A CorDateTime object representing the last time the file was accessed.

See Also

Project CorLib Overview

Class File Overview


File: GetLastWriteTime

GetLastWriteTime

Returns the last time the file was written to in local time.

 Public Function GetLastWriteTime(
      ByRef Path As String ) As CorDateTime

Parameters

Path
[ByRef] String. The file to retrieve the last written time for.

Return Values

CorDateTime - A CorDateTime object representing the last time the file was written to.

See Also

Project CorLib Overview

Class File Overview


File: GetLastWriteTimeUtc

GetLastWriteTimeUtc

Returns the last time the file was written to in UTC time.

 Public Function GetLastWriteTimeUtc(
      ByRef Path As String ) As CorDateTime

Parameters

Path
[ByRef] String. The file to retrieve the last written time for.

Return Values

CorDateTime - A CorDateTime object representing the last time a file was written to.

See Also

Project CorLib Overview

Class File Overview


File: Move

Move

Moves a file from one location to another.

 Public Sub Move(
      ByRef SourceFileName As String,
      ByRef DestFileName As String )

Parameters

SourceFileName
[ByRef] String. The file to be moved.
DestFileName
[ByRef] String. The location and filename the file is to be moved to.

See Also

Project CorLib Overview

Class File Overview


File: OpenFile

OpenFile

Opens a file with a FileStream

 Public Function OpenFile(
      ByRef Path As String,
      ByVal Mode As FileMode,
      Optional ByVal Access As FileAccess,
      Optional ByVal Share As FileShare = FileShare. None ) As FileStream

Parameters

Path
[ByRef] String. The file to be opened.
Mode
[ByVal] FileMode. The mode in which to open the file.
Access
[ByVal] Optional. FileAccess. The type of access allowed by the FileStream.
Share
[ByVal] Optional. FileShare. The access allowed for other processes.

Default: FileShare . None

Return Values

FileStream - A FileStream object of the specified file.

See Also

Project CorLib Overview

Class File Overview


File: OpenRead

OpenRead

Opens a file for reading as a FileStream.

 Public Function OpenRead(
      ByRef Path As String ) As FileStream

Parameters

Path
[ByRef] String. The file to be opened in read mode.

Return Values

FileStream - A FileStream used to read from the file.

Remarks

The FileStream object is declared as Cor.NewFileStream(Path, FileMode.OpenExisting, FileAccess.ReadAccess, FileShare.ReadShare).

See Also

Project CorLib Overview

Class File Overview


File: OpenText

OpenText

Opens a file for reading through a StreamReader.

 Public Function OpenText(
      ByRef Path As String ) As StreamReader

Parameters

Path
[ByRef] String. The file to be opened for reading.

Return Values

StreamReader - A StreamReader used to read from the file with the default encoding (UTF8Encoding).

Remarks

The StreamReader is declared as Cor.NewStreamReader(Path).

See Also

Project CorLib Overview

Class File Overview


File: OpenWrite

OpenWrite

Opens a file for writing as a FileStream.

 Public Function OpenWrite(
      ByRef Path As String ) As FileStream

Parameters

Path
[ByRef] String. The file to be opend for writing to.

Return Values

FileStream - A FileStream object used to write to the specified file.

Remarks

The FileStream object is declared as Cor.NewFileStream(Path, FileMode.OpenOrCreate, FileAccess.WriteAccess, FileShare.None).

See Also

Project CorLib Overview

Class File Overview


File: ReadAllBytes

ReadAllBytes

Reads an entire file into a byte array.

 Public Function ReadAllBytes(
      ByRef Path As String ) As Byte ( )

Parameters

Path
[ByRef] String. The path and filename to read into the byte array.

Return Values

Byte() - A byte array containing the contents of the file.

See Also

Project CorLib Overview

Class File Overview


File: ReadAllLines

ReadAllLines

Opens a file, reads all lines in a file into an array and closes the files.

 Public Function ReadAllLines(
      ByRef Path As String,
      Optional ByVal Encoding As Encoding ) As String ( )

Parameters

Path
[ByRef] String. The path and filename of the file to read in.
Encoding
[ByVal] Optional. Encoding. The encoding to use to decode the file into text characters.

Return Values

String() - A String array containing all of the lines in the file.

Remarks

The end of a line is indicated when either a Return (13), LineFeed (10), or a Return-LineFeed combination have been encountered.

See Also

Project CorLib Overview

Class File Overview


File: ReadAllText

ReadAllText

Reads the entire contents of a file and returns it as a String.

 Public Function ReadAllText(
      ByRef Path As String,
      Optional ByVal Encoding As Encoding ) As String

Parameters

Path
[ByRef] String. The path and filename to read in.
Encoding
[ByVal] Optional. Encoding. The encoding to be used in reading the file.

Return Values

String - A string containing the contents of the file.

See Also

Project CorLib Overview

Class File Overview


File: SetAttributes

SetAttributes

Sets the file attributes (ReadOnly, Hidden, ...)

 Public Sub SetAttributes(
      ByRef Path As String,
      ByVal Attributes As FileAttributes )

Parameters

Path
[ByRef] String. The file to set the attributes of.
Attributes
[ByVal] FileAttributes. The new attributes to set the file to.

Remarks

In order to set a single attribute without unsetting an existing attributes, they will first need to be read from the file (GetAttributes), then bit manipulated to create the resulting set of desired attributes before setting.

See Also

Project CorLib Overview

Class File Overview


File: SetCreationTime

SetCreationTime

Sets the time of creation for a file in local time.

 Public Sub SetCreationTime(
      ByRef Path As String,
      ByRef CreationTime As Variant )

Parameters

Path
[ByRef] String. The file to set the time of creation for.
CreationTime
[ByRef] Variant. A Date or CorDateTime object of the new time.

See Also

Project CorLib Overview

Class File Overview


File: SetCreationTimeUtc

SetCreationTimeUtc

Sets the time of creation for a file in UTC time.

 Public Sub SetCreationTimeUtc(
      ByRef Path As String,
      ByRef CreationTime As Variant )

Parameters

Path
[ByRef] String. The file to set the time of creation for.
CreationTime
[ByRef] Variant. A Date or CorDateTime object of the new time.

See Also

Project CorLib Overview

Class File Overview


File: SetLastAccessTime

SetLastAccessTime

Sets the last time the file was accessed in local time.

 Public Sub SetLastAccessTime(
      ByRef Path As String,
      ByRef LastAccessTime As Variant )

Parameters

Path
[ByRef] String. The file to set the last access time for.
LastAccessTime
[ByRef] Variant. A Date or CorDateTime object of the new time.

See Also

Project CorLib Overview

Class File Overview


File: SetLastAccessTimeUtc

SetLastAccessTimeUtc

Sets the last time the file was accessed in UTC time.

 Public Sub SetLastAccessTimeUtc(
      ByRef Path As String,
      ByRef LastAccessTime As Variant )

Parameters

Path
[ByRef] String. The file to set the last access time for.
LastAccessTime
[ByRef] Variant. A Date or CorDateTime object of the new time.

See Also

Project CorLib Overview

Class File Overview


File: SetLastWriteTime

SetLastWriteTime

Sets the last time the file was written to in local time.

 Public Sub SetLastWriteTime(
      ByRef Path As String,
      ByRef LastWriteTime As Variant )

Parameters

Path
[ByRef] String. The file to set the last written time for.
LastWriteTime
[ByRef] Variant. A Date or CorDateTime object of the new time.

See Also

Project CorLib Overview

Class File Overview


File: SetLastWriteTimeUtc

SetLastWriteTimeUtc

Sets the last time the file was written to in UTC time.

 Public Sub SetLastWriteTimeUtc(
      ByRef Path As String,
      ByRef LastWriteTime As Variant )

Parameters

Path
[ByRef] String. The file to set the last written time for.
LastWriteTime
[ByRef] Variant. A Date or CorDateTime object of the new time.

See Also

Project CorLib Overview

Class File Overview


File: WriteAllbytes

WriteAllbytes

Opens a file, writes all bytes to the file, then closes the file.

 Public Sub WriteAllbytes(
      ByRef Path As String,
      ByRef Bytes ( ) As Byte )

Parameters

Path
[ByRef] String. The path and filename of the file to write to.
Bytes
[ByRef] Byte. The bytes to be written to the file.

Remarks

If the file doesnt exist it will be created. If the file already exists, it will be overwritten.

See Also

Project CorLib Overview

Class File Overview


File: WriteAllLines

WriteAllLines

Opens a file, writes all strings to the file with appended new line values, then closes the file.

 Public Sub WriteAllLines(
      ByRef Path As String,
      ByRef Contents As Variant,
      Optional ByVal Encoding As Encoding )

Parameters

Path
[ByRef] String. The path and filename of the file to write to.
Contents
[ByRef] Variant. The strings to be written to the file.
Encoding
[ByVal] Optional. Encoding. The encoding to be used when writing to the file.

Remarks

If the file doesnt exist it will be created. If the file already exists, it will be overwritten.

See Also

Project CorLib Overview

Class File Overview


File: WriteAllText

WriteAllText

Opens a files, writes out all contents to the file, then closes the file.

 Public Sub WriteAllText(
      ByRef Path As String,
      ByRef Contents As String,
      Optional ByVal Encoding As Encoding )

Parameters

Path
[ByRef] String. The path and filename of the file to write to.
Contents
[ByRef] String. The contents to write to the file.
Encoding
[ByVal] Optional. Encoding. The encoding to be used when writing to the file.

Remarks

If the file does not exist, it will be created. If the file already exists, it will be overwritten.

See Also

Project CorLib Overview

Class File Overview


FileInfo

FileInfo

Provides methods for manipulating, setting and retrieving information for the specified file.

Implements:

FileSystemInfo
IObject

Public:

Properties:

Name | Description
Attributes (get) | Returns the attributes for the file (ReadOnly, Hidden, ...)
Attributes (let) | Sets the attributes for the file (ReadOnly, Hidden, ...)
CreationTime (get) | Returns the creation time as a CorDateTime object.
CreationTime (let) | Sets the creation time of the file.
CreationTime (set) | Sets the creation time of the file.
CreationTimeUtc (get) | Returns the creation time as a UTC time.
CreationTimeUtc (let) | Sets the creation time of the file in UTC time.
CreationTimeUtc (set) | Sets the creation time of the file in UTC time.
Directory (get) | Returns a DirectoryInfo object of the directory portion of the file.
DirectoryName (get) | Returns the directory portion of the filename.
Exists (get) | Indicates if the file exists on disk.
Extension (get) | Returns the extension portion of the filename.
FullName (get) | Returns a full path to the file, including the filename.
LastAccessTime (get) | Returns the last time the file was accessed.
LastAccessTime (let) | Sets the time the file was last accessed.
LastAccessTime (set) | Sets the time the file was last accessed.
LastAccessTimeUtc (get) | Returns the time the file was last accessed in UTC time.
LastAccessTimeUtc (let) | Sets the time the file was last accessed in UTC time.
LastAccessTimeUtc (set) | Sets the time the file was last accessed in UTC time.
LastWriteTime (get) | Returns the last time the file was written to.
LastWriteTime (let) | Sets the last time the file was written to.
LastWriteTime (set) | Sets the last time the file was written to.
LastWriteTimeUtc (get) | Returns the last time the file was accessed in UTC time.
LastWriteTimeUtc (let) | Sets the last the time file was written to in UTC time.
LastWriteTimeUtc (set) | Sets the last time the file was written to in UTC time.
Length (get) | Returns the size of the file in bytes.
Name (get) | Returns the filename portion of the path.

Methods:

Name | Description
AppendText | Opens a StreamWriter for the file.
CopyTo | Copies this file to a new location, with optional overwrite.
Create | Creates this file and returns a FileStream object to access it.
CreateText | Returns a StreamWriter to write to this file.
Delete | Deletes this file.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
MoveTo | Moves this file to a new location.
OpenFile | Opens the file as a FileStream.
OpenRead | Returns a FileStream in ReadOnly mode.
OpenText | Returns a StreamReader to this file.
OpenWrite | Returns a FileStream with write access to the file.
Refresh | Reloads the file attributes and times.
ToString | Returns a string representation of this object instance.

Remarks

The existence of the file is not verified until an action that requires accessing the file.

 Dim info As FileInfo
 Set info = NewFileInfo("c:\myfile.txt")
 Debug.Print info.Length

See Also

Project CorLib Overview

Class FileInfo Overview

Constructors


FileInfo: AppendText

AppendText

Opens a StreamWriter for the file.

 Public Function AppendText ( ) As StreamWriter

Return Values

StreamWriter - A Stream writer to the file.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: Attributes (get)

Attributes

Returns the attributes for the file (ReadOnly, Hidden, ...)

 Public Property Get Attributes ( ) As FileAttributes

Return Values

FileAttributes - The attributes of the file.

Remarks

The attributes are represented as bits. Each attributes has a specific bit. To test if a specific attribute exists, the attributes need to be ANDed with the individual attribute bits.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: Attributes (let)

Attributes

Sets the attributes for the file (ReadOnly, Hidden, ...)

 Public Property Let Attributes(
      ByVal Value As FileAttributes )

Parameters

Value
[ByVal] FileAttributes. The attributes to set the file to.

Remarks

All attributes are set at once. In order to modify a single attribute, the remaining attribute settings need to be included with the modified attribute.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: CopyTo

CopyTo

Copies this file to a new location, with optional overwrite.

 Public Function CopyTo(
      ByRef DestFileName As String,
      Optional ByVal OverWrite As Boolean = False ) As FileInfo

Parameters

DestFileName
[ByRef] String. The new filename this file will be copied as.
OverWrite
[ByVal] Optional. Boolean. Permission to overwrite an existing file.

Default: False

Return Values

FileInfo -

Remarks

The destination must be on the same volume as this file.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: Create

Create

Creates this file and returns a FileStream object to access it.

 Public Function Create ( ) As FileStream

Return Values

FileStream - A FileStream object used to access the created file.

Remarks

If the file does not exist it will be created. If it already exists, it will be overwritten.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: CreateText

CreateText

Returns a StreamWriter to write to this file.

 Public Function CreateText ( ) As StreamWriter

Return Values

StreamWriter - The StreamWriter for writing to this file.

Remarks

If the file does not exist it will be created. If it already exists, it will be overwritten.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: CreationTime (get)

CreationTime

Returns the creation time as a CorDateTime object.

 Public Property Get CreationTime ( ) As Variant

Return Values

Variant - The creation time of the file.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: CreationTime (let)

CreationTime

Sets the creation time of the file.

 Public Property Let CreationTime(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: CreationTime (set)

CreationTime

Sets the creation time of the file.

 Public Property Set CreationTime(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: CreationTimeUtc (get)

CreationTimeUtc

Returns the creation time as a UTC time.

 Public Property Get CreationTimeUtc ( ) As Variant

Return Values

Variant - The creation time of the file in UTC time.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: CreationTimeUtc (let)

CreationTimeUtc

Sets the creation time of the file in UTC time.

 Public Property Let CreationTimeUtc(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: CreationTimeUtc (set)

CreationTimeUtc

Sets the creation time of the file in UTC time.

 Public Property Set CreationTimeUtc(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: Delete

Delete

Deletes this file.

 Public Sub Delete ( )

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: Directory (get)

Directory

Returns a DirectoryInfo object of the directory portion of the file.

 Public Property Get Directory ( ) As DirectoryInfo

Return Values

DirectoryInfo - A DirectoryInfo object of the directory.

Remarks

This does not verify the file exists, or the directory.

Read Only.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: DirectoryName (get)

DirectoryName

Returns the directory portion of the filename.

 Public Property Get DirectoryName ( ) As String

Return Values

String - The directory portion of the filename.

Remarks

This does not very the existence of the file.

Read Only.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: Exists (get)

Exists

Indicates if the file exists on disk.

 Public Property Get Exists ( ) As Boolean

Return Values

Boolean - An indication of the existence of the file.

Read Only.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: Extension (get)

Extension

Returns the extension portion of the filename.

 Public Property Get Extension ( ) As String

Return Values

String - The extension portion of the filename.

Read Only.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: FileSystemInfo

FileSystemInfo

 Implements FileSystemInfo

Return Values

FileSystemInfo -

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: FullName (get)

FullName

Returns a full path to the file, including the filename.

 Public Property Get FullName ( ) As String

Return Values

String - A full path to the file.

Remarks

If not root directory portion is found in the filename, then the currenct directory is used.

Read Only.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: LastAccessTime (get)

LastAccessTime

Returns the last time the file was accessed.

 Public Property Get LastAccessTime ( ) As Variant

Return Values

Variant - A CorDateTime object of the last access time.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: LastAccessTime (let)

LastAccessTime

Sets the time the file was last accessed.

 Public Property Let LastAccessTime(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: LastAccessTime (set)

LastAccessTime

Sets the time the file was last accessed.

 Public Property Set LastAccessTime(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: LastAccessTimeUtc (get)

LastAccessTimeUtc

Returns the time the file was last accessed in UTC time.

 Public Property Get LastAccessTimeUtc ( ) As Variant

Return Values

Variant - A CorDateTime object of the last accessed UTC time.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: LastAccessTimeUtc (let)

LastAccessTimeUtc

Sets the time the file was last accessed in UTC time.

 Public Property Let LastAccessTimeUtc(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new UTC time.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: LastAccessTimeUtc (set)

LastAccessTimeUtc

Sets the time the file was last accessed in UTC time.

 Public Property Set LastAccessTimeUtc(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new UTC time.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: LastWriteTime (get)

LastWriteTime

Returns the last time the file was written to.

 Public Property Get LastWriteTime ( ) As Variant

Return Values

Variant - A CorDateTime object of the last time the file was written to.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: LastWriteTime (let)

LastWriteTime

Sets the last time the file was written to.

 Public Property Let LastWriteTime(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: LastWriteTime (set)

LastWriteTime

Sets the last time the file was written to.

 Public Property Set LastWriteTime(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: LastWriteTimeUtc (get)

LastWriteTimeUtc

Returns the last time the file was accessed in UTC time.

 Public Property Get LastWriteTimeUtc ( ) As Variant

Return Values

Variant - A CorDateTime object of the last time the file was written to.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: LastWriteTimeUtc (let)

LastWriteTimeUtc

Sets the last the time file was written to in UTC time.

 Public Property Let LastWriteTimeUtc(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: LastWriteTimeUtc (set)

LastWriteTimeUtc

Sets the last time the file was written to in UTC time.

 Public Property Set LastWriteTimeUtc(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: Length (get)

Length

Returns the size of the file in bytes.

 Public Property Get Length ( ) As Currency

Return Values

Currency - The size of the file.

Remarks

A Currency datatype is used to allow file sizes greater than 2gig.

Read Only.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: MoveTo

MoveTo

Moves this file to a new location.

 Public Sub MoveTo(
      ByRef DestFileName As String )

Parameters

DestFileName
[ByRef] String. The new location and name of the file.

Remarks

The new location must be on the same volume as the source filename.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: Name (get)

Name

Returns the filename portion of the path.

 Public Property Get Name ( ) As String

Return Values

String - The filename and extension.

Read Only.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: OpenFile

OpenFile

Opens the file as a FileStream.

 Public Function OpenFile(
      ByVal Mode As FileMode,
      Optional ByVal Access As FileAccess = ReadWriteAccess,
      Optional ByVal Share As FileShare = FileShare. None ) As FileStream

Parameters

Mode
[ByVal] FileMode. The method of opening the file.
Access
[ByVal] Optional. FileAccess. The read/write operations allowed by this FileStream.

Default: ReadWriteAccess

Share
[ByVal] Optional. FileShare. The read/write operations allows by other processes.

Default: FileShare . None

Return Values

FileStream - A FileStream object to this file.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: OpenRead

OpenRead

Returns a FileStream in ReadOnly mode.

 Public Function OpenRead ( ) As FileStream

Return Values

FileStream - A FileStream that has ReadOnly access to the file.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: OpenText

OpenText

Returns a StreamReader to this file.

 Public Function OpenText ( ) As StreamReader

Return Values

StreamReader - A StreamReader for reading the file.

Remarks

The StreamReaders default encoding is used.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: OpenWrite

OpenWrite

Returns a FileStream with write access to the file.

 Public Function OpenWrite ( ) As FileStream

Return Values

FileStream - A FileStream used to write to the file.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: Refresh

Refresh

Reloads the file attributes and times.

 Public Sub Refresh ( )

Remarks

This will verify that the file exists.

See Also

Project CorLib Overview

Class FileInfo Overview


FileInfo: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class FileInfo Overview


FileNotFoundException

FileNotFoundException

An exception thrown when a specified file was not found.

Implements:

Exception
IObject
IOException
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
FileName (get) | Gets the name of the file that could not be found.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

See Also

Project CorLib Overview

Class FileNotFoundException Overview

Constructors

ExceptionMethods

Exception


FileNotFoundException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class FileNotFoundException Overview


FileNotFoundException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class FileNotFoundException Overview


FileNotFoundException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class FileNotFoundException Overview


FileNotFoundException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class FileNotFoundException Overview


FileNotFoundException: FileName (get)

FileName

Gets the name of the file that could not be found.

 Public Property Get FileName ( ) As String

Return Values

String - The name of the file that could not be found, or an empty string if not filename was supplied.

Read Only.

See Also

Project CorLib Overview

Class FileNotFoundException Overview


FileNotFoundException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class FileNotFoundException Overview


FileNotFoundException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class FileNotFoundException Overview


FileNotFoundException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class FileNotFoundException Overview


FileNotFoundException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class FileNotFoundException Overview


FileNotFoundException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class FileNotFoundException Overview

Exception


FileNotFoundException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class FileNotFoundException Overview


FileNotFoundException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class FileNotFoundException Overview


FileNotFoundException: IOException

IOException

 Implements IOException

Return Values

IOException -

See Also

Project CorLib Overview

Class FileNotFoundException Overview


FileNotFoundException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewArgumentException.

Read Only.

See Also

Project CorLib Overview

Class FileNotFoundException Overview


FileNotFoundException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class FileNotFoundException Overview


FileNotFoundException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class FileNotFoundException Overview


FileNotFoundException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class FileNotFoundException Overview


FileNotFoundException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class FileNotFoundException Overview


FileStream

FileStream

Represents a file as a Stream.

Implements:

IObject
Stream

Public:

Types:

Name | Description
FileAccess | The accesses allowed to the FileStream.
FileMode | The modes in which to open a FileStream
FileShare | How the underlying stream can be shared with other processes.

Properties:

Name | Description
CanRead (get) | Returns an indication for the ability to read from the file stream.
CanSeek (get) | Returns an indication for the ability to seek within the file stream.
CanTimeout (get) | Returns if this object can timeout.
CanWrite (get) | Returns an indication for the ability to write to the file stream.
IsAsync (get) | Returns whether or not the FileStream was opened up in asynchronous mode.
Length (get) | The length of the current stream in bytes.
Name (get) | Returns the name of the underlying stream.
Position (get) | Returns the current position within the stream.
Position (let) | Sets the current position within the stream to be read from or written to.
ReadTimeout (get) | Returns the read timeout duration.
ReadTimeout (let) | Sets the read timeout duration.
SafeFileHandle (get) | Returns the handle to the underlying stream.
WriteTimeout (get) | Returns the write timeout duration.
WriteTimeout (let) | Sets the write timeout duration.

Methods:

Name | Description
BeginRead | Begins an Asynchronous read operation (currently is only synchronous)
BeginWrite | Begins an asynchronous buffer write. Currently the FileStream class does not support asynchronous buffer writing.
CloseStream | Closes the current stream, flushing any data that may need to be written to the stream.
CopyTo | Reads the bytes from the current stream and writes them to another stream.
EndRead | Signifies the end of an asynchronous read from the stream.
EndWrite | Signifies the end of an asynchronous write to the stream.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
Flush | Writes any data that may be in the write buffer to the underlying stream.
GetHashCode | Returns a pseudo-unique number identifying this instance.
LockStream | Locks a portion of a file to prevent write access for other processes.
ReadBlock | Reads a specified number of bytes into the given array.
ReadByte | Returns the next byte in the file stream starting at the current file position.
SeekPosition | Moves the file pointer to a new position relative to a specified reference.
SetLength | Sets the length of the stream to the specified length.
ToString | Returns a string representation of this object instance.
UnlockStream | Unlocks a portion of the file to allow write access to the stream for other processes.
WriteBlock | Writes an array of bytes to the stream.
WriteByte | Writes a single byte to the stream.

Remarks

Example

' This example creates a new file and writes an array
' of bytes containing the encoded string data. Once
' the file is written to, it is re-opened and read from
' recreating the original string for display.
Private Sub Main()
    Dim fs As FileStream
    Dim b() As Byte

    ' Encode a string using the default encoding scheme.
    b = Encoding.Default.GetBytes("Hello")

    ' Open a text file. If the file already exits, it
    ' will be overwritten.
    Set fs = NewFileStream("data.txt", FileMode.Create)

    ' Write the encoded bytes to the file stream
    fs.WriteBlock b, 0, cArray.GetLength(b)
    fs.CloseStream

    ' Re-open the the file using a new FileStream object.
    Set fs = NewFileStream("data.txt", FileMode.OpenExisting)

    ' Resize the byte array to hold all the bytes in the file.
    ReDim b(0 To fs.Length - 1)

    ' Read in all bytes in the file.
    fs.ReadBlock b, 0, fs.Length
    fs.CloseStream

    ' Decode the byte array back into a string
    ' and display the string.
    Console.WriteLine Encoding.Default.GetString(b)
    Console.ReadLine

End Sub

See Also

Project CorLib Overview

Class FileStream Overview

Constructors

Stream


FileStream: BeginRead

BeginRead

Begins an Asynchronous read operation (currently is only synchronous)

 Public Function BeginRead(
      ByRef Buffer ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long,
      Optional ByVal Callback As AsyncCallback,
      Optional ByRef State As Variant ) As IAsyncResult

Parameters

Buffer
[ByRef] Byte. The array to store the bytes that are read from the stream.
Offset
[ByVal] Long. The index in Buffer to begin storing bytes.
Count
[ByVal] Long. The number of bytes to be read from the stream.
Callback
[ByVal] Optional. AsyncCallback. An object that is called when the read operation is complete.
State
[ByRef] Optional. Variant. user-defined data to be kept with the Callback object for later retrieval.

Return Values

IAsyncResult - An IAsyncResult object used to identify the corrisponding Endread and report information about the buffer read.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: BeginWrite

BeginWrite

Begins an asynchronous buffer write. Currently the FileStream class does not support asynchronous buffer writing.

 Public Function BeginWrite(
      ByRef Buffer ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long,
      Optional ByVal Callback As AsyncCallback,
      Optional ByRef State As Variant ) As IAsyncResult

Parameters

Buffer
[ByRef] Byte. The source array to copy the bytes from into the stream.
Offset
[ByVal] Long. The starting index in the source Buffer to begin copying from.
Count
[ByVal] Long. The maximum number of bytes to be copied into the stream.
Callback
[ByVal] Optional. AsyncCallback. A user supplied object to be notified of the finish of the writing.
State
[ByRef] Optional. Variant. User data that can be carried within the IAsyncResult object return.

Return Values

IAsyncResult - An IAsyncResult object used to identify the corrisponding EndBread and report information about the buffer read.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: CanRead (get)

CanRead

Returns an indication for the ability to read from the file stream.

 Public Property Get CanRead ( ) As Boolean

Return Values

Boolean - An indication for being able to read from the file stream.

Read Only.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: CanSeek (get)

CanSeek

Returns an indication for the ability to seek within the file stream.

 Public Property Get CanSeek ( ) As Boolean

Return Values

Boolean - An indication for being able to seek within the file stream.

Read Only.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: CanTimeout (get)

CanTimeout

Returns if this object can timeout.

 Public Property Get CanTimeout ( ) As Boolean

Return Values

Boolean - Always returns False for a FileStream.

Read Only.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: CanWrite (get)

CanWrite

Returns an indication for the ability to write to the file stream.

 Public Property Get CanWrite ( ) As Boolean

Return Values

Boolean - An indication for being able to write to the file stream.

Read Only.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: CloseStream

CloseStream

Closes the current stream, flushing any data that may need to be written to the stream.

 Public Sub CloseStream ( )

Remarks

If the stream was created around a handle and the stream was given ownership of the handle, then the handle will also be closed with the stream. Otherwise, only the stream will be closed, leaving the handle in its original state.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: CopyTo

CopyTo

Reads the bytes from the current stream and writes them to another stream.

 Public Sub CopyTo(
      ByVal Destination As Stream,
      Optional ByVal BufferSize As Long = 81920 )

Parameters

Destination
[ByVal] Stream. The stream to which the contents of the current stream will be copied.
BufferSize
[ByVal] Optional. Long. The size of the buffer. This value must be greater than zero. The default size is 81920.

Default: 81920

Remarks

Copying begins at the current position in the current stream, and does not reset the position of the destination stream after the copy operation is complete.

Exceptions

Exception | Condition
ArgumentNullException | Destination is Nothing.
NotSupportedException | The current stream does not support reading. -or- Destination does not support writing.
ObjectDisposedException | Either the current stream or Destination were closed before the CopyTo method was called.
IOException | An I/O error occurred.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: EndRead

EndRead

Signifies the end of an asynchronous read from the stream.

 Public Function EndRead(
      ByVal AsyncResult As IAsyncResult ) As Long

Parameters

AsyncResult
[ByVal] IAsyncResult. The IAsyncResult object returned from the BeginRead function.

Return Values

Long - The number of bytes read from the stream in to Buffer in the BeginRead method.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: EndWrite

EndWrite

Signifies the end of an asynchronous write to the stream.

 Public Sub EndWrite(
      ByVal AsyncResult As IAsyncResult )

Parameters

AsyncResult
[ByVal] IAsyncResult. The IAsyncResult returned from the BeginWrite function.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: FileAccess

FileAccess

The accesses allowed to the FileStream.

 Public Enum FileAccess

Values

ReadAccess = 1
Grants read permission to the FileStream.
WriteAccess = 2
Grants write permission to the FileStream.
ReadWriteAccess = 3
Grants both read and write permissions to the FileStream.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: FileMode

FileMode

The modes in which to open a FileStream

 Public Enum FileMode

Values

CreateNew = 1
Creates a new file. If the file already exists, then an IOException is thrown.
Create = 2
Creates a new file. If the file already exists, it is overwritten.
OpenExisting = 3
Opens an existing file. If the file does not exist, then a FileNotFoundException is thrown.
OpenOrCreate = 4
Opens an existing file. If the file does not exist, it will be created.
Truncate = 5
Opens an existing file and sets the file length to 0. If an attempt to read is made, then an exception will be thrown.
Append = 6
Opens an existing or creates a new file, then moves to the end for writing to begin at. Reading of the stream is not supported.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: FileShare

FileShare

How the underlying stream can be shared with other processes.

 Public Enum FileShare

Values

None = 0
The stream is not shared with other processes.
ReadShare = 1
Other processes can access the file with read access only.
WriteShare = 2
Other processes can access the file with write access only.
ReadWriteShare = 3
Other processes can access the file with read and write access.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: Flush

Flush

Writes any data that may be in the write buffer to the underlying stream.

 Public Sub Flush ( )

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: IsAsync (get)

IsAsync

Returns whether or not the FileStream was opened up in asynchronous mode.

 Public Property Get IsAsync ( ) As Boolean

Return Values

Boolean - Boolean indicating if the FileStream is in asynchronous mode or not.

Read Only.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: Length (get)

Length

The length of the current stream in bytes.

 Public Property Get Length ( ) As Currency

Return Values

Currency - The number of bytes the current file is.

Remarks

If there is write data in the buffer, it will be flushed out to the file to allow for an accurate reading.

Read Only.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: LockStream

LockStream

Locks a portion of a file to prevent write access for other processes.

 Public Sub LockStream(
      ByVal Position As Currency,
      ByVal Length As Currency )

Parameters

Position
[ByVal] Currency. The starting position in the file to begin locking.
Length
[ByVal] Currency. The number of bytes to be locked.

Remarks

Onces a section of the file is locked, read access is still allowed to other processes.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: Name (get)

Name

Returns the name of the underlying stream.

 Public Property Get Name ( ) As String

Return Values

String - If the stream is a file, then the file name is returned, otherwise the name is unknown.

Read Only.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: Position (get)

Position

Returns the current position within the stream.

 Public Property Get Position ( ) As Currency

Return Values

Currency - The current position within the stream.

Remarks

The current position is where the next byte is read from or written to. Once a byte has been read or written, the position is advanced byte 1 byte.

Read/Write.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: Position (let)

Position

Sets the current position within the stream to be read from or written to.

 Public Property Let Position(
      ByVal Value As Currency )

Parameters

Value
[ByVal] Currency. The new position in the stream.

Remarks

The position is an absolute byte position from the beginning of the file. If the new position is negative an exception is thrown. If the FileStream is opened in Append mode, then the position cannot be set to data within the original file.

Read/Write.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: ReadBlock

ReadBlock

Reads a specified number of bytes into the given array.

 Public Function ReadBlock(
      ByRef Bytes ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long ) As Long

Parameters

Bytes
[ByRef] Byte. The array to store the bytes that are read from the stream.
Offset
[ByVal] Long. The index in Buffer to begin storing bytes. Offset starts at LBound of Bytes.
Count
[ByVal] Long. The number of bytes to be read from the stream.

Return Values

Long - The number of byte actually read from the stream.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: ReadByte

ReadByte

Returns the next byte in the file stream starting at the current file position.

 Public Function ReadByte ( ) As Long

Return Values

Long - The byte value at the current file position.

Remarks

If the file position is passed the end of the stream, then -1 is returned.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: ReadTimeout (get)

ReadTimeout

Returns the read timeout duration.

 Public Property Get ReadTimeout ( ) As Long

Return Values

Long - The timeout duration.

Remarks

This is not supported in FileStream. An exception will be thrown.

Read/Write.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: ReadTimeout (let)

ReadTimeout

Sets the read timeout duration.

 Public Property Let ReadTimeout(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The timeout duration in milliseconds.

Remarks

This is not supported in FileStream. An exception will be thrown.

Read/Write.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: SafeFileHandle (get)

SafeFileHandle

Returns the handle to the underlying stream.

 Public Property Get SafeFileHandle ( ) As SafeFileHandle

Return Values

SafeFileHandle - The handle for the underlying stream.

Remarks

If there is any information in the buffers, they are flushed back to the underlying stream before the handle is returned.

Read Only.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: SeekPosition

SeekPosition

Moves the file pointer to a new position relative to a specified reference.

 Public Function SeekPosition(
      ByVal Offset As Currency,
      ByVal Origin As SeekOrigin ) As Currency

Parameters

Offset
[ByVal] Currency. The number of bytes to move from the reference point. The value can be negative to move backwards.
Origin
[ByVal] SeekOrigin. The reference point to begin moving the file pointer from.

Return Values

Currency - The new position in the file stream.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: SetLength

SetLength

Sets the length of the stream to the specified length.

 Public Sub SetLength(
      ByVal Value As Currency )

Parameters

Value
[ByVal] Currency. The length of the new file in bytes.

Remarks

If the new value is less than the origin file, then the file will be truncated. If the new value is larger than the original, then the newly exposed bytes are of undefined value.

The stream must have Seek and Write support

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: Stream

Stream

 Implements Stream

Return Values

Stream -

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: UnlockStream

UnlockStream

Unlocks a portion of the file to allow write access to the stream for other processes.

 Public Sub UnlockStream(
      ByVal Position As Currency,
      ByVal Length As Currency )

Parameters

Position
[ByVal] Currency. The starting position in the file to begin unlocking.
Length
[ByVal] Currency. The number of bytes to be unlocked.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: WriteBlock

WriteBlock

Writes an array of bytes to the stream.

 Public Sub WriteBlock(
      ByRef Bytes ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long )

Parameters

Bytes
[ByRef] Byte. The source array to write to the stream.
Offset
[ByVal] Long. The index of the first byte in Buffer to be written to the stream.
Count
[ByVal] Long. The number of bytes to write from the array.

Remarks

The data to be written is buffered if there is enough room, otherwise, any data in the buffer is written to the stream, followed by the data in Buffer.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: WriteByte

WriteByte

Writes a single byte to the stream.

 Public Sub WriteByte(
      ByVal Value As Byte )

Parameters

Value
[ByVal] Byte. The value to be written to the stream.

Remarks

The value is written to the underlying buffer. Once the buffer is full, it is then flushed to the underlying stream and emptied to be reused.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: WriteTimeout (get)

WriteTimeout

Returns the write timeout duration.

 Public Property Get WriteTimeout ( ) As Long

Return Values

Long - The write timeout duration.

Remarks

This is not supported in FileStream. An exception will be thrown.

Read/Write.

See Also

Project CorLib Overview

Class FileStream Overview


FileStream: WriteTimeout (let)

WriteTimeout

Sets the write timeout duration.

 Public Property Let WriteTimeout(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The timeout duration in milliseconds.

Remarks

This is not supported in FileStream. An exception will be thrown.

Read/Write.

See Also

Project CorLib Overview

Class FileStream Overview


FileSystemInfo

FileSystemInfo

The FileSystemInfo interface is used to access both FileInfo and DirectoryInfo objects using the same code. This allows for similar properties and methods to be used on both files and directories with a single routine.

Public:

Types:

Name | Description
FileAttributes | Flags used to indicate properties of a file or directory.

Properties:

Name | Description
Attributes (get) | Returns the attributes for the FileSystemInfo entry.
Attributes (let) | Sets the attributes for the FileSystemInfo entry.
CreationTime (get) | Returns the time the FileSystemInfo entry was created in local time.
CreationTime (let) | Sets the time the FileSystemInfo entry was created in local time.
CreationTime (set) | Sets the time the FileSystemInfo entry was created in local time.
CreationTimeUtc (get) | Returns the time the FileSystemInfo entry was created in UTC time.
CreationTimeUtc (let) | Sets the time the FileSystemInfo entry was created in UTC time.
CreationTimeUtc (set) | Sets the time the FileSystemInfo entry was created in UTC time.
Exists (get) | Returns if the FileSystemInfo entry exists.
Extension (get) | Returns the extension portion of the name.
FullName (get) | Returns the full name of the entry.
LastAccessTime (get) | Returns the time the FileSystemInfo entry was last accessed in local time.
LastAccessTime (let) | Sets the time the FileSystemInfo entry was last accessed in local time.
LastAccessTime (set) | Sets the time the FileSystemInfo entry was last accessed in local time.
LastAccessTimeUtc (get) | Returns the time the FileSystemInfo entry was last accessed in UTC time.
LastAccessTimeUtc (let) | Sets the time the FileSystemInfo entry was last accessed in UTC time.
LastAccessTimeUtc (set) | Sets the time the FileSystemInfo entry was last accessed in UTC time.
LastWriteTime (get) | Returns the time the FileSystemInfo entry was last written to in local time.
LastWriteTime (let) | Sets the time the FileSystemInfo entry was last written to in local time.
LastWriteTime (set) | Sets the time the FileSystemInfo entry was last written to in local time.
LastWriteTimeUtc (get) | Returns the time the FileSystemInfo entry was last written to in UTC time.
LastWriteTimeUtc (let) | Sets the time the FileSystemInfo entry was last written to in UTC time.
LastWriteTimeUtc (set) | Sets the time the FileSystemInfo entry was last written to in UTC time.
Name (get) | Returns the name of the entry.

Methods:

Name | Description
Delete | Deletes the entry from disk.
Equals | Tests for equality with the passed in value.
GetHashCode | Returns a pseudo-unique number used to represent this instance.
Refresh | Reloads the entry with the most current information.
ToString | Returns a string representation of this instance.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: Attributes (get)

Attributes

Returns the attributes for the FileSystemInfo entry.

 Public Property Get Attributes ( ) As FileAttributes

Return Values

FileAttributes - The attributes for the FileSystemInfo entry.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: Attributes (let)

Attributes

Sets the attributes for the FileSystemInfo entry.

 Public Property Let Attributes(
      ByVal Value As FileAttributes ) :

Parameters

Value
[ByVal] FileAttributes. The attributes the entry is set to.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: CreationTime (get)

CreationTime

Returns the time the FileSystemInfo entry was created in local time.

 Public Property Get CreationTime ( ) As Variant

Return Values

Variant - A CorDateTime object of the creation time.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: CreationTime (let)

CreationTime

Sets the time the FileSystemInfo entry was created in local time.

 Public Property Let CreationTime(
      ByRef Value As Variant ) :

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: CreationTime (set)

CreationTime

Sets the time the FileSystemInfo entry was created in local time.

 Public Property Set CreationTime(
      ByRef Value As Variant ) :

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: CreationTimeUtc (get)

CreationTimeUtc

Returns the time the FileSystemInfo entry was created in UTC time.

 Public Property Get CreationTimeUtc ( ) As Variant

Return Values

Variant - A CorDateTime object of the creation time.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: CreationTimeUtc (let)

CreationTimeUtc

Sets the time the FileSystemInfo entry was created in UTC time.

 Public Property Let CreationTimeUtc(
      ByRef Value As Variant ) :

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: CreationTimeUtc (set)

CreationTimeUtc

Sets the time the FileSystemInfo entry was created in UTC time.

 Public Property Set CreationTimeUtc(
      ByRef Value As Variant ) :

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: Delete

Delete

Deletes the entry from disk.

 Public Sub Delete ( )

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: Equals

Equals

Tests for equality with the passed in value.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test for equality against.

Return Values

Boolean - An indication of the equality.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: Exists (get)

Exists

Returns if the FileSystemInfo entry exists.

 Public Property Get Exists ( ) As Boolean

Return Values

Boolean - An indication of the entry existing.

Read Only.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: Extension (get)

Extension

Returns the extension portion of the name.

 Public Property Get Extension ( ) As String

Return Values

String - The extension portion of the name.

Read Only.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: FileAttributes

FileAttributes

Flags used to indicate properties of a file or directory.

 Public Enum FileAttributes

Values

ReadOnly = &H1
The file or directory can only be read from.
Hidden = &H2
The file or directory is to be hidden in normal file listings.
System = &H4
The file or directory is system object and caution should be used.
DirectoryAttr = &H10
The object is a directory.
Archive = &H20
The file or directory is marked for backup.
Device = &H40
Reserved for future use.
Normal = &H80
The file is normal and has no other attributes set. This attribute is valid only if used alone.
Temporary = &H100
The file is temporary. File systems attempt to keep all of the data in memory for quicker access rather than flushing the data back to mass storage. A temporary file should be deleted by the application as soon as it is no longer needed.
SparseFile = &H200
The file is a sparse file. Sparse files are typically large files whose data are mostly zeros.
ReparsePoint = &H400
The file contains a reparse point, which is a block of user-defined data associated with a file or a directory.
Compressed = &H800
The file is compressed.
Offline = &H1000
The file is offline. The data of the file is not immediately available.
NotContentIndexed = &H2000
The file will not be indexed by the operating systems content indexing service.
Encrypted = &H4000
The file or directory is encrypted. For a file, this means that all data in the file is encrypted. For a directory, this means that encryption is the default for newly created files and directories.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: FullName (get)

FullName

Returns the full name of the entry.

 Public Property Get FullName ( ) As String

Return Values

String - The full name of the entry.

Read Only.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: GetHashCode

GetHashCode

Returns a pseudo-unique number used to represent this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - a pseudo-unique number used to represent this instance.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: LastAccessTime (get)

LastAccessTime

Returns the time the FileSystemInfo entry was last accessed in local time.

 Public Property Get LastAccessTime ( ) As Variant

Return Values

Variant - A CorDateTime object of the time.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: LastAccessTime (let)

LastAccessTime

Sets the time the FileSystemInfo entry was last accessed in local time.

 Public Property Let LastAccessTime(
      ByRef Value As Variant ) :

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: LastAccessTime (set)

LastAccessTime

Sets the time the FileSystemInfo entry was last accessed in local time.

 Public Property Set LastAccessTime(
      ByRef Value As Variant ) :

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: LastAccessTimeUtc (get)

LastAccessTimeUtc

Returns the time the FileSystemInfo entry was last accessed in UTC time.

 Public Property Get LastAccessTimeUtc ( ) As Variant

Return Values

Variant - A CorDateTime object of the time.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: LastAccessTimeUtc (let)

LastAccessTimeUtc

Sets the time the FileSystemInfo entry was last accessed in UTC time.

 Public Property Let LastAccessTimeUtc(
      ByRef Value As Variant ) :

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: LastAccessTimeUtc (set)

LastAccessTimeUtc

Sets the time the FileSystemInfo entry was last accessed in UTC time.

 Public Property Set LastAccessTimeUtc(
      ByRef Value As Variant ) :

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: LastWriteTime (get)

LastWriteTime

Returns the time the FileSystemInfo entry was last written to in local time.

 Public Property Get LastWriteTime ( ) As Variant

Return Values

Variant - A CorDateTime object of the time.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: LastWriteTime (let)

LastWriteTime

Sets the time the FileSystemInfo entry was last written to in local time.

 Public Property Let LastWriteTime(
      ByRef Value As Variant ) :

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: LastWriteTime (set)

LastWriteTime

Sets the time the FileSystemInfo entry was last written to in local time.

 Public Property Set LastWriteTime(
      ByRef Value As Variant ) :

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: LastWriteTimeUtc (get)

LastWriteTimeUtc

Returns the time the FileSystemInfo entry was last written to in UTC time.

 Public Property Get LastWriteTimeUtc ( ) As Variant

Return Values

Variant - A CorDateTime object of the time.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: LastWriteTimeUtc (let)

LastWriteTimeUtc

Sets the time the FileSystemInfo entry was last written to in UTC time.

 Public Property Let LastWriteTimeUtc(
      ByRef Value As Variant ) :

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: LastWriteTimeUtc (set)

LastWriteTimeUtc

Sets the time the FileSystemInfo entry was last written to in UTC time.

 Public Property Set LastWriteTimeUtc(
      ByRef Value As Variant ) :

Parameters

Value
[ByRef] Variant. A Date or CorDateTime object of the new time.

Read/Write.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: Name (get)

Name

Returns the name of the entry.

 Public Property Get Name ( ) As String

Return Values

String - The name of the entry.

Read Only.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: Refresh

Refresh

Reloads the entry with the most current information.

 Public Sub Refresh ( )

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FileSystemInfo: ToString

ToString

Returns a string representation of this instance.

 Public Function ToString ( ) As String

Return Values

String - a string representation of this instance.

See Also

Project CorLib Overview

Class FileSystemInfo Overview


FormatException

FormatException

The exception that is thrown when the format of an argument does not meet the parameter specifications of the invoked method.

Implements:

Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

Remarks

FormatException is thrown when the format of an argument in a method invocation does not match the format of the corresponding formal parameter type. For example, if a method specifies a String parameter consisting of two digits with an embedded period, passing a corresponding string argument containing only two digits to that method would cause FormatException to be thrown.

See Also

Project CorLib Overview

Class FormatException Overview

Constructors

ExceptionMethods

Exception


FormatException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class FormatException Overview


FormatException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class FormatException Overview


FormatException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class FormatException Overview


FormatException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class FormatException Overview


FormatException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class FormatException Overview


FormatException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class FormatException Overview


FormatException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class FormatException Overview


FormatException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class FormatException Overview


FormatException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class FormatException Overview

Exception


FormatException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class FormatException Overview


FormatException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class FormatException Overview


FormatException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewArgumentException.

Read Only.

See Also

Project CorLib Overview

Class FormatException Overview


FormatException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class FormatException Overview


FormatException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class FormatException Overview


FormatException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class FormatException Overview


FormatException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class FormatException Overview


FromBase64Transform

FromBase64Transform

Transforms data from base-64 to plain text.

Implements:

ICryptoTransform
IObject

Public:

Types:

Name | Description
FromBase64TransformMode | Represents choices to ignore white spaces when tranforming blocks of text.

Properties:

Name | Description
CanReuseTransform (get) | Returns if the transform instance can be reused after transforming the final data.
CanTransformMultipleBlocks (get) | Returns if TransformBlock can transform multiple blocks can be transformed in a single call.
InputBlockSize (get) | Returns then block size the input data must be, or be a multiple of.
OutputBlockSize (get) | Returns the block size of the output data.

Methods:

Name | Description
Clear | Releases any resources held in the transform.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function. An override might be necessary if the hashcode should be derived from a value contained within the class.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides. A Person class may return the persons name instead.
TransformBlock | Transforms a block of data from a base-64 encoding to plain text.
TransformFinalBlock | Transforms a block of data and any data that has been buffered from previous TransformBlock calls.

Remarks

This class is used primarily in conjunction with the CryptoStream class and shouldnt be used to process large amounts of data manually. For that use the Convert.FromBase64String method.

See Also

Project CorLib Overview

Class FromBase64Transform Overview


FromBase64Transform: CanReuseTransform (get)

CanReuseTransform

Returns if the transform instance can be reused after transforming the final data.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class FromBase64Transform Overview


FromBase64Transform: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if TransformBlock can transform multiple blocks can be transformed in a single call.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Always returns False.

Read Only.

See Also

Project CorLib Overview

Class FromBase64Transform Overview


FromBase64Transform: Clear

Clear

Releases any resources held in the transform.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class FromBase64Transform Overview


FromBase64Transform: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test for equality.

Return Values

Boolean -

See Also

Project CorLib Overview

Class FromBase64Transform Overview


FromBase64Transform: FromBase64TransformMode

FromBase64TransformMode

Represents choices to ignore white spaces when tranforming blocks of text.

 Public Enum FromBase64TransformMode

Values

IgnoreWhiteSpaces = 0
Any whitespace is skipped and the processing begins with the next non-whitespace character.
DoNotIgnoreWhiteSpaces = 1
If whitespace is encountered during processing, then an exception will be thrown.

Remarks

Whitespaces are defined as characters with the ascii value of 32, 9, 10, 11, 12, 13, 133, 160.

See Also

Project CorLib Overview

Class FromBase64Transform Overview


FromBase64Transform: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

An override might be necessary if the hashcode should be derived from a value contained within the class.

 Public Function GetHashCode ( ) As Long

Return Values

Long -

See Also

Project CorLib Overview

Class FromBase64Transform Overview


FromBase64Transform: ICryptoTransform

ICryptoTransform

 Implements ICryptoTransform

Return Values

ICryptoTransform -

See Also

Project CorLib Overview

Class FromBase64Transform Overview


FromBase64Transform: InputBlockSize (get)

InputBlockSize

Returns then block size the input data must be, or be a multiple of.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - The input block size.

Read Only.

See Also

Project CorLib Overview

Class FromBase64Transform Overview


FromBase64Transform: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class FromBase64Transform Overview


FromBase64Transform: OutputBlockSize (get)

OutputBlockSize

Returns the block size of the output data.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - The output block size.

Read Only.

See Also

Project CorLib Overview

Class FromBase64Transform Overview


FromBase64Transform: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

A Person class may return the persons name instead.

 Public Function ToString ( ) As String

Return Values

String -

See Also

Project CorLib Overview

Class FromBase64Transform Overview


FromBase64Transform: TransformBlock

TransformBlock

Transforms a block of data from a base-64 encoding to plain text.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to be transformed.
InputOffset
[ByVal] Long. The starting position in the array to begin transforming.
InputCount
[ByVal] Long. The number of bytes to be transformed.
OutputBuffer
[ByRef] Byte. The array to place the transformed data in.
OutputOffset
[ByVal] Long. The starting position to begin placing the output data.

Return Values

Long - The number of bytes transformed.

See Also

Project CorLib Overview

Class FromBase64Transform Overview


FromBase64Transform: TransformFinalBlock

TransformFinalBlock

Transforms a block of data and any data that has been buffered from previous TransformBlock calls.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The remaining data to be transformed.
InputOffset
[ByVal] Long. The starting index to being transforming from.
InputCount
[ByVal] Long. The number of bytes to transform.

Return Values

Byte() - The final transformed data.

See Also

Project CorLib Overview

Class FromBase64Transform Overview


GregorianCalendar

GregorianCalendar

Provides methods for manipulating dates using the Gregorian calendar mathematics.

Implements:

Calendar
ICloneable
IObject

Public:

Types:

Name | Description
GregorianCalendarTypes | Defines the different language versions of the Gregorian calendar.

Properties:

Name | Description
AlgorithmType (get) | Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.
CalendarType (get) | Returns the GregorianCalendarTypes that represents the language version.
CalendarType (let) | Sets the GregorianCalendarTypes that represents the language version.
Eras (get) | Returns an array of eras this calendar represents.
IsReadOnly (get) | Gets a value indicating whether this GregorianCalendar object is read-only.
MaxSupportedDateTime (get) | Gets the latest date and time supported by the GregorianCalendar object.
MinSupportedDateTime (get) | Gets the earliest date and time supported by the GregorianCalendar object.
TwoDigitYearMax (get) | Returns the maximum year to be created from a 2-digit year.
TwoDigitYearMax (let) | Sets the maximum year to be created from a 2-digit year.

Methods:

Name | Description
AddDays | Adds a number of days to the date provided using Gregorian math.
AddHours | Adds a number of hours to the date provided.
AddMilliseconds | Returns a CorDateTime this is the specified number of Milliseconds from the original Time.
AddMinutes | Returns a CorDateTime this is the specified number of Minutes from the original Time.
AddMonths | Returns a CorDateTime this is the specified number of Months from the original Time.
AddSeconds | Returns a CorDateTime this is the specified number of Seconds from the original Time.
AddWeeks | Returns a CorDateTime this is the specified number of Weeks from the original Time.
AddYears | Returns a CorDateTime this is the specified number of Years from the original Time.
Clone | Creates a new object that is a copy of the current GregorianCalendar object.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetDayOfMonth | Returns the day of the months for the specified date.
GetDayOfWeek | Returns the DayOfWeek enum of the specified date.
GetDayOfYear | Returns the day of the year for the specified date.
GetDaysInMonth | Returns the number of days in the specified month.
GetDaysInYear | Returns the number of days in the specified year.
GetEra | Returns the era that the specified time exists in.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetHour | Returns the hour of the specified time.
GetLeapMonth | Calculates the leap month for a specified year and era.
GetMilliseconds | Returns the milliseconds of the specified time.
GetMinute | Returns the minute of the specified time.
GetMonth | Returns the month of the specified time.
GetMonthsInYear | Returns the number of months in the specified year.
GetSecond | Returns the second of the specified time.
GetWeekOfYear | Returns the week of the year that the specified date belongs to.
GetYear | Returns the year of the specified time.
IsLeapDay | Returns a boolean indicating if the specific day is a leap day.
IsLeapMonth | Returns a boolean indicating if the specific month is a leap month.
IsLeapYear | Returns a boolean indicating if the specific year is a leap year.
ToDateTime | Returns a Gregorian CorDateTime computed using the specific calendar rules.
ToFourDigitYear | Returns a 4-digit year from a 2-digit number.
ToString | Returns a string representation of this object instance.

Remarks

The Gregorian calendar recognizes an era of BC (Before Christ) and AD (Anno Domino). The GregorianCalendar class only support the AD era (1).

The calendar supports the time from 01/01/0001 12:00:00AM to 12/31/9999 11:59:59PM.

Only leap year is recognized and occurs every 4 years, except a year that is evenly divisible by 100. However, if it is divisible by 400 then it is a leap year.

There are 12 months in the Gregorian calendar. The number of days range from 28 to 31, except on leap year when the shortest month is 29 days.

See Also

Project CorLib Overview

Class GregorianCalendar Overview

Calendar

GregorianCalendarStatic


GregorianCalendar: AddDays

AddDays

Adds a number of days to the date provided using Gregorian math.

 Public Function AddDays(
      ByRef Time As Variant,
      ByVal Days As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. This is a Date or CorDateTime to add a number of days to.
Days
[ByVal] Long. The number of days to be added to Time.

Return Values

CorDateTime - A CorDateTime object with the new date.

Remarks

Using this method works exactly like using the AddDays method on the CorDateTime objects.

A new CorDateTime object is returned with the days added to the original Time. If a Date is passed in, a CorDateTime object is still returned.

A negative value can be supplied for Days.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: AddHours

AddHours

Adds a number of hours to the date provided.

 Public Function AddHours(
      ByRef Time As Variant,
      ByVal Hours As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. A Date or CorDateTime to add a number of hours to.
Hours
[ByVal] Long. The number of hours to be added to the time portion of a date.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of hours added.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: AddMilliseconds

AddMilliseconds

Returns a CorDateTime this is the specified number of Milliseconds from the original Time.

 Public Function AddMilliseconds(
      ByRef Time As Variant,
      ByVal Milliseconds As Double ) As CorDateTime

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to add the specified number of Milliseconds to.
Milliseconds
[ByVal] Double. The number of Milliseconds to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Milliseconds added.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: AddMinutes

AddMinutes

Returns a CorDateTime this is the specified number of Minutes from the original Time.

 Public Function AddMinutes(
      ByRef Time As Variant,
      ByVal Minutes As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. A Date or CorDateTime to add the specified number of Minutes to.
Minutes
[ByVal] Long. The number of Minutes to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Minutes added.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: AddMonths

AddMonths

Returns a CorDateTime this is the specified number of Months from the original Time.

 Public Function AddMonths(
      ByRef Time As Variant,
      ByVal Months As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to add the specified number of Months to.
Months
[ByVal] Long. The number of Months to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Months added.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: AddSeconds

AddSeconds

Returns a CorDateTime this is the specified number of Seconds from the original Time.

 Public Function AddSeconds(
      ByRef Time As Variant,
      ByVal Seconds As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to add the specified number of Seconds to.
Seconds
[ByVal] Long. The number of Seconds to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Seconds added.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: AddWeeks

AddWeeks

Returns a CorDateTime this is the specified number of Weeks from the original Time.

 Public Function AddWeeks(
      ByRef Time As Variant,
      ByVal Weeks As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to add the specified number of Weeks to.
Weeks
[ByVal] Long. The number of Weeks to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Weeks added.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: AddYears

AddYears

Returns a CorDateTime this is the specified number of Years from the original Time.

 Public Function AddYears(
      ByRef Time As Variant,
      ByVal Years As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to add the specified number of Years to.
Years
[ByVal] Long. The number of Years to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Years added.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: AlgorithmType (get)

AlgorithmType

Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.

 Public Property Get AlgorithmType ( ) As CalendarAlgorithmType

Return Values

CalendarAlgorithmType - Always returns CalendarAlgorithmType.SolarCalendar.

Read Only.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: Calendar

Calendar

 Implements Calendar

Return Values

Calendar -

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: CalendarType (get)

CalendarType

Returns the GregorianCalendarTypes that represents the language version.

 Public Property Get CalendarType ( ) As GregorianCalendarTypes

Return Values

GregorianCalendarTypes - The calendar type that represents the language version.

Remarks

This value is only tracked with the calendar object. It does not apply languages to text values.

Read/Write.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: CalendarType (let)

CalendarType

Sets the GregorianCalendarTypes that represents the language version.

 Public Property Let CalendarType(
      ByVal Value As GregorianCalendarTypes )

Parameters

Value
[ByVal] GregorianCalendarTypes. The calendar type to set this instance to.

Remarks

This value is only tracked with the calendar object. It does not apply languages to text values.

Read/Write.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | The value of the specified operation is not a member of the GregorianCalendarTypes enumeration.
InvalidOperationException | In a let operation, the current instance is read-only.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: Clone

Clone

Creates a new object that is a copy of the current GregorianCalendar object.

 Public Function Clone ( ) As GregorianCalendar

Return Values

GregorianCalendar - A copy of the GregorianCalendar object.

Remarks

The clone will always be a non-readonly version.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: Eras (get)

Eras

Returns an array of eras this calendar represents.

 Public Property Get Eras ( ) As Long ( )

Return Values

Long() - An array containing the eras represented by this calendar.

Remarks

The Gregorian calendar recognizes only one era. The returned array will have one element containing the value 1.

Read Only.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: GetDayOfMonth

GetDayOfMonth

Returns the day of the months for the specified date.

 Public Function GetDayOfMonth(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the day of the month from.

Return Values

Long - The day of the month for the specified date.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: GetDayOfWeek

GetDayOfWeek

Returns the DayOfWeek enum of the specified date.

 Public Function GetDayOfWeek(
      ByRef Time As Variant ) As DayOfWeek

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the day of the week for.

Return Values

DayOfWeek - A DayOfWeek enum representing the day of the week.

Remarks

The DayOfWeek is Sunday and is 0-based. The Visual Basic enum vbDayOfWeek is 1-based.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: GetDayOfYear

GetDayOfYear

Returns the day of the year for the specified date.

 Public Function GetDayOfYear(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the day of the year from.

Return Values

Long - The day of the year.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: GetDaysInMonth

GetDaysInMonth

Returns the number of days in the specified month.

 Public Function GetDaysInMonth(
      ByVal Year As Long,
      ByVal Month As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year inwhich the month exists. This is used by calendars that have months that change based on the year, such as leap years.
Month
[ByVal] Long. The month to retrieve the number of days of.
Era
[ByRef] Optional. Variant. The time period inwhich the year exists.

Return Values

Long -

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: GetDaysInYear

GetDaysInYear

Returns the number of days in the specified year.

 Public Function GetDaysInYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year to retrieve the number of days of.
Era
[ByRef] Optional. Variant. The era the year exists in.

Return Values

Long - The number of days in the year.

Remarks

The Gregorian calendar has 365 days in a normal year and 366 days in a leap year.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: GetEra

GetEra

Returns the era that the specified time exists in.

 Public Function GetEra(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to find the containing era of.

Return Values

Long - The era for the time.

Remarks

The GregorianCalendar class only supports the current era of AD. This returns a constant of 1.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: GetHour

GetHour

Returns the hour of the specified time.

 Public Function GetHour(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the hour from.

Return Values

Long - The hour portion of the time.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: GetLeapMonth

GetLeapMonth

Calculates the leap month for a specified year and era.

 Public Function GetLeapMonth(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. A year.
Era
[ByRef] Optional. Variant. An era.

Return Values

Long - Always 0 because the Gregorian calendar does not recognize leap months.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: GetMilliseconds

GetMilliseconds

Returns the milliseconds of the specified time.

 Public Function GetMilliseconds(
      ByRef Time As Variant ) As Double

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the milliseconds from.

Return Values

Double - The millisecond portion of the time.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: GetMinute

GetMinute

Returns the minute of the specified time.

 Public Function GetMinute(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the minute from.

Return Values

Long - The minute portion of the time.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: GetMonth

GetMonth

Returns the month of the specified time.

 Public Function GetMonth(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the month from.

Return Values

Long - The month portion of the time.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: GetMonthsInYear

GetMonthsInYear

Returns the number of months in the specified year.

 Public Function GetMonthsInYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year to get the number of months of.
Era
[ByRef] Optional. Variant. The era the year exists in.

Return Values

Long - The number of months in the year.

Remarks

The Gregorian calendar has 12 months in a year.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: GetSecond

GetSecond

Returns the second of the specified time.

 Public Function GetSecond(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the second from.

Return Values

Long - The second portion of the time.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: GetWeekOfYear

GetWeekOfYear

Returns the week of the year that the specified date belongs to.

 Public Function GetWeekOfYear(
      ByRef Time As Variant,
      ByVal Rule As CalendarWeekRule,
      ByVal FirstDayOfWeek As DayOfWeek ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to find the week it belongs.
Rule
[ByVal] CalendarWeekRule. Rule to decide what constitutes the first week of the year.
FirstDayOfWeek
[ByVal] DayOfWeek. Defines which week day is the start of a new week.

Return Values

Long - The week that the date belongs to.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: GetYear

GetYear

Returns the year of the specified time.

 Public Function GetYear(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the year from.

Return Values

Long - The year portion of the time.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: GregorianCalendarTypes

GregorianCalendarTypes

Defines the different language versions of the Gregorian calendar.

 Public Enum GregorianCalendarTypes

Values

Localized = 1
Refers to the localized version of the Gregorian calendar, based on the language of the CultureInfo.
USEnglish = 2
Refers to the U.S. English version of the Gregorian calendar.
MiddleEastFrench = 9
Refers to the Middle East French version of the Gregorian calendar.
Arabic = 10
Refers to the Arabit version of the Gregorian calendar.
TransliteratedEnglish = 11
Refers to the transliterated English version of the Gregorian calendar.
TransliteratedFrench = 12
Refers to the transliterated French version of the Gregorian calendar.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: IsLeapDay

IsLeapDay

Returns a boolean indicating if the specific day is a leap day.

 Public Function IsLeapDay(
      ByVal Year As Long,
      ByVal Month As Long,
      ByVal Day As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year the day is in.
Month
[ByVal] Long. The month the day is in.
Day
[ByVal] Long. The day to check if is a leap day.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the day is a leap day.

Remarks

A leap day only exists in a leap year, such as February 29th in the Gregorian calendar.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: IsLeapMonth

IsLeapMonth

Returns a boolean indicating if the specific month is a leap month.

 Public Function IsLeapMonth(
      ByVal Year As Long,
      ByVal Month As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year the month is in.
Month
[ByVal] Long. The month to check if it is a leap month.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the month is a leap month.

Remarks

A leap month only exists in a leap year, such as Adar II in the Hebrew calendar. This always returns False.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: IsLeapYear

IsLeapYear

Returns a boolean indicating if the specific year is a leap year.

 Public Function IsLeapYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year to check if is a leap year.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the year is a leap year.

Remarks

A leap year in the Gregorian calendar occurs when the year is evenly divisible by 4, but not by 100, unless it is divisible by 400.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: IsReadOnly (get)

IsReadOnly

Gets a value indicating whether this GregorianCalendar object is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - True if this GregorianCalendar object is read-only; otherwise, False.

Read Only.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: MaxSupportedDateTime (get)

MaxSupportedDateTime

Gets the latest date and time supported by the GregorianCalendar object.

 Public Property Get MaxSupportedDateTime ( ) As CorDateTime

Return Values

CorDateTime - The latest date and time supported by the GregordianCalendar which is CorDateTime.MaxValue.

Read Only.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: MinSupportedDateTime (get)

MinSupportedDateTime

Gets the earliest date and time supported by the GregorianCalendar object.

 Public Property Get MinSupportedDateTime ( ) As CorDateTime

Return Values

CorDateTime - The earliest date and time supported by the GregordianCalendar which is CorDateTime.MinValue.

Read Only.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: ToDateTime

ToDateTime

Returns a Gregorian CorDateTime computed using the specific calendar rules.

 Public Function ToDateTime(
      ByVal Year As Long,
      ByVal Month As Long,
      ByVal Day As Long,
      ByVal Hour As Long,
      ByVal Minute As Long,
      ByVal Second As Long,
      ByVal Millisecond As Long,
      Optional ByRef Era As Variant ) As CorDateTime

Parameters

Year
[ByVal] Long. The Year in the specific calendar type.
Month
[ByVal] Long. The Month in the specific calendar type.
Day
[ByVal] Long. The Day in the specific calendar type.
Hour
[ByVal] Long. The hour for the new time.
Minute
[ByVal] Long. The minute for the new time.
Second
[ByVal] Long. The second for the new time.
Millisecond
[ByVal] Long. The milliseconds for the new time.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

CorDateTime - A Gregorian version of the date specified.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: ToFourDigitYear

ToFourDigitYear

Returns a 4-digit year from a 2-digit number.

 Public Function ToFourDigitYear(
      ByVal Year As Long ) As Long

Parameters

Year
[ByVal] Long. The year to be converted to 4-digits.

Return Values

Long - A 4-digit year in the specific calendar.

Remarks

A normal way of dealing with years is by refering to them as a 2-digit value. This is evident in the Gregorian calendar system. The year 2005 may be referenced as 05 (pronounced oh-five). When converting a 2-digit year to a 4-digit the century is unknown. 05 could be 2005 or 1905. This property gives the calendar a rule to follow when converting 2-digit years to 4-digit.

A max year of 2029 will cause a minimum year of 1930. These two years represent 100 years which 2-digit years will fall. 00-99 will fall within 1930-2029.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: TwoDigitYearMax (get)

TwoDigitYearMax

Returns the maximum year to be created from a 2-digit year.

 Public Property Get TwoDigitYearMax ( ) As Long

Return Values

Long - The maximum year to be created.

Remarks

The property allows a 2-digit year (0 to 99) to be converted to a 4-digit year(0001 to 9999). The 2-digit year of 99 does not necessarily corrispond to the largest year to be created. For example, for a maximum year of 2029, the value 99 would convert to 1999 and 0 would convert to 2000. The years 29 would become 2029 and 30 would become 1930.

Read/Write.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendar: TwoDigitYearMax (let)

TwoDigitYearMax

Sets the maximum year to be created from a 2-digit year.

 Public Property Let TwoDigitYearMax(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new 4-digit year maximum a 2-digit year is converted to.

Remarks

The property allows a 2-digit year (0 to 99) to be converted to a 4-digit year(0001 to 9999). The 2-digit year of 99 does not necessarily corrispond to the largest year to be created. For example, for a maximum year of 2029, the value 99 would convert to 1999 and 0 would convert to 2000. The years 29 would become 2029 and 30 would become 1930.

Read/Write.

See Also

Project CorLib Overview

Class GregorianCalendar Overview


GregorianCalendarStatic

GregorianCalendarStatic

Provides static methods for the GregorianCalendar class.

Public:

Properties:

Name | Description
ADEra (get) | Returns the current era of the GregorianCalendar.

See Also

Project CorLib Overview

Class GregorianCalendarStatic Overview

GregorianCalendar


GregorianCalendarStatic: ADEra (get)

ADEra

Returns the current era of the GregorianCalendar.

 Public Property Get ADEra ( ) As Long

Return Values

Long - Returns a constant of 1.

Read Only.

See Also

Project CorLib Overview

Class GregorianCalendarStatic Overview


Guid

Guid

Represents a globally unique identifier (GUID).

Implements:

IComparable
IFormattable
IObject

Public:

Properties:

Name | Description
Handle (get) | Returns a pointer to the internal GUID structure.
IsReadOnly (get) | Returns if the guid is read-only.

Methods:

Name | Description
CompareTo | Compares this guid to another.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
ToByteArray | Returns the guid value has an array of bytes.
ToString | Returns a string representation of guid value.

Remarks

A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever a unique identifier is required. Such an identifier has a very low probability of being duplicated.

A new Guid can be created using the NewGuid method or one of the factory methods in GuidStatic.
Note
The VBCorLib Guid conflicts with a hidden type in Visual Basic. In order to specify the VBCorLib version of Guid, a variable can be defined as CorLib.Guid instead of just Guid. Alternatively, moving the reference priority for the VBCorLib library above OLE Automation will give CorLib.Guid priority when a variable is declared.

Examples

The code parses a guid string then displays the guid in various formats.

Private Sub Main()
    Dim g As Guid

    Set g = Guid.Parse("{533217B3-CDEC-40A2-B01C-1EA8593B850F}")

    Debug.Print "Display guid with various formats."

    Debug.Print " D = " & g.ToString("D")
    Debug.Print " B = " & g.ToString("B")
    Debug.Print " P = " & g.ToString("P")
    Debug.Print " N = " & g.ToString("N")
    Debug.Print " X = " & g.ToString("X")
End Sub

' This code produces the following output.
'
'    Display guid with various formats.
'     D = 533217b3-cdec-40a2-b01c-1ea8593b850f
'     B = {533217b3-cdec-40a2-b01c-1ea8593b850f}
'     P = (533217b3-cdec-40a2-b01c-1ea8593b850f)
'     N = 533217b3cdec40a2b01c1ea8593b850f
'     X = {0x533217b3,0xcdec,0x40a2,{0xb0,0x1c,0x1e,0xa8,0x59,0x3b,0x85,0x0f}}

See Also

Project CorLib Overview

Class Guid Overview

GuidStatic

Constructors


Guid: CompareTo

CompareTo

Compares this guid to another.

 Public Function CompareTo(
      ByRef Value As Variant ) As Long

Parameters

Value
[ByRef] Variant. The guid to compare to this guid.

Return Values

Long - A Long

See Also

Project CorLib Overview

Class Guid Overview


Guid: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class Guid Overview


Guid: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class Guid Overview


Guid: Handle (get)

Handle

Returns a pointer to the internal GUID structure.

 Public Property Get Handle ( ) As Long

Return Values

Long - A long containing the pointer to the structure.

Remarks

This is provided to allow for APIs to access the actual guid structure directly, since they expect to be accessing a structure, not an object.

Guid style APIs declare the guid parameter something like

ByRef g As VBGUID
In order to use the VBCorLib Guid then the API would need to be declared something like
ByVal ptrG As Long
and pass in the Handle to the guid object.

Read Only.

See Also

Project CorLib Overview

Class Guid Overview


Guid: IComparable

IComparable

 Implements IComparable

Return Values

IComparable -

See Also

Project CorLib Overview

Class Guid Overview


Guid: IFormattable

IFormattable

 Implements IFormattable

Return Values

IFormattable -

See Also

Project CorLib Overview

Class Guid Overview


Guid: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class Guid Overview


Guid: IsReadOnly (get)

IsReadOnly

Returns if the guid is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - Returns True if the guid is locked, otherwise False.

Read Only.

See Also

Project CorLib Overview

Class Guid Overview


Guid: ToByteArray

ToByteArray

Returns the guid value has an array of bytes.

 Public Function ToByteArray ( ) As Byte ( )

Return Values

Byte() - An array of bytes representing the guid.

See Also

Project CorLib Overview

Class Guid Overview


Guid: ToString

ToString

Returns a string representation of guid value.

 Public Function ToString(
      Optional ByRef Format As String,
      Optional ByVal Provider As IFormatProvider ) As String

Parameters

Format
[ByRef] Optional. String. The format of the guid value to be returned.
Provider
[ByVal] Optional. IFormatProvider. A format provider used to format the guid.

Return Values

String - String representing of the guid.

Remarks

There are 5 format types: "D","B","N","P","X".

 "D" = 00000000-0000-0000-0000-000000000000
 "B" = {00000000-0000-0000-0000-000000000000}
 "P" = (00000000-0000-0000-0000-000000000000)
 "N" = 00000000000000000000000000000000
 "X" = {0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
D is the default format.

See Also

Project CorLib Overview

Class Guid Overview


GuidStatic

GuidStatic

Provides static methods used to create and manipulate Guid objects.

Public:

Properties:

Name | Description
EmptyGuid (get) | Returns a guid that is guaranteed to be all zeros.
IDispatchGuid (get) | A constant Guid representing the IDispatch interface UUID.
IUnknownGuid (get) | A constant Guid representing the IUnknown interface UUID.

Methods:

Name | Description
FromParts | Creates a guid using specified values and byte array.
FromValues | Creates a new guid from the individual values and bytes.
NewGuid | Initializes a new instance of the Guid object.
Parse | Converts the string representation of a GUID to the equivalent Guid object.
ParseExact | Converts the string representation of a GUID to the equivalent Guid object.
ReadOnly | Returns a Read-Only wrapper for the supplied Guid object.
TryParse | Converts the string representation of a GUID to the equivalent Guid object.
TryParseExact | Converts the string representation of a GUID to the equivalent Guid object, provided that the string is in the specified format.

Remarks

A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever a unique identifier is required. Such an identifier has a very low probability of being duplicated.
Note
The VBCorLib Guid conflicts with a hidden type in Visual Basic. In order to specific the VBCorLib version of Guid, a variable can be defined as CorLib.Guid instead of just Guid. Alternatively, moving the reference priority for the VBCorLib library above OLE Automation will give CorLib.Guid priority when a variable is declared.

Examples

The code parses a guid string then displays the guid in various formats.

Private Sub Main()
    Dim g As Guid

    Set g = Guid.Parse("{533217B3-CDEC-40A2-B01C-1EA8593B850F}")

    Debug.Print "Display guid with various formats."

    Debug.Print " D = " & g.ToString("D")
    Debug.Print " B = " & g.ToString("B")
    Debug.Print " P = " & g.ToString("P")
    Debug.Print " N = " & g.ToString("N")
    Debug.Print " X = " & g.ToString("X")
End Sub

' This code produces the following output.
'
'    Display guid with various formats.
'     D = 533217b3-cdec-40a2-b01c-1ea8593b850f
'     B = {533217b3-cdec-40a2-b01c-1ea8593b850f}
'     P = (533217b3-cdec-40a2-b01c-1ea8593b850f)
'     N = 533217b3cdec40a2b01c1ea8593b850f
'     X = {0x533217b3,0xcdec,0x40a2,{0xb0,0x1c,0x1e,0xa8,0x59,0x3b,0x85,0x0f}}

See Also

Project CorLib Overview

Class GuidStatic Overview

Guid


GuidStatic: EmptyGuid (get)

EmptyGuid

Returns a guid that is guaranteed to be all zeros.

 Public Property Get EmptyGuid ( ) As Guid

Return Values

Guid - A zero value guid.

Read Only.

See Also

Project CorLib Overview

Class GuidStatic Overview


GuidStatic: FromParts

FromParts

Creates a guid using specified values and byte array.

 Public Function FromParts(
      ByVal a As Long,
      ByVal b As Integer,
      ByVal c As Integer,
      ByRef d ( ) As Byte ) As Guid

Parameters

a
[ByVal] Long. A value representing 12345678-xxxx-xxxx-xxxx-xxxxxxxxxxxx
b
[ByVal] Integer. A value representing xxxxxxxx-1234-xxxx-xxxx-xxxxxxxxxxxx
c
[ByVal] Integer. A value representing xxxxxxxx-xxxx-1234-xxxx-xxxxxxxxxxxx
d
[ByRef] Byte. An array representing xxxxxxxx-xxxx-xxxx-1234-123456789012

Return Values

Guid - A new guid initialized to the values and byte array specified.

See Also

Project CorLib Overview

Class GuidStatic Overview


GuidStatic: FromValues

FromValues

Creates a new guid from the individual values and bytes.

 Public Function FromValues(
      ByVal a As Long,
      ByVal b As Integer,
      ByVal c As Integer,
      ByVal d As Byte,
      ByVal e As Byte,
      ByVal f As Byte,
      ByVal g As Byte,
      ByVal h As Byte,
      ByVal i As Byte,
      ByVal j As Byte,
      ByVal k As Byte ) As Guid

Parameters

a
[ByVal] Long. A Long
b
[ByVal] Integer. An Integer
c
[ByVal] Integer. An Integer
d
[ByVal] Byte. A Byte
e
[ByVal] Byte. A Byte
f
[ByVal] Byte. A Byte
g
[ByVal] Byte. A Byte
h
[ByVal] Byte. A Byte
i
[ByVal] Byte. A Byte
j
[ByVal] Byte. A Byte
k
[ByVal] Byte. A Byte

Return Values

Guid - A new guid initialized to the values and bytes specified.

See Also

Project CorLib Overview

Class GuidStatic Overview


GuidStatic: IDispatchGuid (get)

IDispatchGuid

A constant Guid representing the IDispatch interface UUID.

 Public Property Get IDispatchGuid ( ) As Guid

Return Values

Guid - The IDispatch interface guid.

Remarks

the IDispatch UUID is {00020400-0000-0000-C000-000000000046}.

Read Only.

See Also

Project CorLib Overview

Class GuidStatic Overview


GuidStatic: IUnknownGuid (get)

IUnknownGuid

A constant Guid representing the IUnknown interface UUID.

 Public Property Get IUnknownGuid ( ) As Guid

Return Values

Guid - The IUnknown interface guid.

Remarks

The IUnknown UUID is {00000000-0000-0000-C000-000000000046}.

Read Only.

See Also

Project CorLib Overview

Class GuidStatic Overview


GuidStatic: NewGuid

NewGuid

Initializes a new instance of the Guid object.

 Public Function NewGuid ( ) As Guid

Return Values

Guid - A new Guid object.

Remarks

This is a convenient static method that you can call to get a new Guid.

The chance that the value of the new Guid will be all zeros or equal to any other Guid is very low. You can determine whether a GUID consists of all zeros by comparing it to Guid.EmptyGuid.

Examples

The following example creates and displays the values of two Guid objects.

Private Sub Main()
    Dim g As Guid

    Set g = Guid.NewGuid

    Debug.Print g.ToString
    Debug.Print Guid.NewGuid.ToString
End Sub

' This code produces the following output.
'
'    c35cb7df-7deb-4959-b40a-e9c67dad4131
'    91cf364c-d276-4068-b47d-d47b52872c83

See Also

Project CorLib Overview

Class GuidStatic Overview

EmptyGuid

Guid


GuidStatic: Parse

Parse

Converts the string representation of a GUID to the equivalent Guid object.

 Public Function Parse(
      ByRef InputString As String ) As Guid

Parameters

InputString
[ByRef] String. The string to convert.

Return Values

Guid - A Guid object of the parsed value.

See Also

Project CorLib Overview

Class GuidStatic Overview


GuidStatic: ParseExact

ParseExact

Converts the string representation of a GUID to the equivalent Guid object.

 Public Function ParseExact(
      ByRef InputString As String,
      ByRef Format As String ) As Guid

Parameters

InputString
[ByRef] String. The string to convert.
Format
[ByRef] String. One of the following specifiers that indicates the exact format to use when interpreting StringInput: "N", "D", "B", "P", or "X".

Return Values

Guid - A Guid object of the parsed value.

See Also

Project CorLib Overview

Class GuidStatic Overview


GuidStatic: ReadOnly

ReadOnly

Returns a Read-Only wrapper for the supplied Guid object.

 Public Function ReadOnly(
      ByVal g As Guid ) As Guid

Parameters

g
[ByVal] Guid. The Guid object to wrap as Read-Only.

Return Values

Guid - A Read-Only Guid object.

Remarks

This is to allow the passing of a Guid object around an application without allowing the guid to be modified through the Handle property, which allows direct access to the guid structure.

See Also

Project CorLib Overview

Class GuidStatic Overview


GuidStatic: TryParse

TryParse

Converts the string representation of a GUID to the equivalent Guid object.

 Public Function TryParse(
      ByRef InputString As String,
      ByRef Result As Guid ) As Boolean

Parameters

InputString
[ByRef] String. The GUID to convert.
Result
[ByRef] Guid. The structure that will contain the parsed value. If the method returns True, Result contains a valid Guid. If the method returns False, result equals Guid.EmptyGuid.

Return Values

Boolean - True if the parse operation was successful; otherwise, False.

See Also

Project CorLib Overview

Class GuidStatic Overview


GuidStatic: TryParseExact

TryParseExact

Converts the string representation of a GUID to the equivalent Guid object, provided that the string is in the specified format.

 Public Function TryParseExact(
      ByRef InputString As String,
      ByRef Format As String,
      ByRef Result As Guid ) As Boolean

Parameters

InputString
[ByRef] String. The GUID to convert.
Format
[ByRef] String. One of the following specifiers that indicates the exact format to use when interpreting StringInput: "N", "D", "B", "P", or "X".
Result
[ByRef] Guid. The structure that will contain the parsed value. If the method returns True, Result contains a valid Guid. If the method returns False, result equals Guid.Empty.

Return Values

Boolean - True if the parse operation was successful; otherwise, False.

See Also

Project CorLib Overview

Class GuidStatic Overview


HashAlgorithm

HashAlgorithm

Represents a common interface implemented by all hashing algorithms.

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if the hash algorithm implementation can be reused once a hash has been computed.
CanTransformMultipleBlocks (get) | Returns if the hash algorithm implementation can processd multiple blocks of data at a time.
Hash (get) | Returns the computed hash after all data has been processed.
HashSize (get) | Returns the size of the hash value in bits.
InputBlockSize (get) | Returns the size of the input block size allowed.
OutputBlockSize (get) | Returns the size of the output block.

Methods:

Name | Description
Clear | Releases any resources being held by the hash algorithm.
ComputeHash | Computes the hash on a source in its entirety.
Equals | Returns if the Value is equal to this object instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
Initialize | Resets a hashing object to begin hashing a new value.
ToString | Returns a string representation of this object instance.
TransformBlock | Continues to compute the hash value for blocks of data.
TransformFinalBlock | Finalizes the hash computation by processing the last block of data.

Remarks

A hash is a fixed-length data that can represent unique variable-length data. The size of the hash determines the ability for different data to have a unique hash value. Since hash values are fixed-length, there are a fixed number of possible hash values, which must represent an infinite number of variable-length data.

Hashes are powerful in that a tiny change in the input data will cause a large change in the computed hash value. This provides the ability to detect when data has been altered.

It is possible for two variable-length data to have the same hash value, but the chances are so remote as to be practically impossible. The larger the hash value, the more impractical is becomes to find a duplicate hash value.

See Also

Project CorLib Overview

Class HashAlgorithm Overview

SHA1CryptoServiceProvider

SHA1Managed

SHA256Managed

SHA384Managed

SHA512Managed

RIPEMD160Managed

MD5CryptoServiceProvider


HashAlgorithm: CanReuseTransform (get)

CanReuseTransform

Returns if the hash algorithm implementation can be reused once a hash has been computed.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - True if the implementation can be reused, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class HashAlgorithm Overview


HashAlgorithm: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if the hash algorithm implementation can processd multiple blocks of data at a time.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - True if multiple blocks of data can be processed at a time, False otherwise.

Remarks

The size of 1 block of data is defined by the InputBlockSize property.

Read Only.

See Also

Project CorLib Overview

Class HashAlgorithm Overview


HashAlgorithm: Clear

Clear

Releases any resources being held by the hash algorithm.

 Public Sub Clear ( )

Remarks

Once this is called, the object is disposed and cannot be reused.

See Also

Project CorLib Overview

Class HashAlgorithm Overview


HashAlgorithm: ComputeHash

ComputeHash

Computes the hash on a source in its entirety.

 Public Function ComputeHash(
      ByRef InputStreamOrBuffer As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( ) :

Parameters

InputStreamOrBuffer
[ByRef] Variant. The source of data compute the hash for. This can be a byte array or object implementing the Stream interface.
Index
[ByRef] Optional. Variant. The starting index in a byte array source. If the source is not a byte array, this argument is ignored.
Count
[ByRef] Optional. Variant. The number of bytes to compute the hash on. If the source is not a byte array, this argument is ignored.

Return Values

Byte() - The hash value computed from the source provided.

Remarks

If the source is a Stream based object, then the stream is read from and the hash continuously computed until the stream no longer returns data.

If data has already been processed using TransformBlock, then that data will be included in the hashing process.

See Also

Project CorLib Overview

Class HashAlgorithm Overview


HashAlgorithm: Equals

Equals

Returns if the Value is equal to this object instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this object instance.

Return Values

Boolean - True if they are considered equal, False otherwise.

See Also

Project CorLib Overview

Class HashAlgorithm Overview


HashAlgorithm: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class HashAlgorithm Overview


HashAlgorithm: Hash (get)

Hash

Returns the computed hash after all data has been processed.

 Public Property Get Hash ( ) As Byte ( ) :

Return Values

Byte() - A byte array containing the computed hash.

Remarks

The size of the array will vary depending on the hash algorithm being performed.

Read Only.

See Also

Project CorLib Overview

Class HashAlgorithm Overview


HashAlgorithm: HashSize (get)

HashSize

Returns the size of the hash value in bits.

 Public Property Get HashSize ( ) As Long

Return Values

Long - The size of the hash value in bits.

Read Only.

See Also

Project CorLib Overview

Class HashAlgorithm Overview


HashAlgorithm: Initialize

Initialize

Resets a hashing object to begin hashing a new value.

 Public Sub Initialize ( )

Remarks

If Clear has been called, then the object cannot be re-initialized.

See Also

Project CorLib Overview

Class HashAlgorithm Overview


HashAlgorithm: InputBlockSize (get)

InputBlockSize

Returns the size of the input block size allowed.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - The number of bytes a single input block is.

Remarks

When calling the TransformBlock method, the InputCount must equal this value. If the hashs CanTransformMultipleBlocks returns True, then the InputCount can be larger than the InputBlockSize, but must be an even multiple of InputBlockSize.

Read Only.

See Also

Project CorLib Overview

Class HashAlgorithm Overview


HashAlgorithm: OutputBlockSize (get)

OutputBlockSize

Returns the size of the output block.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - The size of the output block.

Remarks

When calling the TransformBlock method, the return value will be 0 or a multiple of this value.

Read Only.

See Also

Project CorLib Overview

Class HashAlgorithm Overview


HashAlgorithm: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class HashAlgorithm Overview


HashAlgorithm: TransformBlock

TransformBlock

Continues to compute the hash value for blocks of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The bytes to continue computing the hash from.
InputOffset
[ByVal] Long. The index into the byte array to begin computing from.
InputCount
[ByVal] Long. The number of bytes to be included in the hash computation.
OutputBuffer
[ByRef] Byte. The data after it has been processed. This will be the same as the input data, no changes are made.
OutputOffset
[ByVal] Long. The starting index in the output buffer to place the processed data.

Return Values

Long - The number of bytes that were processed.

Remarks

The OutputBuffer will contain the same plain text data as the input buffer. No transformation of the data is applied. The OutputBuffer array can be a Null array or the same array as the InputBuffer. If the InputBuffer is used as the OutputBuffer and the InputOffset equals the OutputOffset, no data is copied.

Once this method is called, the Hash property cannot be called until the TransformFinalBlock is called, finishing the hash computation.

See Also

Project CorLib Overview

Class HashAlgorithm Overview


HashAlgorithm: TransformFinalBlock

TransformFinalBlock

Finalizes the hash computation by processing the last block of data.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( ) :

Parameters

InputBuffer
[ByRef] Byte. The bytes to finish the hash computation with.
InputOffset
[ByVal] Long. The index into the byte array to begin hash computations.
InputCount
[ByVal] Long. The number of bytes to be included in the final hash computation.

Return Values

Byte() - A copy of the portion of the InputBuffer that was processed.

Remarks

The hash value is not returned by this method. To retrieve the final hash value, call the Hash property.

The Hash property can only be called after this method is called. If the Hash property is called before this method, then an exception is thrown.

If the implementation can be reused (CanReuseTransform) then the implemntation is reset to allow computing of a new hash value.

See Also

Project CorLib Overview

Class HashAlgorithm Overview


HashAlgorithmBase

HashAlgorithmBase

Provides a base implementation for implementing hash algorithms.

Public:

Properties:

Name | Description
Hash (get) | Returns the computed hash.

Methods:

Name | Description
Clear | Releases any resources being held by the hash algorithm.
ComputeHash | Computes the hash on a source in its entirety.
Initialize | Resets the base class to an initial state to begin computing the hash for a new set of values.
TransformBlock | Continues to compute the hash value for blocks of data.
TransformFinalBlock | Finalizes the hash computation by processing the last block of data.

Remarks

The HashAlgorithmBase class provides base functionality for common task when computing a hash value on data within the VBCorLib library. This allows for an easier and more consistent implementation of the hash algorithms.

By implementing the IHashAlgorithm interface, an instance of HashAlgorithmBase will manage standard functions and validation of data. When needed, the base class will call back into the IHashAlgorithm implementation for required data processing.

See Also

Project CorLib Overview

Class HashAlgorithmBase Overview

Constructors


HashAlgorithmBase: Clear

Clear

Releases any resources being held by the hash algorithm.

 Public Sub Clear ( )

Remarks

Once this is called, the object is disposed and cannot be reused.

See Also

Project CorLib Overview

Class HashAlgorithmBase Overview


HashAlgorithmBase: ComputeHash

ComputeHash

Computes the hash on a source in its entirety.

 Public Function ComputeHash(
      ByRef InputStreamOrBuffer As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

InputStreamOrBuffer
[ByRef] Variant. The source of data compute the hash for. This can be a byte array or object implementing the Stream interface.
Index
[ByRef] Optional. Variant. The starting index in a byte array source. If the source is not a byte array, this argument is ignored.
Count
[ByRef] Optional. Variant. The number of bytes to compute the hash on. If the source is not a byte array, this argument is ignored.

Return Values

Byte() - The hash value computed from the source provided.

Remarks

If the source is a Stream based object, then the stream is read from and the hash continuously computed until the stream no longer returns data.

If data has already been processed using TransformBlock, then that data will be included in the hashing process.

See Also

Project CorLib Overview

Class HashAlgorithmBase Overview


HashAlgorithmBase: Hash (get)

Hash

Returns the computed hash.

 Public Property Get Hash ( ) As Byte ( )

Return Values

Byte() - The compute hash value.

Remarks

Calling this property is only valid after the TransformFinalBlock has been called.

Read Only.

See Also

Project CorLib Overview

Class HashAlgorithmBase Overview


HashAlgorithmBase: Initialize

Initialize

Resets the base class to an initial state to begin computing the hash for a new set of values.

 Public Sub Initialize ( )

Remarks

If this method is called by the base class itself, then the IHashAlgorithm.Initialize method will also be called. If this method is called from an external source, then the IHashAlgorithm.Initialize method will not be called. It is expected that the external source to be responsible for calling that method.

See Also

Project CorLib Overview

Class HashAlgorithmBase Overview


HashAlgorithmBase: TransformBlock

TransformBlock

Continues to compute the hash value for blocks of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The bytes to continue computing the hash from.
InputOffset
[ByVal] Long. The index into the byte array to begin computing from.
InputCount
[ByVal] Long. The number of bytes to be included in the hash computation.
OutputBuffer
[ByRef] Byte. The data after it has been processed. This will be the same as the input data, no changes are made.
OutputOffset
[ByVal] Long. The starting index in the output buffer to place the processed data.

Return Values

Long - The number of bytes that were processed.

Remarks

The OutputBuffer will contain the same plain text data as the input buffer. No transformation of the data is applied. The OutputBuffer array can be a Null array or the same array as the InputBuffer. If the InputBuffer is used as the OutputBuffer and the InputOffset equals the OutputOffset, no data is copied.

Once this method is called, the Hash property cannot be called until the TransformFinalBlock is called, finishing the hash computation.

See Also

Project CorLib Overview

Class HashAlgorithmBase Overview


HashAlgorithmBase: TransformFinalBlock

TransformFinalBlock

Finalizes the hash computation by processing the last block of data.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The bytes to finish the hash computation with.
InputOffset
[ByVal] Long. The index into the byte array to begin hash computations.
InputCount
[ByVal] Long. The number of bytes to be included in the final hash computation.

Return Values

Byte() - A copy of the portion of the InputBuffer that was processed.

Remarks

The hash value is not returned by this method. To retrieve the final hash value, call the Hash property.

The Hash property can only be called after this method is called. If the Hash property is called before this method, then an exception is thrown.

If the implementation can be reused (CanReuseTransform) then the implementation is reset to allow computing of a new hash value.

See Also

Project CorLib Overview

Class HashAlgorithmBase Overview


Hashtable

Hashtable

Represents a collection of key/value pairs that are organized based on the hash code of the key.

Implements:

ICloneable
ICollection
IDictionary
IEnumerable
IObject
IVersionable

Public:

Properties:

Name | Description
Count (get) | Gets the number of key/value pairs contained in the Hashtable.
IsFixedSize (get) | Gets a value indicating whether the Hashtable has a fixed size.
IsReadOnly (get) | Gets a value indicating whether the Hashtable is read-only.
Item (get) | Gets the value associated with the specified key.
Item (let) | Sets the value associated with the specified key.
Item (set) | Sets the value associated with the specified key.
Keys (get) | Gets an ICollection containing the keys in the Hashtable.
Values (get) | Gets an ICollection containing the values in the Hashtable.

Methods:

Name | Description
Add | Adds an element with the specified key and value into the Hashtable.
Clean | Removes Deleted buckets from the internal array.
Clear | Removes all elements from the Hashtable.
Clone | Creates a shallow copy of the Hashtable.
Contains | Determines whether the Hashtable contains a specific key.
ContainsKey | Determines whether the Hashtable contains a specific key.
ContainsValue | Determines whether the Hashtable contains a specific value.
CopyTo | Copies the Hashtable elements to a one-dimensional Array instance at the specified index.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetEnumerator | Returns an IDictionaryEnumerator that iterates through the Hashtable.
GetHashCode | Returns a pseudo-unique number identifying this instance.
Remove | Removes the element with the specified key from the Hashtable.
ToString | Returns a string representation of this object instance.

Remarks

The Hashtable is a collection that uses the hash code and equality of a key value to identify a specific value stored. Keys can be primitives, strings, objects, and variant sub-types such as Empty and Null.

The default usage of an object as a key is to use the ObjPtr for the hash code and a reference check for equality. This may not be suitable for a specific application. The objects used a key by a Hashtable should implement the IObject interface and provide more appropriate GetHashCode and Equals methods for the specific application.

The load factor of a Hashtable determines the maximum ratio of elements to buckets. Smaller load factors cause faster average lookup times at the cost of increased memory consumption. The default load factor of 1.0 generally provides the best balance between speed and size. A different load factor can also be specified when the Hashtable is created.

As elements are added to a Hashtable, the actual load factor of the Hashtable increases. When the actual load factor reaches the specified load factor, the number of buckets in the Hashtable is automatically increased to the smallest prime number that is larger than twice the current number of Hashtable buckets.

The For Each statement enumerates each element in the collection. Since each element of the Hashtable is a key/value pair, the element type is not the type of the key or the type of the value. Instead, the element type is DictionaryEntry. For example:

    Dim Entry As DictionaryEntry

    For Each Entry In MyHashTable
        ' ...
    Next

Examples

The following example shows how to create, initialize and perform various functions to a Hashtable and how to print out its keys and values.

Public Sub Main()
    ' Create a new hash table.
    Dim OpenWith As New Hashtable

    ' Add some elements to the hash table. There are no
    ' duplicate keys, but some of the values are duplicates.
    OpenWith.Add "txt", "notepad.exe"
    OpenWith.Add "bmp", "paint.exe"
    OpenWith.Add "dib", "paint.exe"
    OpenWith.Add "rtf", "wordpad.exe"

    ' The Add method throws an exception if the new key is
    ' already in the hash table.
    On Error GoTo Catch
    OpenWith.Add "txt", "winword.exe"
    GoTo EndTry
Catch:
    Debug.Print "An element with Key = ""txt"" already exists."
EndTry:

    ' The Item property is the default property, so you
    ' can omit its name when accessing elements.
    Debug.Print CorString.Format("For key = ""rtf"", value = {0}.", OpenWith("rtf"))

    ' The default Item property can be used to change the value
    ' associated with a key.
    OpenWith("rtf") = "winword.exe"
    Debug.Print CorString.Format("For key = ""rtf"", value = {0}.", OpenWith("rtf"))

    ' If a key does not exist, setting the default Item property
    ' for that key adds a new key/value pair.
    OpenWith("doc") = "winword.exe"

    ' ContainsKey can be used to test keys before inserting
    ' them.
    If Not OpenWith.ContainsKey("ht") Then
        OpenWith.Add "ht", "hypertrm.exe"
        Debug.Print CorString.Format("Value added for key = ""ht"": {0}", OpenWith("ht"))
    End If

    ' When you use foreach to enumerate hash table elements,
    ' the elements are retrieved as KeyValuePair objects.
    Dim DE As DictionaryEntry

    Debug.Print

    For Each DE In OpenWith
        Debug.Print CorString.Format("Key = {0}, Value = {1}", DE.Key, DE.Value)
    Next DE

    ' To get the values alone, use the Values property.
    Dim ValueColl As ICollection
    Set ValueColl = OpenWith.Values

    ' The elements of the ValueCollection are strongly typed
    ' with the type that was specified for hash table values.
    Dim Value As Variant

    Debug.Print

    For Each Value In ValueColl
        Debug.Print CorString.Format("Value = {0}", Value)
    Next

    ' To get the keys alone, use the Keys property.
    Dim KeyColl As ICollection
    Set KeyColl = OpenWith.Keys

    ' The elements of the KeyCollection are strongly typed
    ' with the type that was specified for hash table keys.
    Dim Key As Variant

    Debug.Print

    For Each Key In KeyColl
        Debug.Print CorString.Format("Key = {0}", Key)
    Next

    ' Use the Remove method to remove a key/value pair.
    Debug.Print vbLf & "Remove(""doc"")"
    OpenWith.Remove "doc"

    If Not OpenWith.ContainsKey("doc") Then
        Debug.Print "Key ""doc"" is not found."
    End If
End Sub

' This example code produces the following output.
'
'    An element with Key = "txt" already exists.
'    For key = "rtf", value = wordpad.exe.
'    For key = "rtf", value = winword.exe.
'    Value added for key = "ht": hypertrm.exe
'
'    Key = dib, Value = paint.exe
'    Key = ht, Value = hypertrm.exe
'    Key = doc, Value = winword.exe
'    Key = rtf, Value = winword.exe
'    Key = bmp, Value = paint.exe
'    Key = txt, Value = notepad.exe
'
'    Value = Paint.exe
'    Value = hypertrm.exe
'    Value = winword.exe
'    Value = winword.exe
'    Value = Paint.exe
'    Value = notepad.exe
'
'    Key = dib
'    Key = ht
'    Key = doc
'    Key = rtf
'    Key = bmp
'    Key = txt
'
'    Remove ("doc")
'    Key "doc" is not found.

See Also

Project CorLib Overview

Class Hashtable Overview

Constructors

IDictionary

ICollection

IEnumerable

ICloneable

CaseInsensitiveComparer


Hashtable: Add

Add

Adds an element with the specified key and value into the Hashtable.

 Public Sub Add(
      ByRef Key As Variant,
      ByRef Value As Variant )

Parameters

Key
[ByRef] Variant. The key of the element to add.
Value
[ByRef] Variant. The value of the element to add.

Remarks

An object that has no correlation between its state and its hash code value should typically not be used as the key. For example, String values are better than StringBuilder objects for use as keys.

You can also use the Item property to add new elements by setting the value of a key that does not exist in the Hashtable; for example, myCollection("myNonexistentKey") = myValue. However, if the specified key already exists in the Hashtable, setting the Item property overwrites the old value. In contrast, the Add method does not modify existing elements.

If Count is less than the capacity of the Hashtable, this method is an O(1) operation. If the capacity needs to be increased to accommodate the new element, this method becomes an O(n) operation, where n is Count.

Exceptions

Exception | Condition
ArgumentException | An element with the same key already exists in the Hashtable.

Examples

The following example shows how to add elements to the Hashtable.

Public Sub Main()
    ' Creates and initializes a new Hashtable.
    Dim MyHT As New Hashtable
    MyHT.Add "one", "The"
    MyHT.Add "two", "quick"
    MyHT.Add "three", "brown"
    MyHT.Add "four", "fox"

    ' Displays the Hashtable.
    Debug.Print "The Hashtable contains the following:"
    PrintKeysAndValues MyHT
End Sub

Public Sub PrintKeysAndValues(ByVal MyHT As Hashtable)
    Dim de As DictionaryEntry

    Debug.Print t("\t-KEY-\t-VALUE-")

    For Each de In MyHT
        Debug.Print CorString.Format(t("\t{0}:\t{1}"), de.Key, de.Value)
    Next de

    Debug.Print
End Sub

' This example code produces the following output.
'
'    The Hashtable contains the following:
'        -KEY-   -VALUE-
'        one:    The
'        two:    quick
'        four:   fox
'        three:  brown

See Also

Project CorLib Overview

Class Hashtable Overview

Remove

Item


Hashtable: Clean

Clean

Removes Deleted buckets from the internal array.

 Public Sub Clean ( )

Remarks

When many items have been deleted from the table, the buckets that contained the items are marked as Deleted. When many buckets are marked as Deleted, the search routine cannot stop searching the buckets for a duplicate key even if an empty Deleted bucket has been found. So to prevent the unnessecary searching past Deleted buckets, the table should be cleaned to remove the Deleted buckets and only have Empty and Occupied buckets remaining.

This is recommended when a large number of items are deleted.

See Also

Project CorLib Overview

Class Hashtable Overview


Hashtable: Clear

Clear

Removes all elements from the Hashtable.

 Public Sub Clear ( )

Remarks

Count is set to zero, and references to other objects from elements of the collection are also released. The capacity remains unchanged.

Examples

The following example shows how to clear the values of the Hashtable.

Public Sub Main()
    ' Creates and initializes a new Hashtable.
    Dim myHT As New Hashtable
    myHT.Add "one", "The"
    myHT.Add "two", "quick"
    myHT.Add "three", "brown"
    myHT.Add "four", "fox"
    myHT.Add "five", "jumped"

    ' Displays the count and values of the Hashtable.
    Debug.Print "Initially,"
    Debug.Print CorString.Format("   Count    : {0}", myHT.Count)
    Debug.Print "   Values:"
    PrintKeysAndValues myHT

    ' Clears the Hashtable.
    myHT.Clear

    ' Displays the count and values of the Hashtable.
    Debug.Print "After Clear,"
    Debug.Print CorString.Format("   Count    : {0}", myHT.Count)
    Debug.Print "   Values:"
    PrintKeysAndValues myHT
End Sub

Public Sub PrintKeysAndValues(ByVal myHT As Hashtable)
    Dim de As DictionaryEntry

    Debug.Print t("\t-KEY-\t-VALUE-")

    For Each de In myHT
        Debug.Print CorString.Format(t("\t{0}:\t{1}"), de.Key, de.Value)
    Next

    Debug.Print
End Sub

' This example code produces the following output.
'
' Initially,
'    Count    : 5
' Values:
'     -KEY-   -VALUE-
' one:            The
' two:            quick
' four:           fox
' five:           jumped
' three:          brown
'
' After Clear,
'    Count    : 0
' Values:
'     -KEY-   -VALUE-

See Also

Project CorLib Overview

Class Hashtable Overview


Hashtable: Clone

Clone

Creates a shallow copy of the Hashtable.

 Public Function Clone ( ) As Hashtable

Return Values

Hashtable - A shallow copy of the Hashtable.

Remarks

A shallow copy of a collection copies only the elements of the collection, whether they are reference types or value types, but it does not copy the objects that the references refer to. The references in the new collection point to the same objects that the references in the original collection point to.

In contrast, a deep copy of a collection copies the elements and everything directly or indirectly referenced by the elements.

The Hashtable clone has the same count, the same capacity, the same IEqualityComparer implementation, and the same IComparer implementation as the original Hashtable.

This method is an O(n) operation, where n is Count.

See Also

Project CorLib Overview

Class Hashtable Overview

CopyTo


Hashtable: Contains

Contains

Determines whether the Hashtable contains a specific key.

 Public Function Contains(
      ByRef Key As Variant ) As Boolean

Parameters

Key
[ByRef] Variant. The key to locate in the Hashtable.

Return Values

Boolean - True if the Hashtable contains an element with the specified key; otherwise, False.

Remarks

This method behaves exactly as ContainsKey.

This method is an O(1) operation.

Examples

The following example shows how to determine whether the Hashtable contains a specific element.

Public Sub Main()
    ' Creates and initializes a new Hashtable.
    Dim MyHT As New Hashtable
    MyHT.Add 0, "zero"
    MyHT.Add 1, "one"
    MyHT.Add 2, "two"
    MyHT.Add 3, "three"
    MyHT.Add 4, "four"

    ' Displays the values of the Hashtable.
    Debug.Print "The Hashtable contains the following values:"
    PrintIndexAndKeysAndValues MyHT

    ' Searches for a specific key.
    Dim myKey As Integer
    myKey = 2
    Debug.Print CorString.Format("The key ""{0}"" is ", myKey);
    If MyHT.ContainsKey(myKey) Then
       Debug.Print "in the Hashtable."
    Else
       Debug.Print "NOT in the Hashtable."
    End If

    myKey = 6
    Debug.Print CorString.Format("The key ""{0}"" is ", myKey);
    If MyHT.ContainsKey(myKey) Then
       Debug.Print " in the Hashtable."
    Else
       Debug.Print " NOT in the Hashtable."
    End If

    ' Searches for a specific value.
    Dim MyValue As String
    MyValue = "three"

    Debug.Print CorString.Format("The value ""{0}"" is ", MyValue);
    If MyHT.ContainsValue(MyValue) Then
       Debug.Print " in the Hashtable."
    Else
       Debug.Print " NOT in the Hashtable."
    End If

    MyValue = "nine"
    Debug.Print CorString.Format("The value ""{0}"" is ", MyValue);
    If MyHT.ContainsValue(MyValue) Then
       Debug.Print " in the Hashtable."
    Else
       Debug.Print " NOT in the Hashtable."
    End If
End Sub

Public Sub PrintIndexAndKeysAndValues(ByVal MyHT As Hashtable)
    Dim de As DictionaryEntry
    Dim i As Long

    Debug.Print t("\t-INDEX-\t-KEY-\t-VALUE-")

    For Each de In MyHT
        Debug.Print CorString.Format(t("\t[{0}]:\t{1}\t{2}"), i, de.Key, de.Value)
        i = i + 1
    Next

    Debug.Print
End Sub

' This example code produces the following output.
'
'    The Hashtable contains the following values:
'        -INDEX- -KEY-   -VALUE-
'        [0]:    0   zero
'        [1]:    1   one
'        [2]:    2   two
'        [3]:    3   three
'        [4]:    4   four
'
'    The key "2" is in the Hashtable.
'    The key "6" is  NOT in the Hashtable.
'    The value "three" is  in the Hashtable.
'    The value "nine" is  NOT in the Hashtable.

See Also

Project CorLib Overview

Class Hashtable Overview

ContainsKey


Hashtable: ContainsKey

ContainsKey

Determines whether the Hashtable contains a specific key.

 Public Function ContainsKey(
      ByRef Key As Variant ) As Boolean

Parameters

Key
[ByRef] Variant. The key to locate in the Hashtable.

Return Values

Boolean - True if the Hashtable contains an element with the specified key; otherwise, False.

Remarks

This method behaves exactly as Contains.

This method is an O(1) operation.

Examples

The following example shows how to determine whether the Hashtable contains a specific element.

Public Sub Main()
    ' Creates and initializes a new Hashtable.
    Dim MyHT As New Hashtable
    MyHT.Add 0, "zero"
    MyHT.Add 1, "one"
    MyHT.Add 2, "two"
    MyHT.Add 3, "three"
    MyHT.Add 4, "four"

    ' Displays the values of the Hashtable.
    Debug.Print "The Hashtable contains the following values:"
    PrintIndexAndKeysAndValues MyHT

    ' Searches for a specific key.
    Dim myKey As Integer
    myKey = 2
    Debug.Print CorString.Format("The key ""{0}"" is ", myKey);
    If MyHT.ContainsKey(myKey) Then
       Debug.Print "in the Hashtable."
    Else
       Debug.Print "NOT in the Hashtable."
    End If

    myKey = 6
    Debug.Print CorString.Format("The key ""{0}"" is ", myKey);
    If MyHT.ContainsKey(myKey) Then
       Debug.Print " in the Hashtable."
    Else
       Debug.Print " NOT in the Hashtable."
    End If

    ' Searches for a specific value.
    Dim MyValue As String
    MyValue = "three"

    Debug.Print CorString.Format("The value ""{0}"" is ", MyValue);
    If MyHT.ContainsValue(MyValue) Then
       Debug.Print " in the Hashtable."
    Else
       Debug.Print " NOT in the Hashtable."
    End If

    MyValue = "nine"
    Debug.Print CorString.Format("The value ""{0}"" is ", MyValue);
    If MyHT.ContainsValue(MyValue) Then
       Debug.Print " in the Hashtable."
    Else
       Debug.Print " NOT in the Hashtable."
    End If
End Sub

Public Sub PrintIndexAndKeysAndValues(ByVal MyHT As Hashtable)
    Dim de As DictionaryEntry
    Dim i As Long

    Debug.Print t("\t-INDEX-\t-KEY-\t-VALUE-")

    For Each de In MyHT
        Debug.Print CorString.Format(t("\t[{0}]:\t{1}\t{2}"), i, de.Key, de.Value)
        i = i + 1
    Next

    Debug.Print
End Sub

' This example code produces the following output.
'
'    The Hashtable contains the following values:
'        -INDEX- -KEY-   -VALUE-
'        [0]:    0   zero
'        [1]:    1   one
'        [2]:    2   two
'        [3]:    3   three
'        [4]:    4   four
'
'    The key "2" is in the Hashtable.
'    The key "6" is  NOT in the Hashtable.
'    The value "three" is  in the Hashtable.
'    The value "nine" is  NOT in the Hashtable.

See Also

Project CorLib Overview

Class Hashtable Overview

Contains

ContainsValue


Hashtable: ContainsValue

ContainsValue

Determines whether the Hashtable contains a specific value.

 Public Function ContainsValue(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to locate in the Hashtable.

Return Values

Boolean - True if the Hashtable contains an element with the specified value; otherwise, False.

Remarks

The values of the elements of the Hashtable are compared to the specified value using the Object.Equals method.

This method performs a linear search; therefore, this method is an O(n) operation, where n is Count.

Examples

The following example shows how to determine whether the Hashtable contains a specific element.

Public Sub Main()
    ' Creates and initializes a new Hashtable.
    Dim MyHT As New Hashtable
    MyHT.Add 0, "zero"
    MyHT.Add 1, "one"
    MyHT.Add 2, "two"
    MyHT.Add 3, "three"
    MyHT.Add 4, "four"

    ' Displays the values of the Hashtable.
    Debug.Print "The Hashtable contains the following values:"
    PrintIndexAndKeysAndValues MyHT

    ' Searches for a specific key.
    Dim myKey As Integer
    myKey = 2
    Debug.Print CorString.Format("The key ""{0}"" is ", myKey);
    If MyHT.ContainsKey(myKey) Then
       Debug.Print "in the Hashtable."
    Else
       Debug.Print "NOT in the Hashtable."
    End If

    myKey = 6
    Debug.Print CorString.Format("The key ""{0}"" is ", myKey);
    If MyHT.ContainsKey(myKey) Then
       Debug.Print " in the Hashtable."
    Else
       Debug.Print " NOT in the Hashtable."
    End If

    ' Searches for a specific value.
    Dim MyValue As String
    MyValue = "three"

    Debug.Print CorString.Format("The value ""{0}"" is ", MyValue);
    If MyHT.ContainsValue(MyValue) Then
       Debug.Print " in the Hashtable."
    Else
       Debug.Print " NOT in the Hashtable."
    End If

    MyValue = "nine"
    Debug.Print CorString.Format("The value ""{0}"" is ", MyValue);
    If MyHT.ContainsValue(MyValue) Then
       Debug.Print " in the Hashtable."
    Else
       Debug.Print " NOT in the Hashtable."
    End If
End Sub

Public Sub PrintIndexAndKeysAndValues(ByVal MyHT As Hashtable)
    Dim de As DictionaryEntry
    Dim i As Long

    Debug.Print t("\t-INDEX-\t-KEY-\t-VALUE-")

    For Each de In MyHT
        Debug.Print CorString.Format(t("\t[{0}]:\t{1}\t{2}"), i, de.Key, de.Value)
        i = i + 1
    Next

    Debug.Print
End Sub

' This example code produces the following output.
'
'    The Hashtable contains the following values:
'        -INDEX- -KEY-   -VALUE-
'        [0]:    0   zero
'        [1]:    1   one
'        [2]:    2   two
'        [3]:    3   three
'        [4]:    4   four
'
'    The key "2" is in the Hashtable.
'    The key "6" is  NOT in the Hashtable.
'    The value "three" is  in the Hashtable.
'    The value "nine" is  NOT in the Hashtable.

See Also

Project CorLib Overview

Class Hashtable Overview

ContainsKey


Hashtable: CopyTo

CopyTo

Copies the Hashtable elements to a one-dimensional Array instance at the specified index.

 Public Sub CopyTo(
      ByRef Arr As Variant,
      ByVal ArrayIndex As Long )

Parameters

Arr
[ByRef] Variant. The one-dimensional array that is the destination of the DictionaryEntry objects copied from Hashtable. The Array must have zero-based indexing.
ArrayIndex
[ByVal] Long. The lowerbound-based index in Arr at which copying begins.

Remarks

The elements are copied to the array in the same order in which the enumerator iterates through the Hashtable.

To copy only the keys in the Hashtable, use Hashtable.Keys.CopyTo.

To copy only the values in the Hashtable, use Hashtable.Values.CopyTo.

This method is an O(n) operation, where n is Count.

Exceptions

Exception | Condition
ArgumentNullException | Arr is uninitialized.
ArgumentOutOfRangeException | ArrayIndex is less than lowerbound.
ArgumentException | Arr is multidimensional. -or- The number of elements in the source Hashtable is greater than the available space from ArrayIndex to the end of the destination Arr.
InvalidCastException | The type of the source Hashtable cannot be cast automatically to the type of the destination Arr.

Examples

The following example shows how to copy the list of keys or the list of values in a Hashtable into a one-dimensional Array.

Public Sub Main()
    ' Creates and initializes the source Hashtable.
    Dim MySourceHT As New Hashtable
    MySourceHT.Add "A", "valueA"
    MySourceHT.Add "B", "valueB"

    ' Creates and initializes the one-dimensional target Array.
    Dim MyTargetArray(14) As String
    MyTargetArray(0) = "The"
    MyTargetArray(1) = "quick"
    MyTargetArray(2) = "brown"
    MyTargetArray(3) = "fox"
    MyTargetArray(4) = "jumped"
    MyTargetArray(5) = "over"
    MyTargetArray(6) = "the"
    MyTargetArray(7) = "lazy"
    MyTargetArray(8) = "dog"

    ' Displays the values of the target Array.
    Debug.Print "The target Array contains the following before:"
    PrintValues MyTargetArray

    ' Copies the keys in the source Hashtable to the target Hashtable, starting at index 6.
    Debug.Print "After copying the keys, starting at index 6:"
    MySourceHT.Keys.CopyTo MyTargetArray, 6

    ' Displays the values of the target Array.
    PrintValues MyTargetArray

    ' Copies the values in the source Hashtable to the target Hashtable, starting at index 6.
    Debug.Print "After copying the values, starting at index 6:"
    MySourceHT.Values.CopyTo MyTargetArray, 6

    ' Displays the values of the target Array.
    PrintValues MyTargetArray
End Sub

Public Sub PrintValues(ByRef MyArr() As String)
    Dim i As Long

    For i = LBound(MyArr) To UBound(MyArr)
        Debug.Print " " & MyArr(i);
    Next

    Debug.Print
End Sub 'PrintValues

' This example code produces the following output.
'
'    The target Array contains the following before:
'     The quick brown fox jumped over the lazy dog
'    After copying the keys, starting at index 6:
'     The quick brown fox jumped over A B dog
'    After copying the values, starting at index 6:
'     The quick brown fox jumped over valueA valueB dog

See Also

Project CorLib Overview

Class Hashtable Overview

DictionaryEntry


Hashtable: Count (get)

Count

Gets the number of key/value pairs contained in the Hashtable.

 Public Property Get Count ( ) As Long

Return Values

Long - The number of key/value pairs contained in the Hashtable.

Remarks

Retrieving the value of this property is an O(1) operation.

Read Only.

See Also

Project CorLib Overview

Class Hashtable Overview


Hashtable: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class Hashtable Overview


Hashtable: GetEnumerator

GetEnumerator

Returns an IDictionaryEnumerator that iterates through the Hashtable.

 Public Function GetEnumerator ( ) As Object

Return Values

Object - An IDictionaryEnumerator for the Hashtable.

Remarks

The elements enumerated are DictionaryEntry objects each containing a key/value pair.

See Also

Project CorLib Overview

Class Hashtable Overview


Hashtable: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class Hashtable Overview


Hashtable: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class Hashtable Overview


Hashtable: ICollection

ICollection

 Implements ICollection

Return Values

ICollection -

See Also

Project CorLib Overview

Class Hashtable Overview


Hashtable: IDictionary

IDictionary

 Implements IDictionary

Return Values

IDictionary -

See Also

Project CorLib Overview

Class Hashtable Overview


Hashtable: IEnumerable

IEnumerable

 Implements IEnumerable

Return Values

IEnumerable -

See Also

Project CorLib Overview

Class Hashtable Overview


Hashtable: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class Hashtable Overview


Hashtable: IsFixedSize (get)

IsFixedSize

Gets a value indicating whether the Hashtable has a fixed size.

 Public Property Get IsFixedSize ( ) As Boolean

Return Values

Boolean - True if the Hashtable is read-only; otherwise, False. The default is False.

Remarks

This implements the IList.IsFixedSize.

Read Only.

See Also

Project CorLib Overview

Class Hashtable Overview


Hashtable: IsReadOnly (get)

IsReadOnly

Gets a value indicating whether the Hashtable is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - True if the Hashtable is read-only; otherwise, False. The default is False.

Remarks

This implements the IList.IsReadOnly.

Read Only.

See Also

Project CorLib Overview

Class Hashtable Overview


Hashtable: Item (get)

Item

Gets the value associated with the specified key.

 Public Property Get Item(
      ByRef Key As Variant ) As Variant

Parameters

Key
[ByRef] Variant. The key whose value to get.

Return Values

Variant - The value associated with the specified key. If the specified key is not found, attempting to get it returns Empty, and attempting to set it creates a new element using the specified key.

Remarks

This property provides the ability to access a specific element in the collection by using the following syntax: myCollection(key).

You can also use the Item property to add new elements by setting the value of a key that does not exist in the Hashtable; for example, myCollection("myNonexistentKey") = myValue. However, if the specified key already exists in the Hashtable, setting the Item property overwrites the old value. In contrast, the Add method does not modify existing elements.

To distinguish between Empty that is returned because the specified key is not found and Empty that is returned because the value of the specified key is Empty, use the Contains method or the ContainsKey method to determine if the key exists in the list.

Retrieving the value of this property is an O(1) operation; setting the property is also an O(1) operation.

Read/Write.

See Also

Project CorLib Overview

Class Hashtable Overview

Add


Hashtable: Item (let)

Item

Sets the value associated with the specified key.

 Public Property Let Item(
      ByRef Key As Variant,
      ByRef Value As Variant )

Parameters

Key
[ByRef] Variant. The key whose value to get.
Value
[ByRef] Variant. The value associated with the specified key. If the specified key is not found, attempting to get it returns Empty, and attempting to set it creates a new element using the specified key.

Remarks

This property provides the ability to access a specific element in the collection by using the following syntax: myCollection(key).

You can also use the Item property to add new elements by setting the value of a key that does not exist in the Hashtable; for example, myCollection("myNonexistentKey") = myValue. However, if the specified key already exists in the Hashtable, setting the Item property overwrites the old value. In contrast, the Add method does not modify existing elements.

To distinguish between Empty that is returned because the specified key is not found and Empty that is returned because the value of the specified key is Empty, use the Contains method or the ContainsKey method to determine if the key exists in the list.

Retrieving the value of this property is an O(1) operation; setting the property is also an O(1) operation.

Read/Write.

See Also

Project CorLib Overview

Class Hashtable Overview

Add


Hashtable: Item (set)

Item

Sets the value associated with the specified key.

 Public Property Set Item(
      ByRef Key As Variant,
      ByRef Value As Variant )

Parameters

Key
[ByRef] Variant. The key whose value to get.
Value
[ByRef] Variant. The value associated with the specified key. If the specified key is not found, attempting to get it returns Empty, and attempting to set it creates a new element using the specified key.

Remarks

This property provides the ability to access a specific element in the collection by using the following syntax: myCollection(key).

You can also use the Item property to add new elements by setting the value of a key that does not exist in the Hashtable; for example, myCollection("myNonexistentKey") = myValue. However, if the specified key already exists in the Hashtable, setting the Item property overwrites the old value. In contrast, the Add method does not modify existing elements.

To distinguish between Empty that is returned because the specified key is not found and Empty that is returned because the value of the specified key is Empty, use the Contains method or the ContainsKey method to determine if the key exists in the list.

Retrieving the value of this property is an O(1) operation; setting the property is also an O(1) operation.

Read/Write.

See Also

Project CorLib Overview

Class Hashtable Overview

Add


Hashtable: IVersionable

IVersionable

 Implements IVersionable

Return Values

IVersionable -

See Also

Project CorLib Overview

Class Hashtable Overview


Hashtable: Keys (get)

Keys

Gets an ICollection containing the keys in the Hashtable.

 Public Property Get Keys ( ) As ICollection

Return Values

ICollection - An ICollection containing the keys in the Hashtable.

Remarks

The order of the keys in the ICollection is unspecified, but it is the same order as the associated values in the ICollection returned by the Values method.

The returned ICollection is not a static copy; instead, the ICollection refers back to the keys in the original Hashtable. Therefore, changes to the Hashtable continue to be reflected in the ICollection.

Read Only.

See Also

Project CorLib Overview

Class Hashtable Overview

Values


Hashtable: Remove

Remove

Removes the element with the specified key from the Hashtable.

 Public Sub Remove(
      ByRef Key As Variant )

Parameters

Key
[ByRef] Variant. The key of the element to remove.

Remarks

If the Hashtable does not contain an element with the specified key, the Hashtable remains unchanged. No exception is thrown.

This method is an O(1) operation.

Examples

The following example shows how to remove elements from the Hashtable.

Public Sub Main()
    ' Creates and initializes a new Hashtable.
    Dim MyHT As New Hashtable

    MyHT.Add "1a", "The"
    MyHT.Add "1b", "quick"
    MyHT.Add "1c", "brown"
    MyHT.Add "2a", "fox"
    MyHT.Add "2b", "jumped"
    MyHT.Add "2c", "over"
    MyHT.Add "3a", "the"
    MyHT.Add "3b", "lazy"
    MyHT.Add "3c", "dog"

    ' Displays the Hashtable.
    Debug.Print "The Hashtable initially contains the following:"
    PrintKeysAndValues MyHT

    ' Removes the element with the key "3b".
    MyHT.Remove "3b"

    ' Displays the current state of the Hashtable.
    Debug.Print "After removing ""lazy"":"
    PrintKeysAndValues MyHT
End Sub

Public Sub PrintKeysAndValues(ByVal MyHT As Hashtable)
    Dim de As DictionaryEntry

    For Each de In MyHT
        Debug.Print CorString.Format(t("\t{0}:\t{1}"), de.Key, de.Value)
    Next de

    Debug.Print
End Sub

' This example code produces the following output.
'
'   The Hashtable initially contains the following:
'       2a: fox
'       2b: jumped
'       2c: over
'       3a: the
'       3b: lazy
'       3c: dog
'       1a: The
'       1b: quick
'       1c: brown
'
'   After removing "lazy":
'       2a: fox
'       2b: jumped
'       2c: over
'       3a: the
'       3c: dog
'       1a: The
'       1b: quick
'       1c: brown

See Also

Project CorLib Overview

Class Hashtable Overview

Add


Hashtable: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class Hashtable Overview


Hashtable: Values (get)

Values

Gets an ICollection containing the values in the Hashtable.

 Public Property Get Values ( ) As ICollection

Return Values

ICollection - An ICollection containing the values in the Hashtable.

Remarks

The order of the values in the ICollection is unspecified, but it is the same order as the associated keys in the ICollection returned by the Keys method.

The returned ICollection is not a static copy; instead, the ICollection refers back to the values in the original Hashtable. Therefore, changes to the Hashtable continue to be reflected in the ICollection.

Read Only.

See Also

Project CorLib Overview

Class Hashtable Overview

Keys


HebrewCalendar

HebrewCalendar

Provides methods for manipulating Hebrew (Jewish) dates.

Implements:

Calendar
ICloneable
IObject

Public:

Properties:

Name | Description
AlgorithmType (get) | Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.
Eras (get) | Gets the list of eras in the HebrewCalendar.
IsReadOnly (get) | Gets a value indicating whether this HebrewCalendar object is read-only.
MaxSupportedDateTime (get) | Gets the latest date and time supported by the HebrewCalendar object.
MinSupportedDateTime (get) | Gets the earliest date and time supported by the HebrewCalendar object.
TwoDigitYearMax (get) | Gets the last year of a 100-year range that can be represented by a 2-digit year.
TwoDigitYearMax (let) | Sets the last year of a 100-year range that can be represented by a 2-digit year.

Methods:

Name | Description
AddDays | Returns a CorDateTime that is the specified number of days away from the specified CorDateTime.
AddHours | Returns a CorDateTime this is the specified number of hours from the original Time.
AddMilliseconds | Returns a CorDateTime this is the specified number of Milliseconds from the original Time.
AddMinutes | Returns a CorDateTime this is the specified number of Minutes from the original Time.
AddMonths | Returns a CorDateTime this is the specified number of Months from the original Time.
AddSeconds | Returns a CorDateTime this is the specified number of Seconds from the original Time.
AddWeeks | Returns a CorDateTime this is the specified number of Weeks from the original Time.
AddYears | Returns a CorDateTime this is the specified number of Years from the original Time.
Clone | Creates a new object that is a copy of the current HebrewCalendar object.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetDayOfMonth | Returns the day of the months for the specified date.
GetDayOfWeek | Returns the DayOfWeek enum of the specified date.
GetDayOfYear | Returns the day of the year for the specified date.
GetDaysInMonth | Returns the number of days in the specified month.
GetDaysInYear | Returns the number of days in the specified year.
GetEra | Returns the era in the specified Date or CorDateTime.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetHour | Returns the hour of the specified time.
GetLeapMonth | Calculates the leap month for a specified year and era.
GetMilliseconds | Returns the milliseconds of the specified time.
GetMinute | Returns the minute of the specified time.
GetMonth | Returns the month of the specified time.
GetMonthsInYear | Returns the number of months in the specified year.
GetSecond | Returns the second of the specified time.
GetWeekOfYear | Returns the week of the year that the specified date belongs to.
GetYear | Returns the year of the specified time.
IsLeapDay | Returns a boolean indicating if the specific day is a leap day.
IsLeapMonth | Returns a boolean indicating if the specific month is a leap month.
IsLeapYear | Returns a boolean indicating if the specific year is a leap year.
ToDateTime | Returns a Gregorian CorDateTime computed using the specific calendar rules.
ToFourDigitYear | Converts the specified year to a four-digit year by using the TwoDigitYearMax property to determine the appropriate century.
ToString | Returns a string representation of this object instance.

See Also

Project CorLib Overview

Class HebrewCalendar Overview

HebrewCalendarStatic

Calendar


HebrewCalendar: AddDays

AddDays

Returns a CorDateTime that is the specified number of days away from the specified CorDateTime.

 Public Function AddDays(
      ByRef Time As Variant,
      ByVal Days As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to add days to.
Days
[ByVal] Long. The number of days to add.

Return Values

CorDateTime - The CorDateTime that results from adding the specified number of days to the specified CorDateTime.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: AddHours

AddHours

Returns a CorDateTime this is the specified number of hours from the original Time.

 Public Function AddHours(
      ByRef Time As Variant,
      ByVal Hours As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of hours to.
Hours
[ByVal] Long. The number of hours to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of hours added.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: AddMilliseconds

AddMilliseconds

Returns a CorDateTime this is the specified number of Milliseconds from the original Time.

 Public Function AddMilliseconds(
      ByRef Time As Variant,
      ByVal Milliseconds As Double ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Milliseconds to.
Milliseconds
[ByVal] Double. The number of Milliseconds to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Milliseconds added.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: AddMinutes

AddMinutes

Returns a CorDateTime this is the specified number of Minutes from the original Time.

 Public Function AddMinutes(
      ByRef Time As Variant,
      ByVal Minutes As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Minutes to.
Minutes
[ByVal] Long. The number of Minutes to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Minutes added.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: AddMonths

AddMonths

Returns a CorDateTime this is the specified number of Months from the original Time.

 Public Function AddMonths(
      ByRef Time As Variant,
      ByVal Months As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Months to.
Months
[ByVal] Long. The number of Months to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Months added.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: AddSeconds

AddSeconds

Returns a CorDateTime this is the specified number of Seconds from the original Time.

 Public Function AddSeconds(
      ByRef Time As Variant,
      ByVal Seconds As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Seconds to.
Seconds
[ByVal] Long. The number of Seconds to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Seconds added.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: AddWeeks

AddWeeks

Returns a CorDateTime this is the specified number of Weeks from the original Time.

 Public Function AddWeeks(
      ByRef Time As Variant,
      ByVal Weeks As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Weeks to.
Weeks
[ByVal] Long. The number of Weeks to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Weeks added.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: AddYears

AddYears

Returns a CorDateTime this is the specified number of Years from the original Time.

 Public Function AddYears(
      ByRef Time As Variant,
      ByVal Years As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Years to.
Years
[ByVal] Long. The number of Years to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Years added.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: AlgorithmType (get)

AlgorithmType

Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.

 Public Property Get AlgorithmType ( ) As CalendarAlgorithmType

Return Values

CalendarAlgorithmType - Always returns CalendarAlgorithmType.LunisolarCalendar.

Read Only.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: Calendar

Calendar

 Implements Calendar

Return Values

Calendar -

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: Clone

Clone

Creates a new object that is a copy of the current HebrewCalendar object.

 Public Function Clone ( ) As HebrewCalendar

Return Values

HebrewCalendar - A copy of the HebrewCalendar object.

Remarks

The clone will always be a non-readonly version.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: Eras (get)

Eras

Gets the list of eras in the HebrewCalendar.

 Public Property Get Eras ( ) As Long ( )

Return Values

Long() - An array of integers that represents the eras in the HebrewCalendar.

Remarks

The HebrewCalendar class recognizes only the current era. This property always returns an array with only one element.

Read Only.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: GetDayOfMonth

GetDayOfMonth

Returns the day of the months for the specified date.

 Public Function GetDayOfMonth(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The date inwhich to retrieve the day of the month.

Return Values

Long - An integer from 1 to 30 that represents the day of the month in the specified Date or CorDateTime.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: GetDayOfWeek

GetDayOfWeek

Returns the DayOfWeek enum of the specified date.

 Public Function GetDayOfWeek(
      ByRef Time As Variant ) As DayOfWeek

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to read the day of the week from.

Return Values

DayOfWeek - A DayOfWeek enum representing the day of the week.

Remarks

The DayOfWeek is Sunday and is 0-based. The Visual Basic enum vbDayOfWeek is 1-based.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: GetDayOfYear

GetDayOfYear

Returns the day of the year for the specified date.

 Public Function GetDayOfYear(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to read the day of the year from.

Return Values

Long - An integer from 1 to 385 that represents the day of the year in the specified Date or CorDateTime.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: GetDaysInMonth

GetDaysInMonth

Returns the number of days in the specified month.

 Public Function GetDaysInMonth(
      ByVal Year As Long,
      ByVal Month As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year inwhich the month exists. This is used by calendars that have months that change based on the year, such as leap years.
Month
[ByVal] Long. The month to retrieve the number of days of.
Era
[ByRef] Optional. Variant. The time period inwhich the year exists.

Return Values

Long -

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: GetDaysInYear

GetDaysInYear

Returns the number of days in the specified year.

 Public Function GetDaysInYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year to retrieve the number of days of.
Era
[ByRef] Optional. Variant. The era the year exists in.

Return Values

Long - The number of days in the year.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: GetEra

GetEra

Returns the era in the specified Date or CorDateTime.

 Public Function GetEra(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to read.

Return Values

Long - An integer that represents the era in the specified Date or CorDateTime. The return value is always HebrewEra.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: GetHour

GetHour

Returns the hour of the specified time.

 Public Function GetHour(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the hour from.

Return Values

Long - The hour portion of the Time.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: GetLeapMonth

GetLeapMonth

Calculates the leap month for a specified year and era.

 Public Function GetLeapMonth(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. A year.
Era
[ByRef] Optional. Variant. An era.

Return Values

Long - A positive integer that indicates the leap month in the specified year and era. The return value is 7 if the Year and Era parameters specify a leap year, or 0 if the year is not a leap year.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: GetMilliseconds

GetMilliseconds

Returns the milliseconds of the specified time.

 Public Function GetMilliseconds(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the milliseconds from.

Return Values

Long - The millisecond portion of the Time.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: GetMinute

GetMinute

Returns the minute of the specified time.

 Public Function GetMinute(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the minute from.

Return Values

Long - The minute portion of the Time.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: GetMonth

GetMonth

Returns the month of the specified time.

 Public Function GetMonth(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the month from.

Return Values

Long - The month portion of the Time.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: GetMonthsInYear

GetMonthsInYear

Returns the number of months in the specified year.

 Public Function GetMonthsInYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year to get the number of months of.
Era
[ByRef] Optional. Variant. The era the year exists in.

Return Values

Long - The number of months in the year.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: GetSecond

GetSecond

Returns the second of the specified time.

 Public Function GetSecond(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the second from.

Return Values

Long - The second portion of the Time.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: GetWeekOfYear

GetWeekOfYear

Returns the week of the year that the specified date belongs to.

 Public Function GetWeekOfYear(
      ByRef Time As Variant,
      ByVal Rule As CalendarWeekRule,
      ByVal FirstDayOfWeek As DayOfWeek ) As Long

Parameters

Time
[ByRef] Variant. The date to find the week it belongs.
Rule
[ByVal] CalendarWeekRule. Rule to decide what constitutes the first week of the year.
FirstDayOfWeek
[ByVal] DayOfWeek. Defines which week day is the start of a new week.

Return Values

Long - The week that the date belongs to.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: GetYear

GetYear

Returns the year of the specified time.

 Public Function GetYear(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the year from.

Return Values

Long - The year portion of the Time.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: IsLeapDay

IsLeapDay

Returns a boolean indicating if the specific day is a leap day.

 Public Function IsLeapDay(
      ByVal Year As Long,
      ByVal Month As Long,
      ByVal Day As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year the day is in.
Month
[ByVal] Long. The month the day is in.
Day
[ByVal] Long. The day to check if is a leap day.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the day is a leap day.

Remarks

This implementation of the HebrewCalendar class recognizes only the Hebrew years 5343 to 5999 (1583 to 2239 in the Gregorian calendar).

In every 19-year cycle that ends with a year that is evenly divisible by 19, the 3rd, 6th, 8th, 11th, 14th, 17th, and 19th years are leap years. A common year can have from 353 to 355 days, depending on the placement of Jewish holidays. A leap year can have from 383 to 385 days.

A leap day is a day that occurs only in a leap year. In the Hebrew calendar, the last day of Adar Alef and all the days in Adar Beit are considered leap days.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | year, month, or era is outside the range supported by this calendar.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: IsLeapMonth

IsLeapMonth

Returns a boolean indicating if the specific month is a leap month.

 Public Function IsLeapMonth(
      ByVal Year As Long,
      ByVal Month As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year the month is in.
Month
[ByVal] Long. The month to check if it is a leap month.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the month is a leap month.

Remarks

This implementation of the HebrewCalendar class recognizes only the Hebrew years 5343 to 5999 (1583 to 2239 in the Gregorian calendar).

In every 19-year cycle that ends with a year that is evenly divisible by 19, the 3rd, 6th, 8th, 11th, 14th, 17th, and 19th years are leap years. A common year can have from 353 to 355 days, depending on the placement of Jewish holidays. A leap year can have from 383 to 385 days.

A leap month is an entire month that occurs only in a leap year. In the Hebrew calendar, Adar Beit is the only leap month.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | year, month, or era is outside the range supported by this calendar.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: IsLeapYear

IsLeapYear

Returns a boolean indicating if the specific year is a leap year.

 Public Function IsLeapYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year to check if is a leap year.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the year is a leap year.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: IsReadOnly (get)

IsReadOnly

Gets a value indicating whether this HebrewCalendar object is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - True if this HebrewCalendar object is read-only; otherwise, False.

Read Only.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: MaxSupportedDateTime (get)

MaxSupportedDateTime

Gets the latest date and time supported by the HebrewCalendar object.

 Public Property Get MaxSupportedDateTime ( ) As CorDateTime

Return Values

CorDateTime - The latest date and time supported by the HebrewCalendar which is the last moment of September 29, 2239.

Read Only.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: MinSupportedDateTime (get)

MinSupportedDateTime

Gets the earliest date and time supported by the HebrewCalendar object.

 Public Property Get MinSupportedDateTime ( ) As CorDateTime

Return Values

CorDateTime - The earliest date and time supported by the HebrewCalendar which is January 1, 1583.

Read Only.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: ToDateTime

ToDateTime

Returns a Gregorian CorDateTime computed using the specific calendar rules.

 Public Function ToDateTime(
      ByVal Year As Long,
      ByVal Month As Long,
      ByVal Day As Long,
      ByVal Hour As Long,
      ByVal Minute As Long,
      ByVal Second As Long,
      ByVal Millisecond As Long,
      Optional ByRef Era As Variant ) As CorDateTime

Parameters

Year
[ByVal] Long. The Year in the specific calendar type.
Month
[ByVal] Long. The Month in the specific calendar type.
Day
[ByVal] Long. The Day in the specific calendar type.
Hour
[ByVal] Long. The hour for the new time.
Minute
[ByVal] Long. The minute for the new time.
Second
[ByVal] Long. The second for the new time.
Millisecond
[ByVal] Long. The milliseconds for the new time.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

CorDateTime - A Gregorian version of the date specified.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: ToFourDigitYear

ToFourDigitYear

Converts the specified year to a four-digit year by using the TwoDigitYearMax property to determine the appropriate century.

 Public Function ToFourDigitYear(
      ByVal Year As Long ) As Long

Parameters

Year
[ByVal] Long. A two-digit or four-digit integer that represents the year to convert.

Return Values

Long - A 4-digit year in the specific calendar.

Remarks

The ToFourDigitYear method uses the year parameter, the TwoDigitYearMax property, and a year to calculate a 4-digit year. The century is determined by finding the sole occurrence of the year parameter within that 100-year range. For example, if TwoDigitYearMax is set to 5729, the 100-year range is from 5630 to 5729. Therefore, a value of 30 is interpreted as 5630, while a value of 29 is interpreted as 5729.

If the TwoDigitYearMax property has the special value 99, the ToFourDigitYear method ignores the settings in the regional and language options in Control Panel and returns the value of the year parameter unchanged.

ToFourDigitYear supports either a two-digit year or a four-digit year. Passing a two-digit year value (less than 100) causes the method to convert the value to a four-digit value according to the TwoDigitYearMax value representing the appropriate century. If the application supplies a four-digit year value that is within the supported calendar range to ToFourDigitYear, the method returns the actual input value. If the application supplies a four-digit value that is outside the supported calendar range, or if it supplies a negative value, the method throws an exception.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: TwoDigitYearMax (get)

TwoDigitYearMax

Gets the last year of a 100-year range that can be represented by a 2-digit year.

 Public Property Get TwoDigitYearMax ( ) As Long

Return Values

Long - The last year of a 100-year range that can be represented by a 2-digit year.

Remarks

The TwoDigitYearMax property allows a 2-digit year to be properly translated to a 4-digit year. For example, if this property is set to 5729, the 100-year range is from 5630 to 5729. Therefore, a 2-digit value of 30 is interpreted as 5630, while a 2-digit value of 29 is interpreted as 5729. The initial value of this property is derived from the settings in the regional and language options portion of Control Panel. If the initial system setting changes during the life of your application the HebrewCalendar class does not automatically detect the change. The special value 99 causes the ToFourDigitYear method to ignore the system settings and return the specified year unchanged.

Read/Write.

See Also

Project CorLib Overview

Class HebrewCalendar Overview


HebrewCalendar: TwoDigitYearMax (let)

TwoDigitYearMax

Sets the last year of a 100-year range that can be represented by a 2-digit year.

 Public Property Let TwoDigitYearMax(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The last year of a 100-year range.

Remarks

The TwoDigitYearMax property allows a 2-digit year to be properly translated to a 4-digit year. For example, if this property is set to 5729, the 100-year range is from 5630 to 5729. Therefore, a 2-digit value of 30 is interpreted as 5630, while a 2-digit value of 29 is interpreted as 5729. The initial value of this property is derived from the settings in the regional and language options portion of Control Panel. If the initial system setting changes during the life of your application the HebrewCalendar class does not automatically detect the change. The special value 99 causes the ToFourDigitYear method to ignore the system settings and return the specified year unchanged.

Exceptions

Read/Write.

See Also

Project CorLib Overview

Class HebrewCalendar Overview

Build on Sunday, October 11, 2020 by VBDOX
Exception | Condition
InvalidOperationException | This calendar is read-only.
ArgumentOutOfRangeException | In a set operation, the Hebrew calendar year value is less than 5343 but is not 99, or the year value is greater than 5999.


HebrewCalendarStatic

HebrewCalendarStatic

Provides static methods for the HebrewCalendar class.

Public:

Properties:

Name | Description
HebrewEra (get) | Returns the current era of the Hebrew calendar.

See Also

Project CorLib Overview

Class HebrewCalendarStatic Overview

HebrewCalendar


HebrewCalendarStatic: HebrewEra (get)

HebrewEra

Returns the current era of the Hebrew calendar.

 Public Property Get HebrewEra ( ) As Long

Return Values

Long - Returns a constant of 1.

Read Only.

See Also

Project CorLib Overview

Class HebrewCalendarStatic Overview


HijriCalendar

HijriCalendar

Provides methods for manipulating Hijri dates.

Implements:

Calendar
ICloneable
IObject

Public:

Properties:

Name | Description
AlgorithmType (get) | Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.
Eras (get) | Gets a list of eras in the HijriCalendar.
HijriAdjustment (get) | Gets the number of days to add or subtract from the calendar to accommodate the variances in the start and the end of Ramadan and to accommodate the date difference between countries/regions.
HijriAdjustment (let) | Sets the number of days to add or subtract from the calendar to accommodate the variances in the start and the end of Ramadan and to accommodate the date difference between countries/regions.
IsReadOnly (get) | Gets a value indicating whether this HijriCalendar object is read-only.
MaxSupportedDateTime (get) | Gets the latest date and time supported by this HijriCalendar object.
MinSupportedDateTime (get) | Gets the earliest date and time supported by this HijriCalendar object.
TwoDigitYearMax (get) | Gets the last year of a 100-year range that can be represented by a 2-digit year.
TwoDigitYearMax (let) | Sets the last year of a 100-year range that can be represented by a 2-digit year.

Methods:

Name | Description
AddDays | Returns a CorDateTime that is the specified number of days away from the specified CorDateTime.
AddHours | Returns a CorDateTime this is the specified number of hours from the original Time.
AddMilliseconds | Returns a CorDateTime this is the specified number of Milliseconds from the original Time.
AddMinutes | Returns a CorDateTime this is the specified number of Minutes from the original Time.
AddMonths | Returns a CorDateTime this is the specified number of Months from the original Time.
AddSeconds | Returns a CorDateTime this is the specified number of Seconds from the original Time.
AddWeeks | Returns a CorDateTime this is the specified number of Weeks from the original Time.
AddYears | Returns a CorDateTime this is the specified number of Years from the original Time.
Clone | Creates a new object that is a copy of the current HijriCalendar object.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetDayOfMonth | Returns the day of the months for the specified date.
GetDayOfWeek | Returns the DayOfWeek enum of the specified date.
GetDayOfYear | Returns the day of the year for the specified date.
GetDaysInMonth | Returns the number of days in the specified month.
GetDaysInYear | Returns the number of days in the specified year.
GetEra | Returns the era that the specified time exists in.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetHour | Returns the hour of the specified time.
GetLeapMonth | Calculates the leap month for a specified year and era.
GetMilliseconds | Returns the milliseconds of the specified time.
GetMinute | Returns the minute of the specified time.
GetMonth | Returns the month of the specified time.
GetMonthsInYear | Returns the number of months in the specified year.
GetSecond | Returns the second of the specified time.
GetWeekOfYear | Returns the week of the year that the specified date belongs to.
GetYear | Returns the year of the specified time.
IsLeapDay | Returns a boolean indicating if the specific day is a leap day.
IsLeapMonth | Returns a boolean indicating if the specific month is a leap month.
IsLeapYear | Returns a boolean indicating if the specific year is a leap year.
ToDateTime | Returns a Gregorian CorDateTime computed using the specific calendar rules.
ToFourDigitYear | Converts the specified year to a four-digit year by using the TwoDigitYearMax property to determine the appropriate century.
ToString | Returns a string representation of this object instance.

Remarks

This is based on the Tabular version of the Islamic calendar, not the pure lunar version.

See Also

Project CorLib Overview

Class HijriCalendar Overview

HijriCalendarStatic

Calendar


HijriCalendar: AddDays

AddDays

Returns a CorDateTime that is the specified number of days away from the specified CorDateTime.

 Public Function AddDays(
      ByRef Time As Variant,
      ByVal Days As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to add days to.
Days
[ByVal] Long. The number of days to add.

Return Values

CorDateTime - The CorDateTime that results from adding the specified number of days to the specified CorDateTime.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: AddHours

AddHours

Returns a CorDateTime this is the specified number of hours from the original Time.

 Public Function AddHours(
      ByRef Time As Variant,
      ByVal Hours As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of hours to.
Hours
[ByVal] Long. The number of hours to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a with the specified number of hours added.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: AddMilliseconds

AddMilliseconds

Returns a CorDateTime this is the specified number of Milliseconds from the original Time.

 Public Function AddMilliseconds(
      ByRef Time As Variant,
      ByVal Milliseconds As Double ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Milliseconds to.
Milliseconds
[ByVal] Double. The number of Milliseconds to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Milliseconds added.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: AddMinutes

AddMinutes

Returns a CorDateTime this is the specified number of Minutes from the original Time.

 Public Function AddMinutes(
      ByRef Time As Variant,
      ByVal Minutes As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Minutes to.
Minutes
[ByVal] Long. The number of Minutes to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Minutes added.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: AddMonths

AddMonths

Returns a CorDateTime this is the specified number of Months from the original Time.

 Public Function AddMonths(
      ByRef Time As Variant,
      ByVal Months As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Months to.
Months
[ByVal] Long. The number of Months to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Months added.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: AddSeconds

AddSeconds

Returns a CorDateTime this is the specified number of Seconds from the original Time.

 Public Function AddSeconds(
      ByRef Time As Variant,
      ByVal Seconds As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Seconds to.
Seconds
[ByVal] Long. The number of Seconds to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Seconds added.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: AddWeeks

AddWeeks

Returns a CorDateTime this is the specified number of Weeks from the original Time.

 Public Function AddWeeks(
      ByRef Time As Variant,
      ByVal Weeks As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Weeks to.
Weeks
[ByVal] Long. The number of Weeks to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Weeks added.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: AddYears

AddYears

Returns a CorDateTime this is the specified number of Years from the original Time.

 Public Function AddYears(
      ByRef Time As Variant,
      ByVal Years As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Years to.
Years
[ByVal] Long. The number of Years to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Years added.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: AlgorithmType (get)

AlgorithmType

Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.

 Public Property Get AlgorithmType ( ) As CalendarAlgorithmType

Return Values

CalendarAlgorithmType - Always returns CalendarAlgorithmType.LunarCalendar.

Read Only.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: Calendar

Calendar

 Implements Calendar

Return Values

Calendar -

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: Clone

Clone

Creates a new object that is a copy of the current HijriCalendar object.

 Public Function Clone ( ) As HijriCalendar

Return Values

HijriCalendar - A copy of the HijriCalendar object.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: Eras (get)

Eras

Gets a list of eras in the HijriCalendar.

 Public Property Get Eras ( ) As Long ( )

Return Values

Long() - An array of integers that represents the eras in the HijriCalendar.

Remarks

The Hijri calendar recognizes one era: A.H. (Latin "Anno Hegirae", which means "the year of the migration," in reference to the migration of Muhammad (PBUH) from Mecca). This property always returns an array with only one element.

Read Only.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: GetDayOfMonth

GetDayOfMonth

Returns the day of the months for the specified date.

 Public Function GetDayOfMonth(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The date inwhich to retrieve the day of the month.

Return Values

Long - The day of the month for the specified date.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: GetDayOfWeek

GetDayOfWeek

Returns the DayOfWeek enum of the specified date.

 Public Function GetDayOfWeek(
      ByRef Time As Variant ) As DayOfWeek

Parameters

Time
[ByRef] Variant. The date to retrieve the day of the week for.

Return Values

DayOfWeek - A DayOfWeek enum representing the day of the week.

Remarks

The DayOfWeek is Sunday and is 0-based. The Visual Basic enum vbDayOfWeek is 1-based.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: GetDayOfYear

GetDayOfYear

Returns the day of the year for the specified date.

 Public Function GetDayOfYear(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The date to retrieve the day of the year from.

Return Values

Long - The day of the year.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: GetDaysInMonth

GetDaysInMonth

Returns the number of days in the specified month.

 Public Function GetDaysInMonth(
      ByVal Year As Long,
      ByVal Month As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year inwhich the month exists. This is used by calendars that have months that change based on the year, such as leap years.
Month
[ByVal] Long. The month to retrieve the number of days of.
Era
[ByRef] Optional. Variant. The time period inwhich the year exists.

Return Values

Long -

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: GetDaysInYear

GetDaysInYear

Returns the number of days in the specified year.

 Public Function GetDaysInYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year to retrieve the number of days of.
Era
[ByRef] Optional. Variant. The era the year exists in.

Return Values

Long - The number of days in the year.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: GetEra

GetEra

Returns the era that the specified time exists in.

 Public Function GetEra(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to find the containing era of.

Return Values

Long - The era for the time.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: GetHour

GetHour

Returns the hour of the specified time.

 Public Function GetHour(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the hour from.

Return Values

Long - The hour portion of the time.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: GetLeapMonth

GetLeapMonth

Calculates the leap month for a specified year and era.

 Public Function GetLeapMonth(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. A year.
Era
[ByRef] Optional. Variant. An era.

Return Values

Long - Always 0 because the HijriCalendar does not recognize leap months.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: GetMilliseconds

GetMilliseconds

Returns the milliseconds of the specified time.

 Public Function GetMilliseconds(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the milliseconds from.

Return Values

Long - The millisecond portion of the time.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: GetMinute

GetMinute

Returns the minute of the specified time.

 Public Function GetMinute(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the minute from.

Return Values

Long - The minute portion of the time.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: GetMonth

GetMonth

Returns the month of the specified time.

 Public Function GetMonth(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the month from.

Return Values

Long - The month portion of the time.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: GetMonthsInYear

GetMonthsInYear

Returns the number of months in the specified year.

 Public Function GetMonthsInYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year to get the number of months of.
Era
[ByRef] Optional. Variant. The era the year exists in.

Return Values

Long - The number of months in the year.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: GetSecond

GetSecond

Returns the second of the specified time.

 Public Function GetSecond(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the second from.

Return Values

Long - The second portion of the time.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: GetWeekOfYear

GetWeekOfYear

Returns the week of the year that the specified date belongs to.

 Public Function GetWeekOfYear(
      ByRef Time As Variant,
      ByVal Rule As CalendarWeekRule,
      ByVal FirstDayOfWeek As DayOfWeek ) As Long

Parameters

Time
[ByRef] Variant. The date to find the week it belongs.
Rule
[ByVal] CalendarWeekRule. Rule to decide what constitutes the first week of the year.
FirstDayOfWeek
[ByVal] DayOfWeek. Defines which week day is the start of a new week.

Return Values

Long - The week that the date belongs to.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: GetYear

GetYear

Returns the year of the specified time.

 Public Function GetYear(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the year from.

Return Values

Long - The year portion of the time.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: HijriAdjustment (get)

HijriAdjustment

Gets the number of days to add or subtract from the calendar to accommodate the variances in the start and the end of Ramadan and to accommodate the date difference between countries/regions.

 Public Property Get HijriAdjustment ( ) As Long

Return Values

Long -

Read/Write.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: HijriAdjustment (let)

HijriAdjustment

Sets the number of days to add or subtract from the calendar to accommodate the variances in the start and the end of Ramadan and to accommodate the date difference between countries/regions.

 Public Property Let HijriAdjustment(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. An integer from -2 to 2 that represents the number of days to add or subtract from the calendar.

Remarks

Exceptions

Read/Write.

See Also

Project CorLib Overview

Class HijriCalendar Overview

Build on Sunday, October 11, 2020 by VBDOX
Exception | Condition
ArgumentOutOfRangeException | The property is being set to an invalid value.


HijriCalendar: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: IsLeapDay

IsLeapDay

Returns a boolean indicating if the specific day is a leap day.

 Public Function IsLeapDay(
      ByVal Year As Long,
      ByVal Month As Long,
      ByVal Day As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year the day is in.
Month
[ByVal] Long. The month the day is in.
Day
[ByVal] Long. The day to check if is a leap day.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the day is a leap day.

Remarks

In every 30-year cycle that ends with a year that is evenly divisible by 30, the 2nd, 5th, 7th, 10th, 13th, 16th, 18th, 21st, 24th, 26th, and 29th years are leap years. A common year has 354 days and a leap year has 355 days.

A leap day is a day that occurs only in a leap year. In the Hijri calendar, the 30th day of Zulhijjah is the only leap day.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Year is outside the range supported by the calendar. -or- Month is outside the range supported by the calendar. -or- Day is outside the range supported by the calendar. -or- Era is outside the range supported by the calendar.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: IsLeapMonth

IsLeapMonth

Returns a boolean indicating if the specific month is a leap month.

 Public Function IsLeapMonth(
      ByVal Year As Long,
      ByVal Month As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year the month is in.
Month
[ByVal] Long. The month to check if it is a leap month.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the month is a leap month.

Remarks

A leap month only exists in a leap year, such as Adar II in the Hebrew calendar.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: IsLeapYear

IsLeapYear

Returns a boolean indicating if the specific year is a leap year.

 Public Function IsLeapYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year to check if is a leap year.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the year is a leap year.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: IsReadOnly (get)

IsReadOnly

Gets a value indicating whether this HijriCalendar object is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - True if this HijriCalendar object is read-only; otherwise, False.

Read Only.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: MaxSupportedDateTime (get)

MaxSupportedDateTime

Gets the latest date and time supported by this HijriCalendar object.

 Public Property Get MaxSupportedDateTime ( ) As CorDateTime

Return Values

CorDateTime - The latest date and time supported by the HijriCalendar type, which is equivalent to the last moment of December 31, 9999 C.E. in the Gregorian calendar.

Remarks

December 31, 9999 C.E. is equivalent to the 3rd day of the 4th month of the year 9666 in the Hijri calendar.

Read Only.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: MinSupportedDateTime (get)

MinSupportedDateTime

Gets the earliest date and time supported by this HijriCalendar object.

 Public Property Get MinSupportedDateTime ( ) As CorDateTime

Return Values

CorDateTime - The earliest date and time supported by the HijriCalendar type, which is equivalent to the first moment of July 18, 622 C.E. in the Gregorian calendar.

Read Only.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: ToDateTime

ToDateTime

Returns a Gregorian CorDateTime computed using the specific calendar rules.

 Public Function ToDateTime(
      ByVal Year As Long,
      ByVal Month As Long,
      ByVal Day As Long,
      ByVal Hour As Long,
      ByVal Minute As Long,
      ByVal Second As Long,
      ByVal Millisecond As Long,
      Optional ByRef Era As Variant ) As CorDateTime

Parameters

Year
[ByVal] Long. The Year in the specific calendar type.
Month
[ByVal] Long. The Month in the specific calendar type.
Day
[ByVal] Long. The Day in the specific calendar type.
Hour
[ByVal] Long. The hour for the new time.
Minute
[ByVal] Long. The minute for the new time.
Second
[ByVal] Long. The second for the new time.
Millisecond
[ByVal] Long. The milliseconds for the new time.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

CorDateTime - A Gregorian version of the date specified.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: ToFourDigitYear

ToFourDigitYear

Converts the specified year to a four-digit year by using the TwoDigitYearMax property to determine the appropriate century.

 Public Function ToFourDigitYear(
      ByVal Year As Long ) As Long

Parameters

Year
[ByVal] Long. A two-digit or four-digit integer that represents the year to convert.

Return Values

Long - A 4-digit year in the specific calendar.

Remarks

A normal way of dealing with years is by refering to them as a 2-digit value. This is evident in the Gregorian calendar system. The year 2005 may be referenced as 05 (pronounced oh-five). When converting a 2-digit year to a 4-digit the century is unknown. 05 could be 2005 or 1905. This property gives the calendar a rule to follow when converting 2-digit years to 4-digit.

A max year of 2029 will cause a minimum year of 1930. These two years represent 100 years which 2-digit years will fall. 00-99 will fall within 1930-2029.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: TwoDigitYearMax (get)

TwoDigitYearMax

Gets the last year of a 100-year range that can be represented by a 2-digit year.

 Public Property Get TwoDigitYearMax ( ) As Long

Return Values

Long - The last year of a 100-year range that can be represented by a 2-digit year.

Read/Write.

See Also

Project CorLib Overview

Class HijriCalendar Overview


HijriCalendar: TwoDigitYearMax (let)

TwoDigitYearMax

Sets the last year of a 100-year range that can be represented by a 2-digit year.

 Public Property Let TwoDigitYearMax(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The last year of a 100-year range.

Remarks

This property allows a 2-digit year to be properly translated to a 4-digit year. For example, if this property is set to 1429, the 100-year range is from 1330 to 1429. Therefore, a 2-digit value of 30 is interpreted as 1330, while a 2-digit value of 29 is interpreted as 1429.

The application should set this value to 99 to indicate that 2-digit years are to be taken literally. For example, if this property is set to 99, the 100-year range is from 0 (not a valid value for most calendars) to 99. Therefore, a 2-digit value of 30 is interpreted as 30.

Exceptions

Read/Write.

See Also

Project CorLib Overview

Class HijriCalendar Overview

Build on Sunday, October 11, 2020 by VBDOX
Exception | Condition
InvalidOperationException | This calendar is read-only.
ArgumentOutOfRangeException | The value in a set operation is less than 100 or greater than 9666.


HijriCalendarStatic

HijriCalendarStatic

Provides static methods to support the Hijri calendar.

Public:

Properties:

Name | Description
HijriEra (get) | Returns the current era for the Hijra calendar. This returns a constant of 1.

Remarks

To access the methods of this class, use the HijriCalendar method name followed by the method to execute.

Example

 i = HijriCalendar.HijriEra

See Also

Project CorLib Overview

Class HijriCalendarStatic Overview

HijriCalendar


HijriCalendarStatic: HijriEra (get)

HijriEra

Returns the current era for the Hijra calendar. This returns a constant of 1.

 Public Property Get HijriEra ( ) As Long

Return Values

Long - The current era.

Read Only.

See Also

Project CorLib Overview

Class HijriCalendarStatic Overview


HMAC

HMAC

Provides a common Hash-based Message Authentication Code (HMAC) interface to be implemented by all HMAC classes.

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if the hash algorithm implementation can be reused once a hash has been computed.
CanTransformMultipleBlocks (get) | Returns if the hash algorithm implementation can processd multiple blocks of data at a time.
Hash (get) | Returns the computed hash after all data has been processed.
HashName (get) | Returns the name of the hash being used.
HashName (let) | Sets the name of the hash being used.
HashSize (get) | Returns the size of the hash value in bits.
InputBlockSize (get) | Returns the size of the input block size allowed.
Key (get) | Returns the current key used with the hash process.
Key (let) | Sets the key to be used with the hash process.
OutputBlockSize (get) | Returns the size of the output block.

Methods:

Name | Description
Clear | Releases any resources being held by the hash algorithm.
ComputeHash | Computes the hash on a source in its entirety.
Equals | Returns if the Value is equal to this object instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
Initialize | Resets a hashing object to begin hashing a new value.
ToString | Returns a string representation of this object instance.
TransformBlock | Continues to compute the hash value for blocks of data.
TransformFinalBlock | Finalizes the hash computation by processing the last block of data.

Remarks

A Hash-based Message Authentication Code can be used to determine if messages sent over insecure channels have been modified. This works by each party at boths ends sharing a secret key used to sign the sent message and to also authenticate the received message. If the key were compromised, then the authentication cannot be guaranteed.

See Also

Project CorLib Overview

Class HMAC Overview

HMACMD5

HMACSHA1

HMACSHA256

HMACSHA384

HMACSHA512

HMACRIPEMD160


HMAC: CanReuseTransform (get)

CanReuseTransform

Returns if the hash algorithm implementation can be reused once a hash has been computed.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - True if the implementation can be reused, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class HMAC Overview


HMAC: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if the hash algorithm implementation can processd multiple blocks of data at a time.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - True if multiple blocks of data can be processed at a time, False otherwise.

Remarks

The size of 1 block of data is defined by the InputBlockSize property.

Read Only.

See Also

Project CorLib Overview

Class HMAC Overview


HMAC: Clear

Clear

Releases any resources being held by the hash algorithm.

 Public Sub Clear ( )

Remarks

Once this is called, the object is disposed and cannot be reused.

See Also

Project CorLib Overview

Class HMAC Overview


HMAC: ComputeHash

ComputeHash

Computes the hash on a source in its entirety.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( ) :

Parameters

Source
[ByRef] Variant. The source of data compute the hash for. This can be a byte array or object implementing the Stream interface.
Index
[ByRef] Optional. Variant. The starting index in a byte array source. If the source is not a byte array, this argument is ignored.
Count
[ByRef] Optional. Variant. The number of bytes to compute the hash on. If the source is not a byte array, this argument is ignored.

Return Values

Byte() - The hash value computed from the source provided.

Remarks

If Source is a Stream, then the stream is read from and the hash continuously computed until the stream no longer returns data.

If data has already been processed using TransformBlock, then that data will be included in the hashing process.

See Also

Project CorLib Overview

Class HMAC Overview

TransformBlock


HMAC: Equals

Equals

Returns if the Value is equal to this object instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this object instance.

Return Values

Boolean - True if they are considered equal, False otherwise.

See Also

Project CorLib Overview

Class HMAC Overview


HMAC: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class HMAC Overview


HMAC: Hash (get)

Hash

Returns the computed hash after all data has been processed.

 Public Property Get Hash ( ) As Byte ( ) :

Return Values

Byte() - A byte array containing the computed hash.

Remarks

The size of the array will vary depending on the hash algorithm being performed.

Read Only.

See Also

Project CorLib Overview

Class HMAC Overview


HMAC: HashName (get)

HashName

Returns the name of the hash being used.

 Public Property Get HashName ( ) As String

Return Values

String - The name of the hash.

Read/Write.

See Also

Project CorLib Overview

Class HMAC Overview


HMAC: HashName (let)

HashName

Sets the name of the hash being used.

 Public Property Let HashName(
      ByRef Value As String ) :

Parameters

Value
[ByRef] String. The new name of the hash.

Read/Write.

See Also

Project CorLib Overview

Class HMAC Overview


HMAC: HashSize (get)

HashSize

Returns the size of the hash value in bits.

 Public Property Get HashSize ( ) As Long

Return Values

Long - The size of the hash value in bits.

Read Only.

See Also

Project CorLib Overview

Class HMAC Overview


HMAC: Initialize

Initialize

Resets a hashing object to begin hashing a new value.

 Public Sub Initialize ( )

Remarks

If Clear has been called, then the object cannot be re-initialized.

See Also

Project CorLib Overview

Class HMAC Overview


HMAC: InputBlockSize (get)

InputBlockSize

Returns the size of the input block size allowed.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - The number of bytes a single input block is.

Remarks

When calling the TransformBlock method, the InputCount must equal this value. If the hashs CanTransformMultipleBlocks returns True, then the InputCount can be larger than the InputBlockSize, but must be an even multiple of InputBlockSize.

Read Only.

See Also

Project CorLib Overview

Class HMAC Overview


HMAC: Key (get)

Key

Returns the current key used with the hash process.

 Public Property Get Key ( ) As Byte ( ) :

Return Values

Byte() - The current key.

Read/Write.

See Also

Project CorLib Overview

Class HMAC Overview


HMAC: Key (let)

Key

Sets the key to be used with the hash process.

 Public Property Let Key(
      ByRef Value ( ) As Byte ) :

Parameters

Value
[ByRef] Byte. The new key value.

Read/Write.

See Also

Project CorLib Overview

Class HMAC Overview


HMAC: OutputBlockSize (get)

OutputBlockSize

Returns the size of the output block.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - The size of the output block.

Remarks

When calling the TransformBlock method, the return value will be 0 or a multiple of this value.

Read Only.

See Also

Project CorLib Overview

Class HMAC Overview


HMAC: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class HMAC Overview


HMAC: TransformBlock

TransformBlock

Continues to compute the hash value for blocks of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The bytes to continue computing the hash from.
InputOffset
[ByVal] Long. The index into the byte array to begin computing from.
InputCount
[ByVal] Long. The number of bytes to be included in the hash computation.
OutputBuffer
[ByRef] Byte. The data after it has been processed. This will be the same as the input data, no changes are made.
OutputOffset
[ByVal] Long. The starting index in the output buffer to place the processed data.

Return Values

Long - The number of bytes that were processed.

Remarks

The OutputBuffer will contain the same plain text data as the input buffer. No transformation of the data is applied. The OutputBuffer array can be an uninitialized array or the same array as the InputBuffer. If InputBuffer and OutputBuffer are the same array and InputOffset equals OutputOffset, no data is copied.

Once this method is called, Hash cannot be called until the TransformFinalBlock is called, finishing the hash computation.

See Also

Project CorLib Overview

Class HMAC Overview

Hash


HMAC: TransformFinalBlock

TransformFinalBlock

Finalizes the hash computation by processing the last block of data.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( ) :

Parameters

InputBuffer
[ByRef] Byte. The bytes to finish the hash computation with.
InputOffset
[ByVal] Long. The index into the byte array to begin hash computations.
InputCount
[ByVal] Long. The number of bytes to be included in the final hash computation.

Return Values

Byte() - A copy of the portion of the InputBuffer that was processed.

Remarks

The hash value is not returned by this method. To retrieve the final hash value, call the Hash property.

The Hash property can only be called after this method is called. If the Hash property is called before this method, then an exception is thrown.

If the implementation can be reused (CanReuseTransform) then the implemntation is reset to allow computing of a new hash value.

See Also

Project CorLib Overview

Class HMAC Overview

Hash


HMACBase

HMACBase

Provides the base functionality to perfrom Hash Message Authentication Code operations.

Public:

Properties:

Name | Description
Hash (get) | Returns the computed hash.
HashName (get) | Returns the name of the hash algorithm used.
HashName (let) | Sets the name of the hash algorithm used.

Methods:

Name | Description
Clear | Releases any resources and marks the object as disposed.
ComputeHash | Computes the hash code for the specific source.
GetKey | Returns the current key used by the hash.
Initialize | Resets an instance to begin computing a hash from the begining.
SetKey | Sets the key the hash will use.
TransformBlock | Processes a block of data towards the computed hash.
TransformFinalBlock | Processes the final block of data, generating the computed hash.

Remarks

This base implementation manages many of the aspects utilized with HMAC implementations. Usually, any class that implements the HashAlgorithm interface can easily be used to provide HMAC capabilities by simply initializing an instance of HMACBase with an instance of the hash object.

The HMAC set of classes provided in VBCorLib utilize the HMACBase class to provide consistent HMAC operations.

See Also

Project CorLib Overview

Class HMACBase Overview

HMACMD5

HMACRIPEMD160

HMACSHA1

HMACSHA256

HMACSHA384

HMACSHA512

Constructors


HMACBase: Clear

Clear

Releases any resources and marks the object as disposed.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class HMACBase Overview


HMACBase: ComputeHash

ComputeHash

Computes the hash code for the specific source.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Source
[ByRef] Variant. The source to compute the hash for. This can be a byte array or Stream based object.
Index
[ByRef] Optional. Variant. The starting index in the byte array to begin compute the hash. This is ignored for Stream objects.
Count
[ByRef] Optional. Variant. The number of bytes to used to compute the hash in a byte array. This is ignored for Stream objects.

Return Values

Byte() - The computed hash.

Remarks

For Stream objects, the stream is continuously read from and the hash computed until the stream contains no data.

See Also

Project CorLib Overview

Class HMACBase Overview


HMACBase: GetKey

GetKey

Returns the current key used by the hash.

 Public Function GetKey ( ) As Byte ( )

Return Values

Byte() - The current key used.

See Also

Project CorLib Overview

Class HMACBase Overview


HMACBase: Hash (get)

Hash

Returns the computed hash.

 Public Property Get Hash ( ) As Byte ( )

Return Values

Byte() - The computed hash.

Read Only.

See Also

Project CorLib Overview

Class HMACBase Overview


HMACBase: HashName (get)

HashName

Returns the name of the hash algorithm used.

 Public Property Get HashName ( ) As String

Return Values

String - The hash algorithm name.

Read/Write.

See Also

Project CorLib Overview

Class HMACBase Overview


HMACBase: HashName (let)

HashName

Sets the name of the hash algorithm used.

 Public Property Let HashName(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new hash name.

Read/Write.

See Also

Project CorLib Overview

Class HMACBase Overview


HMACBase: Initialize

Initialize

Resets an instance to begin computing a hash from the begining.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class HMACBase Overview


HMACBase: SetKey

SetKey

Sets the key the hash will use.

 Public Sub SetKey(
      ByRef Key ( ) As Byte )

Parameters

Key
[ByRef] Byte. The key to be used during the hash.

Remarks

This is required as a work-around for the byte array property assignment bug in VB6.

See Also

Project CorLib Overview

Class HMACBase Overview


HMACBase: TransformBlock

TransformBlock

Processes a block of data towards the computed hash.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to be processed.
InputOffset
[ByVal] Long. The starting index to begin processing data.
InputCount
[ByVal] Long. The number of bytes to be processed.
OutputBuffer
[ByRef] Byte. The array to place the processed data.
OutputOffset
[ByVal] Long. The starting index to begin placing the processed data.

Return Values

Long - The number of bytes processed.

Remarks

OutputBuffer will not contain a hashed value. The data processed in InputBuffer will be copied to OutputBuffer. The data will not be copied if OutputBuffer is an uninitialized array or OutputBuffer and InputBuffer are the same array and InputOffset and OutputOffset are the same.

See Also

Project CorLib Overview

Class HMACBase Overview


HMACBase: TransformFinalBlock

TransformFinalBlock

Processes the final block of data, generating the computed hash.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The final block of data to process.
InputOffset
[ByVal] Long. The starting index of the data to be processed.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - The processed data. This is a copy of the InputBuffer data.

Remarks

The returned array is a copy of InputBuffer with a length the same as InputCount. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class HMACBase Overview


HMACMD5

HMACMD5

Represents an MD5 implementation of an HMAC algorithm.

Implements:

HashAlgorithm
HMAC
ICryptoTransform
IObject
KeyedHashAlgorithm

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if this service provider can be reused to transfrom more data.
CanTransformMultipleBlocks (get) | Returns if this transform can operate on multiple blocks at once.
Hash (get) | Returns the computed hash.
HashName (get) | Returns the name of the hash.
HashName (let) | Sets the name of the hash.
HashSize (get) | Returns the size of the computed hash.
InputBlockSize (get) | Returns the size of the input block size allowed.
Key (get) | Returns the key being used by the hash.
Key (let) | Sets the key to be used by the hash.
OutputBlockSize (get) | Returns the output block size this transform can produce.

Methods:

Name | Description
Clear | Releases any resources.
ComputeHash | Computes a hash value for a source in a single pass.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Initialize | Resets the hashing algorithm to start again.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Computes the hash for the specified block of data.
TransformFinalBlock | Processes the final data and retrieves the hash value.

Remarks

Information about HMAC can be found at http://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf

A Hash-based Message Authentication Code can be used to determine if messages sent over insecure channels have been modified. This works by each party at boths ends sharing a secret key used to sign the sent message and to also authenticate the received message. If the key were compromised, then the authentication cannot be guaranteed.

See Also

Project CorLib Overview

Class HMACMD5 Overview

HMAC


HMACMD5: CanReuseTransform (get)

CanReuseTransform

Returns if this service provider can be reused to transfrom more data.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if this transform can operate on multiple blocks at once.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: Clear

Clear

Releases any resources.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: ComputeHash

ComputeHash

Computes a hash value for a source in a single pass.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Source
[ByRef] Variant. This can be either a Byte array or any Stream compatible object.
Index
[ByRef] Optional. Variant. The starting index in the Byte array. This is ignored for Stream objects.
Count
[ByRef] Optional. Variant. The number of bytes in the array to be computed. This is ignored for Stream objects.

Return Values

Byte() - A 16-byte hash value.

Remarks

If a Stream object is passed in, then the stream is continuously read and the hash calculated until there is no more data left to read from the stream.

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the values are the same.

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: Hash (get)

Hash

Returns the computed hash.

 Public Property Get Hash ( ) As Byte ( )

Return Values

Byte() - A 16-byte array containing the hash value.

Remarks

The TransformFinalBlock must be called before accessing this property or an InvalidOperationException will be thrown.

Read Only.

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: HashAlgorithm

HashAlgorithm

 Implements HashAlgorithm

Return Values

HashAlgorithm -

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: HashName (get)

HashName

Returns the name of the hash.

 Public Property Get HashName ( ) As String

Return Values

String - The name of the hash.

Read/Write.

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: HashName (let)

HashName

Sets the name of the hash.

 Public Property Let HashName(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The name of the hash.

Read/Write.

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: HashSize (get)

HashSize

Returns the size of the computed hash.

 Public Property Get HashSize ( ) As Long

Return Values

Long - Always returns 128 bits.

Read Only.

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: HMAC

HMAC

 Implements HMAC

Return Values

HMAC -

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: ICryptoTransform

ICryptoTransform

 Implements ICryptoTransform

Return Values

ICryptoTransform -

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: Initialize

Initialize

Resets the hashing algorithm to start again.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: InputBlockSize (get)

InputBlockSize

Returns the size of the input block size allowed.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Remarks

When calling the TransformBlock method, the InputCount must be zero or a multiple of this value.

Read Only.

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: Key (get)

Key

Returns the key being used by the hash.

 Public Property Get Key ( ) As Byte ( )

Return Values

Byte() - The key being used.

Read/Write.

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: Key (let)

Key

Sets the key to be used by the hash.

 Public Property Let Key(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new key value.

Read/Write.

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: KeyedHashAlgorithm

KeyedHashAlgorithm

 Implements KeyedHashAlgorithm

Return Values

KeyedHashAlgorithm -

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: OutputBlockSize (get)

OutputBlockSize

Returns the output block size this transform can produce.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Read Only.

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: TransformBlock

TransformBlock

Computes the hash for the specified block of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to compute the hash from.
InputOffset
[ByVal] Long. The starting index in the input data to compute the hash.
InputCount
[ByVal] Long. The number of bytes to compute the hash from.
OutputBuffer
[ByRef] Byte. The array to place the input buffer bytes in.
OutputOffset
[ByVal] Long. The starting index to beging copying the bytes to.

Return Values

Long - The number of bytes processed.

Remarks

The OutputBuffer will contain the same data as the InputBuffer. No hash values are placed in the OutputBuffer.

If a null array is passed in for the OutputBuffer, then nothing is copied, however, the hash is still computed on the InputBuffer data.

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACMD5: TransformFinalBlock

TransformFinalBlock

Processes the final data and retrieves the hash value.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The final block of data to compute the hash for.
InputOffset
[ByVal] Long. The index in the InputBuffer to begin computing data.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - Returns the section of the InputBuffer that was processed.

Remarks

This does not return the computed hash value. A copy of the data that was process is returned. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class HMACMD5 Overview


HMACRIPEMD160

HMACRIPEMD160

Represents a RIPEMD160 hash impelemntation of the HMAC algorithm.

Implements:

HashAlgorithm
HMAC
ICryptoTransform
IObject
KeyedHashAlgorithm

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if this service provider can be reused to transfrom more data.
CanTransformMultipleBlocks (get) | Returns if this transform can operate on multiple blocks at once.
Hash (get) | Returns the computed hash.
HashName (get) | Returns the name of the hash.
HashName (let) | Sets the name of the hash.
HashSize (get) | Returns the size of the computed hash.
InputBlockSize (get) | Returns the size of the input block size allowed.
Key (get) | Returns the key being used by the hash.
Key (let) | Sets the key to be used by the hash.
OutputBlockSize (get) | Returns the output block size this transform can produce.

Methods:

Name | Description
Clear | Releases any resources.
ComputeHash | Computes a hash value for a source in a single pass.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Initialize | Resets the hashing algorithm to start again.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Computes the hash for the specified block of data.
TransformFinalBlock | Processes the final data and retrieves the hash value.

Remarks

Information about HMAC can be found at http://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf

A Hash-based Message Authentication Code can be used to determine if messages sent over insecure channels have been modified. This works by each party at boths ends sharing a secret key used to sign the sent message and to also authenticate the received message. If the key were compromised, then the authentication cannot be guaranteed.

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: CanReuseTransform (get)

CanReuseTransform

Returns if this service provider can be reused to transfrom more data.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if this transform can operate on multiple blocks at once.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: Clear

Clear

Releases any resources.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: ComputeHash

ComputeHash

Computes a hash value for a source in a single pass.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Source
[ByRef] Variant. This can be either a Byte array or any Stream compatible object.
Index
[ByRef] Optional. Variant. The starting index in the Byte array. This is ignored for Stream objects.
Count
[ByRef] Optional. Variant. The number of bytes in the array to be computed. This is ignored for Stream objects.

Return Values

Byte() - A 20-byte hash value.

Remarks

If a Stream object is passed in, then the stream is continuously read and the hash calculated until there is no more data left to read from the stream.

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the values are the same.

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: Hash (get)

Hash

Returns the computed hash.

 Public Property Get Hash ( ) As Byte ( )

Return Values

Byte() - A 20-byte array containing the hash value.

Remarks

The TransformFinalBlock must be called before accessing this property or an InvalidOperationException will be thrown.

Read Only.

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: HashAlgorithm

HashAlgorithm

 Implements HashAlgorithm

Return Values

HashAlgorithm -

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: HashName (get)

HashName

Returns the name of the hash.

 Public Property Get HashName ( ) As String

Return Values

String - The name of the hash.

Read/Write.

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: HashName (let)

HashName

Sets the name of the hash.

 Public Property Let HashName(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The name of the hash.

Read/Write.

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: HashSize (get)

HashSize

Returns the size of the computed hash.

 Public Property Get HashSize ( ) As Long

Return Values

Long - Always returns 160 bits.

Read Only.

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: HMAC

HMAC

 Implements HMAC

Return Values

HMAC -

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: ICryptoTransform

ICryptoTransform

 Implements ICryptoTransform

Return Values

ICryptoTransform -

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: Initialize

Initialize

Resets the hashing algorithm to start again.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: InputBlockSize (get)

InputBlockSize

Returns the size of the input block size allowed.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Remarks

When calling the TransformBlock method, the InputCount must be zero or a multiple of this value.

Read Only.

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: Key (get)

Key

Returns the key being used by the hash.

 Public Property Get Key ( ) As Byte ( )

Return Values

Byte() - The key being used.

Read/Write.

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: Key (let)

Key

Sets the key to be used by the hash.

 Public Property Let Key(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new key value.

Read/Write.

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: KeyedHashAlgorithm

KeyedHashAlgorithm

 Implements KeyedHashAlgorithm

Return Values

KeyedHashAlgorithm -

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: OutputBlockSize (get)

OutputBlockSize

Returns the output block size this transform can produce.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Read Only.

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: TransformBlock

TransformBlock

Computes the hash for the specified block of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to compute the hash from.
InputOffset
[ByVal] Long. The starting index in the input data to compute the hash.
InputCount
[ByVal] Long. The number of bytes to compute the hash from.
OutputBuffer
[ByRef] Byte. The array to place the input buffer bytes in.
OutputOffset
[ByVal] Long. The starting index to beging copying the bytes to.

Return Values

Long - The number of bytes processed.

Remarks

The OutputBuffer will contain the same data as the InputBuffer. No hash values are placed in the OutputBuffer.

If a null array is passed in for the OutputBuffer, then nothing is copied, however, the hash is still computed on the InputBuffer data.

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACRIPEMD160: TransformFinalBlock

TransformFinalBlock

Processes the final data and retrieves the hash value.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The final block of data to compute the hash for.
InputOffset
[ByVal] Long. The index in the InputBuffer to begin computing data.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - Returns the section of the InputBuffer that was processed.

Remarks

This does not return the computed hash value. A copy of the data that was process is returned. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class HMACRIPEMD160 Overview


HMACSHA1

HMACSHA1

Represents an SHA-1 implementation of the HMAC algorithm.

Implements:

HashAlgorithm
HMAC
ICryptoTransform
IObject
KeyedHashAlgorithm

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if this service provider can be reused to transfrom more data.
CanTransformMultipleBlocks (get) | Returns if this transform can operate on multiple blocks at once.
Hash (get) | Returns the computed hash.
HashName (get) | Returns the name of the hash.
HashName (let) | Sets the name of the hash.
HashSize (get) | Returns the size of the computed hash.
InputBlockSize (get) | Returns the size of the input block size allowed.
Key (get) | Returns the key being used by the hash.
Key (let) | Sets the key to be used by the hash.
OutputBlockSize (get) | Returns the output block size this transform can produce.

Methods:

Name | Description
Clear | Releases any resources.
ComputeHash | Computes a hash value for a source in a single pass.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Initialize | Resets the hashing algorithm to start again.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Computes the hash for the specified block of data.
TransformFinalBlock | Processes the final data and retrieves the hash value.

Remarks

Information about HMAC can be found at http://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf

A Hash-based Message Authentication Code can be used to determine if messages sent over insecure channels have been modified. This works by each party at boths ends sharing a secret key used to sign the sent message and to also authenticate the received message. If the key were compromised, then the authentication cannot be guaranteed.

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: CanReuseTransform (get)

CanReuseTransform

Returns if this service provider can be reused to transfrom more data.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if this transform can operate on multiple blocks at once.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: Clear

Clear

Releases any resources.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: ComputeHash

ComputeHash

Computes a hash value for a source in a single pass.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Source
[ByRef] Variant. This can be either a Byte array or any Stream compatible object.
Index
[ByRef] Optional. Variant. The starting index in the Byte array. This is ignored for Stream objects.
Count
[ByRef] Optional. Variant. The number of bytes in the array to be computed. This is ignored for Stream objects.

Return Values

Byte() - A 20-byte hash value.

Remarks

If a Stream object is passed in, then the stream is continuously read and the hash calculated until there is no more data left to read from the stream.

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the values are the same.

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: Hash (get)

Hash

Returns the computed hash.

 Public Property Get Hash ( ) As Byte ( )

Return Values

Byte() - A 20-byte array containing the hash value.

Remarks

The TransformFinalBlock must be called before accessing this property or an InvalidOperationException will be thrown.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: HashAlgorithm

HashAlgorithm

 Implements HashAlgorithm

Return Values

HashAlgorithm -

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: HashName (get)

HashName

Returns the name of the hash.

 Public Property Get HashName ( ) As String

Return Values

String - The name of the hash.

Read/Write.

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: HashName (let)

HashName

Sets the name of the hash.

 Public Property Let HashName(
      ByVal Value As String )

Parameters

Value
[ByVal] String. The name of the hash.

Read/Write.

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: HashSize (get)

HashSize

Returns the size of the computed hash.

 Public Property Get HashSize ( ) As Long

Return Values

Long - Always returns 160 bits.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: HMAC

HMAC

 Implements HMAC

Return Values

HMAC -

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: ICryptoTransform

ICryptoTransform

 Implements ICryptoTransform

Return Values

ICryptoTransform -

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: Initialize

Initialize

Resets the hashing algorithm to start again.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: InputBlockSize (get)

InputBlockSize

Returns the size of the input block size allowed.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Remarks

When calling the TransformBlock method, the InputCount must be zero or a multiple of this value.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: Key (get)

Key

Returns the key being used by the hash.

 Public Property Get Key ( ) As Byte ( )

Return Values

Byte() - The key being used.

Read/Write.

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: Key (let)

Key

Sets the key to be used by the hash.

 Public Property Let Key(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new key value.

Read/Write.

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: KeyedHashAlgorithm

KeyedHashAlgorithm

 Implements KeyedHashAlgorithm

Return Values

KeyedHashAlgorithm -

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: OutputBlockSize (get)

OutputBlockSize

Returns the output block size this transform can produce.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: TransformBlock

TransformBlock

Computes the hash for the specified block of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to compute the hash from.
InputOffset
[ByVal] Long. The starting index in the input data to compute the hash.
InputCount
[ByVal] Long. The number of bytes to compute the hash from.
OutputBuffer
[ByRef] Byte. The array to place the input buffer bytes in.
OutputOffset
[ByVal] Long. The starting index to beging copying the bytes to.

Return Values

Long - The number of bytes processed.

Remarks

The OutputBuffer will contain the same data as the InputBuffer. No hash values are placed in the OutputBuffer.

If a null array is passed in for the OutputBuffer, then nothing is copied, however, the hash is still computed on the InputBuffer data.

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA1: TransformFinalBlock

TransformFinalBlock

Processes the final data and retrieves the hash value.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The final block of data to compute the hash for.
InputOffset
[ByVal] Long. The index in the InputBuffer to begin computing data.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - Returns the section of the InputBuffer that was processed.

Remarks

This does not return the computed hash value. A copy of the data that was process is returned. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class HMACSHA1 Overview


HMACSHA256

HMACSHA256

Represents an SHA-256 implementation of the HMAC algorithm.

Implements:

HashAlgorithm
HMAC
ICryptoTransform
IObject
KeyedHashAlgorithm

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if this service provider can be reused to transfrom more data.
CanTransformMultipleBlocks (get) | Returns if this transform can operate on multiple blocks at once.
Hash (get) | Returns the computed hash.
HashName (get) | Returns the name of the hash.
HashName (let) | Sets the name of the hash.
HashSize (get) | Returns the size of the computed hash.
InputBlockSize (get) | Returns the size of the input block size allowed.
Key (get) | Returns the key being used by the hash.
Key (let) | Sets the key to be used by the hash.
OutputBlockSize (get) | Returns the output block size this transform can produce.

Methods:

Name | Description
Clear | Releases any resources.
ComputeHash | Computes a hash value for a source in a single pass.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Initialize | Resets the hashing algorithm to start again.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Computes the hash for the specified block of data.
TransformFinalBlock | Processes the final data and retrieves the hash value.

Remarks

Information about HMAC can be found at http://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf

A Hash-based Message Authentication Code can be used to determine if messages sent over insecure channels have been modified. This works by each party at boths ends sharing a secret key used to sign the sent message and to also authenticate the received message. If the key were compromised, then the authentication cannot be guaranteed.

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: CanReuseTransform (get)

CanReuseTransform

Returns if this service provider can be reused to transfrom more data.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if this transform can operate on multiple blocks at once.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: Clear

Clear

Releases any resources.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: ComputeHash

ComputeHash

Computes a hash value for a source in a single pass.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Source
[ByRef] Variant. This can be either a Byte array or any Stream compatible object.
Index
[ByRef] Optional. Variant. The starting index in the Byte array. This is ignored for Stream objects.
Count
[ByRef] Optional. Variant. The number of bytes in the array to be computed. This is ignored for Stream objects.

Return Values

Byte() - A 32-byte hash value.

Remarks

If a Stream object is passed in, then the stream is continuously read and the hash calculated until there is no more data left to read from the stream.

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the values are the same.

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: Hash (get)

Hash

Returns the computed hash.

 Public Property Get Hash ( ) As Byte ( )

Return Values

Byte() - A 32-byte array containing the hash value.

Remarks

The TransformFinalBlock must be called before accessing this property or an InvalidOperationException will be thrown.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: HashAlgorithm

HashAlgorithm

 Implements HashAlgorithm

Return Values

HashAlgorithm -

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: HashName (get)

HashName

Returns the name of the hash.

 Public Property Get HashName ( ) As String

Return Values

String - The name of the hash.

Read/Write.

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: HashName (let)

HashName

Sets the name of the hash.

 Public Property Let HashName(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The name of the hash.

Read/Write.

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: HashSize (get)

HashSize

Returns the size of the computed hash.

 Public Property Get HashSize ( ) As Long

Return Values

Long - Always returns 256 bits.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: HMAC

HMAC

 Implements HMAC

Return Values

HMAC -

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: ICryptoTransform

ICryptoTransform

 Implements ICryptoTransform

Return Values

ICryptoTransform -

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: Initialize

Initialize

Resets the hashing algorithm to start again.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: InputBlockSize (get)

InputBlockSize

Returns the size of the input block size allowed.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Remarks

When calling the TransformBlock method, the InputCount must be zero or a multiple of this value.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: Key (get)

Key

Returns the key being used by the hash.

 Public Property Get Key ( ) As Byte ( )

Return Values

Byte() - The key being used.

Read/Write.

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: Key (let)

Key

Sets the key to be used by the hash.

 Public Property Let Key(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new key value.

Read/Write.

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: KeyedHashAlgorithm

KeyedHashAlgorithm

 Implements KeyedHashAlgorithm

Return Values

KeyedHashAlgorithm -

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: OutputBlockSize (get)

OutputBlockSize

Returns the output block size this transform can produce.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: TransformBlock

TransformBlock

Computes the hash for the specified block of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to compute the hash from.
InputOffset
[ByVal] Long. The starting index in the input data to compute the hash.
InputCount
[ByVal] Long. The number of bytes to compute the hash from.
OutputBuffer
[ByRef] Byte. The array to place the input buffer bytes in.
OutputOffset
[ByVal] Long. The starting index to beging copying the bytes to.

Return Values

Long - The number of bytes processed.

Remarks

The OutputBuffer will contain the same data as the InputBuffer. No hash values are placed in the OutputBuffer.

If a null array is passed in for the OutputBuffer, then nothing is copied, however, the hash is still computed on the InputBuffer data.

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA256: TransformFinalBlock

TransformFinalBlock

Processes the final data and retrieves the hash value.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The final block of data to compute the hash for.
InputOffset
[ByVal] Long. The index in the InputBuffer to begin computing data.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - Returns the section of the InputBuffer that was processed.

Remarks

This does not return the computed hash value. A copy of the data that was process is returned. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class HMACSHA256 Overview


HMACSHA384

HMACSHA384

Represents an SHA-384 implementation of the HMAC algorithm.

Implements:

HashAlgorithm
HMAC
ICryptoTransform
IObject
KeyedHashAlgorithm

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if this service provider can be reused to transfrom more data.
CanTransformMultipleBlocks (get) | Returns if this transform can operate on multiple blocks at once.
Hash (get) | Returns the computed hash.
HashName (get) | Returns the name of the hash.
HashName (let) | Sets the name of the hash.
HashSize (get) | Returns the size of the computed hash.
InputBlockSize (get) | Returns the size of the input block size allowed.
Key (get) | Returns the key being used by the hash.
Key (let) | Sets the key to be used by the hash.
OutputBlockSize (get) | Returns the output block size this transform can produce.
ProduceLegacyHmacValues (get) |
ProduceLegacyHmacValues (let) |

Methods:

Name | Description
Clear | Releases any resources.
ComputeHash | Computes a hash value for a source in a single pass.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Initialize | Resets the hashing algorithm to start again.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Computes the hash for the specified block of data.
TransformFinalBlock | Processes the final data and retrieves the hash value.

Remarks

Information about HMAC can be found at http://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf

A Hash-based Message Authentication Code can be used to determine if messages sent over insecure channels have been modified. This works by each party at boths ends sharing a secret key used to sign the sent message and to also authenticate the received message. If the key were compromised, then the authentication cannot be guaranteed.

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: CanReuseTransform (get)

CanReuseTransform

Returns if this service provider can be reused to transfrom more data.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if this transform can operate on multiple blocks at once.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: Clear

Clear

Releases any resources.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: ComputeHash

ComputeHash

Computes a hash value for a source in a single pass.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Source
[ByRef] Variant. This can be either a Byte array or any Stream compatible object.
Index
[ByRef] Optional. Variant. The starting index in the Byte array. This is ignored for Stream objects.
Count
[ByRef] Optional. Variant. The number of bytes in the array to be computed. This is ignored for Stream objects.

Return Values

Byte() - A 48-byte hash value.

Remarks

If a Stream object is passed in, then the stream is continuously read and the hash calculated until there is no more data left to read from the stream.

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the values are the same.

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: Hash (get)

Hash

Returns the computed hash.

 Public Property Get Hash ( ) As Byte ( )

Return Values

Byte() - A 48-byte array containing the hash value.

Remarks

The TransformFinalBlock must be called before accessing this property or an InvalidOperationException will be thrown.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: HashAlgorithm

HashAlgorithm

 Implements HashAlgorithm

Return Values

HashAlgorithm -

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: HashName (get)

HashName

Returns the name of the hash.

 Public Property Get HashName ( ) As String

Return Values

String - The name of the hash.

Read/Write.

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: HashName (let)

HashName

Sets the name of the hash.

 Public Property Let HashName(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The name of the hash.

Read/Write.

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: HashSize (get)

HashSize

Returns the size of the computed hash.

 Public Property Get HashSize ( ) As Long

Return Values

Long - Always returns 384 bits.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: HMAC

HMAC

 Implements HMAC

Return Values

HMAC -

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: ICryptoTransform

ICryptoTransform

 Implements ICryptoTransform

Return Values

ICryptoTransform -

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: Initialize

Initialize

Resets the hashing algorithm to start again.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: InputBlockSize (get)

InputBlockSize

Returns the size of the input block size allowed.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Remarks

When calling the TransformBlock method, the InputCount must be zero or a multiple of this value.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: Key (get)

Key

Returns the key being used by the hash.

 Public Property Get Key ( ) As Byte ( )

Return Values

Byte() - The key being used.

Read/Write.

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: Key (let)

Key

Sets the key to be used by the hash.

 Public Property Let Key(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new key value.

Read/Write.

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: KeyedHashAlgorithm

KeyedHashAlgorithm

 Implements KeyedHashAlgorithm

Return Values

KeyedHashAlgorithm -

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: OutputBlockSize (get)

OutputBlockSize

Returns the output block size this transform can produce.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: TransformBlock

TransformBlock

Computes the hash for the specified block of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to compute the hash from.
InputOffset
[ByVal] Long. The starting index in the input data to compute the hash.
InputCount
[ByVal] Long. The number of bytes to compute the hash from.
OutputBuffer
[ByRef] Byte. The array to place the input buffer bytes in.
OutputOffset
[ByVal] Long. The starting index to beging copying the bytes to.

Return Values

Long - The number of bytes processed.

Remarks

The OutputBuffer will contain the same data as the InputBuffer. No hash values are placed in the OutputBuffer.

If a null array is passed in for the OutputBuffer, then nothing is copied, however, the hash is still computed on the InputBuffer data.

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA384: TransformFinalBlock

TransformFinalBlock

Processes the final data and retrieves the hash value.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The final block of data to compute the hash for.
InputOffset
[ByVal] Long. The index in the InputBuffer to begin computing data.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - Returns the section of the InputBuffer that was processed.

Remarks

This does not return the computed hash value. A copy of the data that was process is returned. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class HMACSHA384 Overview


HMACSHA512

HMACSHA512

Represents an SHA-512 implementation of the HMAC algorithm.

Implements:

HashAlgorithm
HMAC
ICryptoTransform
IObject
KeyedHashAlgorithm

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if this service provider can be reused to transfrom more data.
CanTransformMultipleBlocks (get) | Returns if this transform can operate on multiple blocks at once.
Hash (get) | Returns the computed hash.
HashName (get) | Returns the name of the hash.
HashName (let) | Sets the name of the hash.
HashSize (get) | Returns the size of the computed hash.
InputBlockSize (get) | Returns the size of the input block size allowed.
Key (get) | Returns the key being used by the hash.
Key (let) | Sets the key to be used by the hash.
OutputBlockSize (get) | Returns the output block size this transform can produce.
ProduceLegacyHmacValues (get) |
ProduceLegacyHmacValues (let) |

Methods:

Name | Description
Clear | Releases any resources.
ComputeHash | Computes a hash value for a source in a single pass.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Initialize | Resets the hashing algorithm to start again.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Computes the hash for the specified block of data.
TransformFinalBlock | Processes the final data and retrieves the hash value.

Remarks

Information about HMAC can be found at http://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf

A Hash-based Message Authentication Code can be used to determine if messages sent over insecure channels have been modified. This works by each party at boths ends sharing a secret key used to sign the sent message and to also authenticate the received message. If the key were compromised, then the authentication cannot be guaranteed.

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: CanReuseTransform (get)

CanReuseTransform

Returns if this service provider can be reused to transfrom more data.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if this transform can operate on multiple blocks at once.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: Clear

Clear

Releases any resources.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: ComputeHash

ComputeHash

Computes a hash value for a source in a single pass.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Source
[ByRef] Variant. This can be either a Byte array or any Stream compatible object.
Index
[ByRef] Optional. Variant. The starting index in the Byte array. This is ignored for Stream objects.
Count
[ByRef] Optional. Variant. The number of bytes in the array to be computed. This is ignored for Stream objects.

Return Values

Byte() - A 64-byte hash value.

Remarks

If a Stream object is passed in, then the stream is continuously read and the hash calculated until there is no more data left to read from the stream.

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the values are the same.

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: Hash (get)

Hash

Returns the computed hash.

 Public Property Get Hash ( ) As Byte ( )

Return Values

Byte() - A 64-byte array containing the hash value.

Remarks

The TransformFinalBlock must be called before accessing this property or an InvalidOperationException will be thrown.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: HashAlgorithm

HashAlgorithm

 Implements HashAlgorithm

Return Values

HashAlgorithm -

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: HashName (get)

HashName

Returns the name of the hash.

 Public Property Get HashName ( ) As String

Return Values

String - The name of the hash.

Read/Write.

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: HashName (let)

HashName

Sets the name of the hash.

 Public Property Let HashName(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The name of the hash.

Read/Write.

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: HashSize (get)

HashSize

Returns the size of the computed hash.

 Public Property Get HashSize ( ) As Long

Return Values

Long - Always returns 512 bits.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: HMAC

HMAC

 Implements HMAC

Return Values

HMAC -

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: ICryptoTransform

ICryptoTransform

 Implements ICryptoTransform

Return Values

ICryptoTransform -

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: Initialize

Initialize

Resets the hashing algorithm to start again.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: InputBlockSize (get)

InputBlockSize

Returns the size of the input block size allowed.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Remarks

When calling the TransformBlock method, the InputCount must be zero or a multiple of this value.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: Key (get)

Key

Returns the key being used by the hash.

 Public Property Get Key ( ) As Byte ( )

Return Values

Byte() - The key being used.

Read/Write.

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: Key (let)

Key

Sets the key to be used by the hash.

 Public Property Let Key(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new key value.

Read/Write.

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: KeyedHashAlgorithm

KeyedHashAlgorithm

 Implements KeyedHashAlgorithm

Return Values

KeyedHashAlgorithm -

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: OutputBlockSize (get)

OutputBlockSize

Returns the output block size this transform can produce.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Read Only.

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: TransformBlock

TransformBlock

Computes the hash for the specified block of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to compute the hash from.
InputOffset
[ByVal] Long. The starting index in the input data to compute the hash.
InputCount
[ByVal] Long. The number of bytes to compute the hash from.
OutputBuffer
[ByRef] Byte. The array to place the input buffer bytes in.
OutputOffset
[ByVal] Long. The starting index to beging copying the bytes to.

Return Values

Long - The number of bytes processed.

Remarks

The OutputBuffer will contain the same data as the InputBuffer. No hash values are placed in the OutputBuffer.

If a null array is passed in for the OutputBuffer, then nothing is copied, however, the hash is still computed on the InputBuffer data.

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACSHA512: TransformFinalBlock

TransformFinalBlock

Processes the final data and retrieves the hash value.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The final block of data to compute the hash for.
InputOffset
[ByVal] Long. The index in the InputBuffer to begin computing data.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - Returns the section of the InputBuffer that was processed.

Remarks

This does not return the computed hash value. A copy of the data that was process is returned. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class HMACSHA512 Overview


HMACStatic

HMACStatic

Provides static methods associated to the HMAC class.

Public:

Methods:

Name | Description
Create | Returns an HMAC implementation based on the algorithm name provided.

See Also

Project CorLib Overview

Class HMACStatic Overview

HMACMD5

HMACSHA1

HMACSHA256

HMACSHA384

HMACSHA512

HMACRIPEMD160


HMACStatic: Create

Create

Returns an HMAC implementation based on the algorithm name provided.

 Public Function Create(
      Optional ByVal AlgName As String = "HMACSHA1" ) As HMAC

Parameters

AlgName
[ByVal] Optional. String. The name of the HMAC implementation to create.

Default: "HMACSHA1"

Return Values

HMAC - Returns an HMAC implementation based on the algorithm.

Remarks

The default implementation is HMACSHA1 based on the SHA1 hash algorithm.

Valid algorithm names are:

 HMACSHA1
 HMACSHA256
 HMACSHA384
 HMACSHA512
 HMACMD5
 HMACRIPEMD160

If a different implementation is desired, then use the standard . naming convention.

See Also

Project CorLib Overview

Class HMACStatic Overview


IAsyncResult

IAsyncResult

Public:

Properties:

Name | Description
AsyncState (get) |
AsyncWaitHandle (get) |
CompletedSyncronously (get) |
IsCompleted (get) |

See Also

Project CorLib Overview

Class IAsyncResult Overview


ICloneable

ICloneable

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

Public:

Methods:

Name | Description
Clone | Returns an object that is a clone of this instance.

See Also

Project CorLib Overview

Class ICloneable Overview


ICloneable: Clone

Clone

Returns an object that is a clone of this instance.

 Public Function Clone ( ) As Object

Return Values

Object - The objects clone.

See Also

Project CorLib Overview

Class ICloneable Overview


ICollection

ICollection

Provides an interface to access size and enumeration capabilities of collections.

Public:

Properties:

Name | Description
Count (get) | Returns the size of the collection.

Methods:

Name | Description
CopyTo | Copies the contents of the collection to an array.
GetEnumerator | Returns an IEnumerator object.

Remarks

Custom collection classes should implement this interface to allow VBCorLib to interact with it in way necessary. Method calls that add a range will usually accept objects implementing this interface.

Classes implementing this interface should also implement the IEnumerable interface to maintain consistency with inherited interfaces. And, the author should consider implementing the NewEnum and GetEnumerator functions in the classes public interface.

See Also

Project CorLib Overview

Class ICollection Overview

IEnumerator


ICollection: CopyTo

CopyTo

Copies the contents of the collection to an array.

 Public Sub CopyTo(
      ByRef Arr As Variant,
      ByVal Index As Long )

Parameters

Arr
[ByRef] Variant. The array to copy the elements into.
Index
[ByVal] Long. The index in the destination array to start copying the elements to.

See Also

Project CorLib Overview

Class ICollection Overview


ICollection: Count (get)

Count

Returns the size of the collection.

 Public Property Get Count ( ) As Long

Return Values

Long - The size of the collection.

Read Only.

See Also

Project CorLib Overview

Class ICollection Overview


ICollection: GetEnumerator

GetEnumerator

Returns an IEnumerator object.

 Public Function GetEnumerator ( ) As IEnumerator

Return Values

IEnumerator - The enumerator.

See Also

Project CorLib Overview

Class ICollection Overview


IComparable

IComparable

Defines a generalized type-specific comparison method that a value type or class implements to order or sort its instances.

Public:

Methods:

Name | Description
CompareTo | Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

Remarks

This interface is implemented by types whose values can be ordered or sorted. It requires that implementing types define a single method, CompareTo(Value), that indicates whether the position of the current instance in the sort order is before, after, or the same as a second object of the same type. The instances IComparable implementation is called automatically by methods such as CorArray.Sort and ArrayList.Sort.

The implementation of the CompareTo(Value) method must return a 32-bit integer that has one of three values, as shown in the following table.

Value | Meaning
Less than zero | The current instance precedes the value specified by the CompareTo method in the sort order.
Zero | This current instance occurs in the same position in the sort order as the value specified by the CompareTo method.
Greater than zero | This current instance follows the object specified by the CompareTo method in the sort order.

All number types (such as Long and Double) are supported by the default Comparer, as are String and Date. Custom types should also provide their own implementation of IComparable to enable object instances to be ordered or sorted.

Example

The following example illustrates the implementation of IComparable and the requisite CompareTo method.

There are two modules created for this example. A BAS module containing the Main method and a Class module implementing the IComparable interface.

The following is a Visual Basic Class module named Temperature.

Option Explicit
Implements IComparable

Private mTemperatureF As Double

Public Function CompareTo(ByRef Value As Variant) As Long
    Dim Other As Temperature

    On Error GoTo Catch
    Set Other = Value

    If Other Is Nothing Then
        CompareTo = 1
    Else
        CompareTo = Comparer.Default.Compare(mTemperatureF, Other.Fahrenheit)
    End If
    Exit Function

Catch:
    Throw NewArgumentException("Value is not a Temperature")
End Function

Public Property Get Fahrenheit() As Double
    Fahrenheit = mTemperatureF
End Property

Public Property Let Fahrenheit(ByVal Value As Double)
    mTemperatureF = Value
End Property

Public Property Get Celsius() As Double
    Celsius = (mTemperatureF - 32) * (5# / 9#)
End Property

Public Property Let Celsius(ByVal Value As Double)
    mTemperatureF = (Value * 9# / 5#) + 32
End Property

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IComparable
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IComparable_CompareTo(Value As Variant) As Long
    IComparable_CompareTo = CompareTo(Value)
End Function

The following is a Visual Basic BAS module containing Main start-up method.

Public Sub Main()
    Dim Temperatures As New ArrayList
    Dim r As New Random
    Dim i As Long
    Dim Degrees As Double
    Dim Temp As Temperature

    For i = 1 To 10
        Degrees = r.NextRange(0, 100)
        Set Temp = New Temperature
        Temp.Fahrenheit = Degrees
        Temperatures.Add Temp
    Next

    Temperatures.Sort

    For Each Temp In Temperatures
        Debug.Print Temp.Fahrenheit
    Next
End Sub

' This code produces the following output (individual values may vary because they are randomly generated):
'
'    13
'    18
'    31
'    36
'    65
'    65
'    66
'    78
'    92
'    98

See Also

Project CorLib Overview

Class IComparable Overview


IComparable: CompareTo

CompareTo

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

 Public Function CompareTo(
      ByRef Value As Variant ) As Long

Parameters

Value
[ByRef] Variant. A value to compare with this instance.

Return Values

Long - A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value | Meaning
Less than zero | The current instance precedes the value specified by the CompareTo method in the sort order.
Zero | This current instance occurs in the same position in the sort order as the value specified by the CompareTo method.
Greater than zero | This current instance follows the object specified by the CompareTo method in the sort order.

Remarks

The CompareTo method is implemented by types whose values can be ordered or sorted. It is called automatically by methods of collection objects, such as CorArray.Sort, to order each member of the array. If a custom class does not implement IComparable, its members cannot be ordered and the sort operation can throw an InvalidOperationException.

This method is only a definition and must be implemented by a specific class or value type to have effect. The meaning of the comparisons specified in the Return Value section ("precedes", "occurs in the same position as", and "follows") depends on the particular implementation.

By definition, any object compares greater than (or follows) Nothing, and two Nothing references compare equal to each other.

The parameter, Value, must be the same type as the class or value type that implements this interface; otherwise, an ArgumentException is thrown.

Exceptions

Exception | Condition
ArgumentException | Value is not of the same type as this instance.

Examples

The following example illustrates the use of CompareTo to compare a Temperature object implementing IComparable with another object. The Temperature object implements CompareTo by simply wrapping a call to the Comparer.Default.Compare method.

There are two modules created for this example. A BAS module containing the Main method and a Class module implementing the IComparable interface.

The following is a Visual Basic Class module named Temperature.

Option Explicit
Implements IComparable

Private mTemperatureF As Double

Public Function CompareTo(ByRef Value As Variant) As Long
    Dim Other As Temperature

    On Error GoTo Catch
    Set Other = Value

    If Other Is Nothing Then
        CompareTo = 1
    Else
        CompareTo = Comparer.Default.Compare(mTemperatureF, Other.Fahrenheit)
    End If
    Exit Function

Catch:
    Throw NewArgumentException("Value is not a Temperature")
End Function

Public Property Get Fahrenheit() As Double
    Fahrenheit = mTemperatureF
End Property

Public Property Let Fahrenheit(ByVal Value As Double)
    mTemperatureF = Value
End Property

Public Property Get Celsius() As Double
    Celsius = (mTemperatureF - 32) * (5# / 9#)
End Property

Public Property Let Celsius(ByVal Value As Double)
    mTemperatureF = (Value * 9# / 5#) + 32
End Property

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IComparable
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IComparable_CompareTo(Value As Variant) As Long
    IComparable_CompareTo = CompareTo(Value)
End Function

The following is a Visual Basic BAS module containing Main start-up method.

Public Sub Main()
    Dim Temperatures As New ArrayList
    Dim r As New Random
    Dim i As Long
    Dim Degrees As Double
    Dim Temp As Temperature

    For i = 1 To 10
        Degrees = r.NextRange(0, 100)
        Set Temp = New Temperature
        Temp.Fahrenheit = Degrees
        Temperatures.Add Temp
    Next

    Temperatures.Sort

    For Each Temp In Temperatures
        Debug.Print Temp.Fahrenheit
    Next
End Sub

' This code produces the following output (individual values may vary because they are randomly generated):
'
'    13
'    18
'    31
'    36
'    65
'    65
'    66
'    78
'    92
'    98

See Also

Project CorLib Overview

Class IComparable Overview


IComparer

IComparer

Exposes a method that compares two values.

Public:

Methods:

Name | Description
Compare | Compares two values and returns a value indicating whether one is less than, equal to, or greater than the other.

Remarks

This interface is used in conjunction with the CorArray.Sort and CorArray.BinarySearch methods. It provides a way to customize the sort order of a collection. See the Compare method for notes on parameters and return value.

The default implementation of this interface is the Comparer class.

Examples

The following code example demonstrates the use of the IComparer interface to sort an ArrayList object. In this example, the IComparer interface is implemented using the CaseInsensitiveComparer class to reverse the order of the contents of the ArrayList.

There are two modules created for this example. A BAS module containing the Main method and a Class module implementing the IComparer interface.

The following is a Visual Basic Class module named MyReverserClass.

Option Explicit
Implements IComparer

Private mComparer As New CaseInsensitiveComparer

Public Function Compare(ByRef a As Variant, ByRef b As Variant) As Long
    Compare = mComparer.Compare(b, a)
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IComparer
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IComparer_Compare(a As Variant, b As Variant) As Long
    IComparer_Compare = Compare(a, b)
End Function

The following is a Visual Basic BAS module containing Main start-up method.

Public Sub Main()
    Dim List As New ArrayList

    List.Add "The"
    List.Add "quick"
    List.Add "brown"
    List.Add "fox"
    List.Add "jumps"
    List.Add "over"
    List.Add "the"
    List.Add "lazy"
    List.Add "dog"

    Debug.Print "The ArrayList initially contains the following values:"
    PrintIndexAndValues List

    List.Sort
    Debug.Print "After sorting with the default comparer:"
    PrintIndexAndValues List

    List.Sort Comparer:=New MyReverserClass
    Debug.Print "After sorting with the reverse case-insensitive comparer:"
    PrintIndexAndValues List
End Sub

Private Sub PrintIndexAndValues(ByVal List As ArrayList)
    Dim i As Long

    For i = 0 To List.Count - 1
        Debug.Print CorString.Format(t("\t[{0}]:\t{1}"), i, List(i))
    Next

    Debug.Print
End Sub

' This code produces the following output.
'
'  The ArrayList initially contains the following values:
'      [0]:    The
'      [1]:    quick
'      [2]:    brown
'      [3]:    fox
'      [4]:    jumps
'      [5]:    over
'      [6]:    the
'      [7]:    lazy
'      [8]:    dog
'
'  After sorting with the default comparer:
'      [0]:    brown
'      [1]:    dog
'      [2]:    fox
'      [3]:    jumps
'      [4]:    lazy
'      [5]:    over
'      [6]:    quick
'      [7]:    the
'      [8]:    The
'
'  After sorting with the reverse case-insensitive comparer:
'      [0]:    the
'      [1]:    The
'      [2]:    quick
'      [3]:    over
'      [4]:    lazy
'      [5]:    jumps
'      [6]:    fox
'      [7]:    dog
'      [8]:    brown

See Also

Project CorLib Overview

Class IComparer Overview

Comparer


IComparer: Compare

Compare

Compares two values and returns a value indicating whether one is less than, equal to, or greater than the other.

 Public Function Compare(
      ByRef a As Variant,
      ByRef b As Variant ) As Long

Parameters

a
[ByRef] Variant. The first value to compare.
b
[ByRef] Variant. The second value to compare.

Return Values

Long - A signed integer that indicates the relative values of a and b, as shown in the following table.
Value | Meaning
Less than zero | a is less than b.
Zero | a equals b.
Greater than zero | a is greater than b.

Remarks

Comparing Null with any type is allowed and does not generate an exception when using IComparable. When sorting, Null is considered to be less than any other value.

Exceptions

Exception | Condition
ArgumentException | Neither a nor b implements the IComparable interface. -or- a and b are of different types and cannot be compared.

Examples

The following code example demonstrates the use of the IComparer interface to sort an ArrayList object. In this example, the IComparer interface is implemented using the CaseInsensitiveComparer class to reverse the order of the contents of the ArrayList.

There are two modules created for this example. A BAS module containing the Main method and a Class module implementing the IComparer interface.

The following is a Visual Basic Class module named MyReverserClass.

Option Explicit
Implements IComparer

Private mComparer As New CaseInsensitiveComparer

Public Function Compare(ByRef a As Variant, ByRef b As Variant) As Long
    Compare = mComparer.Compare(b, a)
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IComparer
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IComparer_Compare(a As Variant, b As Variant) As Long
    IComparer_Compare = Compare(a, b)
End Function

The following is a Visual Basic BAS module containing Main start-up method.

Public Sub Main()
    Dim List As New ArrayList

    List.Add "The"
    List.Add "quick"
    List.Add "brown"
    List.Add "fox"
    List.Add "jumps"
    List.Add "over"
    List.Add "the"
    List.Add "lazy"
    List.Add "dog"

    Debug.Print "The ArrayList initially contains the following values:"
    PrintIndexAndValues List

    List.Sort
    Debug.Print "After sorting with the default comparer:"
    PrintIndexAndValues List

    List.Sort Comparer:=New MyReverserClass
    Debug.Print "After sorting with the reverse case-insensitive comparer:"
    PrintIndexAndValues List
End Sub

Private Sub PrintIndexAndValues(ByVal List As ArrayList)
    Dim i As Long

    For i = 0 To List.Count - 1
        Debug.Print CorString.Format(t("\t[{0}]:\t{1}"), i, List(i))
    Next

    Debug.Print
End Sub

' This code produces the following output.
'
'  The ArrayList initially contains the following values:
'      [0]:    The
'      [1]:    quick
'      [2]:    brown
'      [3]:    fox
'      [4]:    jumps
'      [5]:    over
'      [6]:    the
'      [7]:    lazy
'      [8]:    dog
'
'  After sorting with the default comparer:
'      [0]:    brown
'      [1]:    dog
'      [2]:    fox
'      [3]:    jumps
'      [4]:    lazy
'      [5]:    over
'      [6]:    quick
'      [7]:    the
'      [8]:    The
'
'  After sorting with the reverse case-insensitive comparer:
'      [0]:    the
'      [1]:    The
'      [2]:    quick
'      [3]:    over
'      [4]:    lazy
'      [5]:    jumps
'      [6]:    fox
'      [7]:    dog
'      [8]:    brown

See Also

Project CorLib Overview

Class IComparer Overview

IComparable


IconResourceDecoder

IconResourceDecoder

Decodes an icon from a .RES formatted byte array.

Implements:

IResourceDecoder

Public:

Methods:

Name | Description
Decode | Decodes a byte array into a StdPicture that represents an icon.
GetDecodeType | Returns the type of resource this decoder supports.
GetResource | Returns the next available resource in the decoder.

Remarks

This takes a byte array formatted like that in a .RES file and extracts the Icon picture.

See Also

Project CorLib Overview

Class IconResourceDecoder Overview

ResourceReader

WinResourceReader


IconResourceDecoder: Decode

Decode

Decodes a byte array into a StdPicture that represents an icon.

 Public Function Decode(
      ByVal Key As ResourceKey,
      ByRef Bytes ( ) As Byte ) As Long

Parameters

Key
[ByVal] ResourceKey. The identifier for the icon.
Bytes
[ByRef] Byte. The bytes to be decoded into an icon.

Return Values

Long - The number of icons decoded. This will return 0 or 1.

See Also

Project CorLib Overview

Class IconResourceDecoder Overview


IconResourceDecoder: GetDecodeType

GetDecodeType

Returns the type of resource this decoder supports.

 Public Function GetDecodeType ( ) As Variant

Return Values

Variant - This decoder returns ResourceTypes.IconResource.

See Also

Project CorLib Overview

Class IconResourceDecoder Overview

ResourceTypes


IconResourceDecoder: GetResource

GetResource

Returns the next available resource in the decoder.

 Public Function GetResource(
      ByRef ReturnKey As ResourceKey,
      ByRef ReturnValue As Variant ) As Boolean

Parameters

ReturnKey
[ByRef] ResourceKey. This is set to the key that identifies the resource being returned.
ReturnValue
[ByRef] Variant. This is set to the resource value being returned.

Return Values

Boolean - If a resource has been returned, this returns True, otherwise False is returned.

Remarks

Once a resource has been returned, that resource is never returned again.

See Also

Project CorLib Overview

Class IconResourceDecoder Overview


IconResourceDecoder: IResourceDecoder

IResourceDecoder

 Implements IResourceDecoder

Return Values

IResourceDecoder -

See Also

Project CorLib Overview

Class IconResourceDecoder Overview


IconResourceEncoder

IconResourceEncoder

Encodes the StdPicture icon.

Implements:

IResourceEncoder

Public:

Methods:

Name | Description
Encode |
GetEncodedResource | Retrieves the next encoded resource in the encoder.
Reset | Releases all currently encoded values.

Remarks

Any value can be passed in. No exception is thrown. If the value is not a bitmap then the function returns False.

The ResourceName can be a String or a Numeric value.

The LanguageID can be a CultureInfo object, a culture name, or an LCID. If the LanguageID is not supplied, then the current culture is used.

See Also

Project CorLib Overview

Class IconResourceEncoder Overview


IconResourceEncoder: GetEncodedResource

GetEncodedResource

Retrieves the next encoded resource in the encoder.

 Public Function GetEncodedResource(
      ByRef ReturnKey As ResourceKey,
      ByRef ReturnValue ( ) As Byte ) As Boolean

Parameters

ReturnKey
[ByRef] ResourceKey. This is set to a ResourceKey object that uniquely identify the encoded resource.
ReturnValue
[ByRef] Byte. This will be set to a byte array.

Return Values

Boolean - Returns True if an encoded resource was returned, False otherwise.

Remarks

This function can be called multiple times to retrieve multiple resources. As long as a resource is returned, True will be returned, otherwise False will be returned.

See Also

Project CorLib Overview

Class IconResourceEncoder Overview


IconResourceEncoder: IResourceEncoder

IResourceEncoder

 Implements IResourceEncoder

Return Values

IResourceEncoder -

See Also

Project CorLib Overview

Class IconResourceEncoder Overview


IconResourceEncoder: Reset

Reset

Releases all currently encoded values.

 Public Sub Reset ( )

See Also

Project CorLib Overview

Class IconResourceEncoder Overview


IconResourceGroupDecoder

IconResourceGroupDecoder

Decodes an IconGroup resource.

Implements:

IResourceDecoder

Public:

Methods:

Name | Description
Decode | Decodes a byte array into a PictureResourceGroup that represents an icon group.
GetDecodeType | Returns the type of resource this decoder supports.
GetResource | Returns the next available resource in the decoder.

Remarks

This returns a ResPictureGroup object when decoded.

See Also

Project CorLib Overview

Class IconResourceGroupDecoder Overview

ResourceReader

WinResourceReader


IconResourceGroupDecoder: Decode

Decode

Decodes a byte array into a PictureResourceGroup that represents an icon group.

 Public Function Decode(
      ByVal Key As ResourceKey,
      ByRef Bytes ( ) As Byte ) As Long

Parameters

Key
[ByVal] ResourceKey. The identifier for the icon group.
Bytes
[ByRef] Byte. The bytes to be decoded into an icon group.

Return Values

Long - The number of groups decoded. This will return 0 or 1.

See Also

Project CorLib Overview

Class IconResourceGroupDecoder Overview


IconResourceGroupDecoder: GetDecodeType

GetDecodeType

Returns the type of resource this decoder supports.

 Public Function GetDecodeType ( ) As Variant

Return Values

Variant - This decoder returns ResourceTypes.GroupIcon.

See Also

Project CorLib Overview

Class IconResourceGroupDecoder Overview

ResourceTypes


IconResourceGroupDecoder: GetResource

GetResource

Returns the next available resource in the decoder.

 Public Function GetResource(
      ByRef ReturnKey As ResourceKey,
      ByRef ReturnValue As Variant ) As Boolean

Parameters

ReturnKey
[ByRef] ResourceKey. This is set to the key that identifies the resource being returned.
ReturnValue
[ByRef] Variant. This is set to the resource value being returned.

Return Values

Boolean - If a resource has been returned, this returns True, otherwise False is returned.

Remarks

Once a resource has been returned, that resource is never returned again.

See Also

Project CorLib Overview

Class IconResourceGroupDecoder Overview


IconResourceGroupDecoder: IResourceDecoder

IResourceDecoder

 Implements IResourceDecoder

Return Values

IResourceDecoder -

See Also

Project CorLib Overview

Class IconResourceGroupDecoder Overview


IconResourceGroupEncoder

IconResourceGroupEncoder

Encodes a PictureResourceGroup object to a .RES byte array.

Implements:

IResourceEncoder

Public:

Methods:

Name | Description
Encode | Encodes a PictureResourceGroup object.
GetEncodedResource | Retrieves the next encoded resource in the encoder.
Reset | Releases all currently encoded values.

See Also

Project CorLib Overview

Class IconResourceGroupEncoder Overview

ResourceWriter


IconResourceGroupEncoder: Encode

Encode

Encodes a PictureResourceGroup object.

 Public Function Encode(
      ByRef Value As Variant,
      ByRef ResourceName As Variant,
      Optional ByRef ResourceType As Variant,
      Optional ByRef LanguageID As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The PictureResourceGroup to be encodes.
ResourceName
[ByRef] Variant. The identifier for the resource value. This can be a String or Number.
ResourceType
[ByRef] Optional. Variant. Identifies the type of resource this is. This value is ignored by this encoder.
LanguageID
[ByRef] Optional. Variant. The LocaleID the value is associated with.

Return Values

Boolean - Returns True if the encoder was able to encode the value, False otherwise.

Remarks

Any value can be passed in. No exception is thrown. If the value is not a bitmap then the function returns False.

The ResourceName can be a String or a Numeric value.

The LanguageID can be a CultureInfo object, a culture name, or an LCID. If the LanguageID is not supplied, then the current culture is used.

See Also

Project CorLib Overview

Class IconResourceGroupEncoder Overview


IconResourceGroupEncoder: GetEncodedResource

GetEncodedResource

Retrieves the next encoded resource in the encoder.

 Public Function GetEncodedResource(
      ByRef ReturnKey As ResourceKey,
      ByRef ReturnValue ( ) As Byte ) As Boolean

Parameters

ReturnKey
[ByRef] ResourceKey. This is set to a ResourceKey object that uniquely identify the encoded resource.
ReturnValue
[ByRef] Byte. This will be set to a byte array.

Return Values

Boolean - Returns True if an encoded resource was returned, False otherwise.

Remarks

This function can be called multiple times to retrieve multiple resources. As long as a resource is returned, True will be returned, otherwise False will be returned.

See Also

Project CorLib Overview

Class IconResourceGroupEncoder Overview


IconResourceGroupEncoder: IResourceEncoder

IResourceEncoder

 Implements IResourceEncoder

Return Values

IResourceEncoder -

See Also

Project CorLib Overview

Class IconResourceGroupEncoder Overview


IconResourceGroupEncoder: Reset

Reset

Releases all currently encoded values.

 Public Sub Reset ( )

See Also

Project CorLib Overview

Class IconResourceGroupEncoder Overview


ICryptoTransform

ICryptoTransform

A common interface implemented by all crypto transform classes.

Public:

Properties:

Name | Description
CanReuseTransform (get) | Represents if the transform can be reused to start transorming a new set of data.
CanTransformMultipleBlocks (get) | Returns if a transform can transform multiple blocks in a single call.
InputBlockSize (get) | The size of the block of plain text that is to be tranformed.
OutputBlockSize (get) | The size of the block of ciphered text after tranformation occurred.

Methods:

Name | Description
TransformBlock | Transforms a block of plain text data, placing the ciphered text in the output buffer.
TransformFinalBlock | Transforms the last of the data, adding any padding as needed.

See Also

Project CorLib Overview

Class ICryptoTransform Overview

CryptoAPITransform

RijndaelManagedTransform

HMAC

HMACSHA1

HMACSHA256

HMACSHA384

HMACSHA512

HMACMD5

HMACRIPEMD160


ICryptoTransform: CanReuseTransform (get)

CanReuseTransform

Represents if the transform can be reused to start transorming a new set of data.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Returns True if the transform can be reused, False otherwise.

Remarks

When a transform has finished the final transformation, it may support starting over to begin tranforming a new set of data.

Read Only.

See Also

Project CorLib Overview

Class ICryptoTransform Overview


ICryptoTransform: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if a transform can transform multiple blocks in a single call.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Returns True if multiple blocks can be transformed, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class ICryptoTransform Overview


ICryptoTransform: InputBlockSize (get)

InputBlockSize

The size of the block of plain text that is to be tranformed.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Returns the size of plain text in bytes to be transformed.

Read Only.

See Also

Project CorLib Overview

Class ICryptoTransform Overview


ICryptoTransform: OutputBlockSize (get)

OutputBlockSize

The size of the block of ciphered text after tranformation occurred.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Returns the size of the ciphered text in bytes.

Read Only.

See Also

Project CorLib Overview

Class ICryptoTransform Overview


ICryptoTransform: TransformBlock

TransformBlock

Transforms a block of plain text data, placing the ciphered text in the output buffer.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The plain text to be transformed.
InputOffset
[ByVal] Long. The starting index to begin transforming.
InputCount
[ByVal] Long. The number of bytes to be processed.
OutputBuffer
[ByRef] Byte. The array to place the transformed data.
OutputOffset
[ByVal] Long. The starting index to begin placing the transformed data.

Return Values

Long - The number of byte actually placed in the output buffer during this call.

See Also

Project CorLib Overview

Class ICryptoTransform Overview


ICryptoTransform: TransformFinalBlock

TransformFinalBlock

Transforms the last of the data, adding any padding as needed.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( ) :

Parameters

InputBuffer
[ByRef] Byte. The plain text buffer to process.
InputOffset
[ByVal] Long. The starting index of the data to be processed.
InputCount
[ByVal] Long. The amount of data to be processed.

Return Values

Byte() - The final array of processed data.

See Also

Project CorLib Overview

Class ICryptoTransform Overview


ICspAsymmetricAlgorithm

ICspAsymmetricAlgorithm

Provices methods to allow access to Key container information and Crypto API blob import/export ability for Asymmetric algorithmes.

Public:

Properties:

Name | Description
CspKeyContainerInfo (get) | Returns a key container object holding information about an Asymmetric algorithm.

Methods:

Name | Description
ExportCspBlob | Returns a Crypto API blob from the Asymmetric algorithm.
ImportCspBlob | Imports a Crypto API blob to be used by the Asymmetric algorithm.

Remarks

This interface provides a common set of methods used to retrieve information about an Asymmetric algorithms key container and provides the ability to import and export Byte arrays represetning Crypto API blobs used by Microsoft Cryptography Service Providers.

See Also

Project CorLib Overview

Class ICspAsymmetricAlgorithm Overview

RSACryptoServiceProvider

DSACryptoServiceProvider


ICspAsymmetricAlgorithm: CspKeyContainerInfo (get)

CspKeyContainerInfo

Returns a key container object holding information about an Asymmetric algorithm.

 Public Property Get CspKeyContainerInfo ( ) As CspKeyContainerInfo

Return Values

CspKeyContainerInfo - A CspKeyContainerInfo object.

Read Only.

See Also

Project CorLib Overview

Class ICspAsymmetricAlgorithm Overview


ICspAsymmetricAlgorithm: ExportCspBlob

ExportCspBlob

Returns a Crypto API blob from the Asymmetric algorithm.

 Public Function ExportCspBlob(
      ByVal IncludePrivateParameters As Boolean ) As Byte ( ) :

Parameters

IncludePrivateParameters
[ByVal] Boolean. A flag indicating if the Blob should contain information considered private and sensative. The private information is usually information required to encrypt or sign data.

Return Values

Byte() - A Byte array containing the Crypto API blob information.

See Also

Project CorLib Overview

Class ICspAsymmetricAlgorithm Overview


ICspAsymmetricAlgorithm: ImportCspBlob

ImportCspBlob

Imports a Crypto API blob to be used by the Asymmetric algorithm.

 Public Sub ImportCspBlob(
      ByRef RawData ( ) As Byte )

Parameters

RawData
[ByRef] Byte. The Byte array representing the Crypto API blob.

See Also

Project CorLib Overview

Class ICspAsymmetricAlgorithm Overview


ICustomFormatter

ICustomFormatter

The ICustomFormatter interface is used to allow user-defined classes to be the formatting service for values.

Public:

Methods:

Name | Description
Format | Returns a formatted value from a custom formatter.

See Also

Project CorLib Overview

Class ICustomFormatter Overview


ICustomFormatter: Format

Format

Returns a formatted value from a custom formatter.

 Public Function Format(
      ByVal FormatText As String,
      ByRef Arg As Variant,
      ByVal Provider As IFormatProvider ) As String

Parameters

FormatText
[ByVal] String. The formatting information provided.
Arg
[ByRef] Variant. The value to be formatted.
Provider
[ByVal] IFormatProvider. A provider that may have formatting capabilities.

Return Values

String - A formatted value.

See Also

Project CorLib Overview

Class ICustomFormatter Overview


IDictionary

IDictionary

This provides a standard interface to be impelments by key-value list collection.

Public:

Properties:

Name | Description
Count (get) | Returns the size of the collection.
IsFixedSize (get) | Returns if this instance is fixed-size.
IsReadOnly (get) | Returns if this instance is read-only.
Item (get) | Returns an item from the list that is associated with the specified key.
Item (let) | Sets the value in the list that is associated to the specified key.
Item (set) | Sets the value in the list that is associated to the specified key.
Keys (get) | Returns a collection of the keys in the list.
Values (get) | Returns a collection of the values in the list.

Methods:

Name | Description
Add | Adds a new value that is associated with the key to the list.
Clear | Clears the list of its contents.
Contains | Searches for the existence of the key in the list.
CopyTo | Copies the contents of the collection to an array.
GetEnumerator | Returns an IDictionaryEnumerator object.
Remove | Removes a value from the list that is associated to the key.

Remarks

Lists that maintain a key-value pair should implement this interface to allow cross-compatibility usage amongst all key-value pair lists.

See Also

Project CorLib Overview

Class IDictionary Overview


IDictionary: Add

Add

Adds a new value that is associated with the key to the list.

 Public Sub Add(
      ByRef Key As Variant,
      ByRef Value As Variant )

Parameters

Key
[ByRef] Variant. The new key used to locate the value.
Value
[ByRef] Variant. The value to be associated with the key.

See Also

Project CorLib Overview

Class IDictionary Overview


IDictionary: Clear

Clear

Clears the list of its contents.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class IDictionary Overview


IDictionary: Contains

Contains

Searches for the existence of the key in the list.

 Public Function Contains(
      ByRef Key As Variant ) As Boolean

Parameters

Key
[ByRef] Variant. The key to be searching for.

Return Values

Boolean - Indication of the existence of the key.

See Also

Project CorLib Overview

Class IDictionary Overview


IDictionary: CopyTo

CopyTo

Copies the contents of the collection to an array.

 Public Sub CopyTo(
      ByRef Arr As Variant,
      ByVal Index As Long )

Parameters

Arr
[ByRef] Variant. The array to copy the elements into.
Index
[ByVal] Long. The index in the destination array to start copying the elements to.

See Also

Project CorLib Overview

Class IDictionary Overview


IDictionary: Count (get)

Count

Returns the size of the collection.

 Public Property Get Count ( ) As Long

Return Values

Long - The size of the collection.

Read Only.

See Also

Project CorLib Overview

Class IDictionary Overview


IDictionary: GetEnumerator

GetEnumerator

Returns an IDictionaryEnumerator object.

 Public Function GetEnumerator ( ) As IDictionaryEnumerator

Return Values

IDictionaryEnumerator - The enumerator.

See Also

Project CorLib Overview

Class IDictionary Overview


IDictionary: IsFixedSize (get)

IsFixedSize

Returns if this instance is fixed-size.

 Public Property Get IsFixedSize ( ) As Boolean

Return Values

Boolean - Indication if is a fixid-size dictionary list.

Remarks

A FixedSize list can still have items replaced by new values, only now values can be added or removed.

Read Only.

See Also

Project CorLib Overview

Class IDictionary Overview


IDictionary: IsReadOnly (get)

IsReadOnly

Returns if this instance is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - An indication if this instance is read-only.

Remarks

A ReadOnly list can only retrieve items from the list. The list cannot change, add, or remove items.

Read Only.

See Also

Project CorLib Overview

Class IDictionary Overview


IDictionary: Item (get)

Item

Returns an item from the list that is associated with the specified key.

 Public Property Get Item(
      ByRef Key As Variant ) As Variant

Parameters

Key
[ByRef] Variant. The key to search for in the list.

Return Values

Variant - The value that is associated to the key.

Read/Write.

See Also

Project CorLib Overview

Class IDictionary Overview


IDictionary: Item (let)

Item

Sets the value in the list that is associated to the specified key.

 Public Property Let Item(
      ByRef Key As Variant,
      ByRef Value As Variant ) :

Parameters

Key
[ByRef] Variant. The key used to identify the value.
Value
[ByRef] Variant. The value to associate with the key.

Read/Write.

See Also

Project CorLib Overview

Class IDictionary Overview


IDictionary: Item (set)

Item

Sets the value in the list that is associated to the specified key.

 Public Property Set Item(
      ByRef Key As Variant,
      ByRef Value As Variant ) :

Parameters

Key
[ByRef] Variant. The key used to identify the value.
Value
[ByRef] Variant. The value to associate with the key.

Read/Write.

See Also

Project CorLib Overview

Class IDictionary Overview


IDictionary: Keys (get)

Keys

Returns a collection of the keys in the list.

 Public Property Get Keys ( ) As ICollection

Return Values

ICollection - A collection of the keys in the list.

Read Only.

See Also

Project CorLib Overview

Class IDictionary Overview


IDictionary: Remove

Remove

Removes a value from the list that is associated to the key.

 Public Sub Remove(
      ByRef Key As Variant )

Parameters

Key
[ByRef] Variant. The key to search for to be removed.

See Also

Project CorLib Overview

Class IDictionary Overview


IDictionary: Values (get)

Values

Returns a collection of the values in the list.

 Public Property Get Values ( ) As ICollection

Return Values

ICollection - A collection of the values in the list.

Read Only.

See Also

Project CorLib Overview

Class IDictionary Overview


IDictionaryEnumerator

IDictionaryEnumerator

An interface used to enumerate a dictionary style collections (Hashtable.)

Public:

Types:

Name | Description
EnumerationType |
IDictionaryEnumType |

Properties:

Name | Description
Current (get) | Returns a DictionaryEntry object for the current location in the collection.
Entry (get) | Returns a DictionaryEntry object for the current location in the collection.
Key (get) | Returns the key portion of the current DictionaryEntry.
Value (get) | Returns the value portion of the current DictionaryEntry.

Methods:

Name | Description
MoveNext | Moves the enumerator pointer to the next element in the collection.
Reset | Resets the enumerator to the beginning of the collection.

See Also

Project CorLib Overview

Class IDictionaryEnumerator Overview


IDictionaryEnumerator: Current (get)

Current

Returns a DictionaryEntry object for the current location in the collection.

 Public Property Get Current ( ) As Variant

Return Values

Variant - A DictionaryEntry containing key-value pairs.

Read Only.

See Also

Project CorLib Overview

Class IDictionaryEnumerator Overview


IDictionaryEnumerator: Entry (get)

Entry

Returns a DictionaryEntry object for the current location in the collection.

 Public Property Get Entry ( ) As DictionaryEntry

Return Values

DictionaryEntry - A DictionaryEntry containing key-value pairs.

Read Only.

See Also

Project CorLib Overview

Class IDictionaryEnumerator Overview


IDictionaryEnumerator: Key (get)

Key

Returns the key portion of the current DictionaryEntry.

 Public Property Get Key ( ) As Variant

Return Values

Variant - The key of the current collection entry.

Read Only.

See Also

Project CorLib Overview

Class IDictionaryEnumerator Overview


IDictionaryEnumerator: MoveNext

MoveNext

Moves the enumerator pointer to the next element in the collection.

 Public Function MoveNext ( ) As Boolean

Return Values

Boolean - An indication of the success of the movement.

See Also

Project CorLib Overview

Class IDictionaryEnumerator Overview


IDictionaryEnumerator: Reset

Reset

Resets the enumerator to the beginning of the collection.

 Public Sub Reset ( )

See Also

Project CorLib Overview

Class IDictionaryEnumerator Overview


IDictionaryEnumerator: Value (get)

Value

Returns the value portion of the current DictionaryEntry.

 Public Property Get Value ( ) As Variant

Return Values

Variant - The value of the current collection entry.

Read Only.

See Also

Project CorLib Overview

Class IDictionaryEnumerator Overview


IEnumerable

IEnumerable

An interface that can be used to get an enumerator for an object.

Public:

Methods:

Name | Description
GetEnumerator | Returns an enumerator that iterates through a collection.

Remarks

Implement this interface for general cases where only an enumerator is needed.

Examples

The following example demonstrates an implementation of the IEnumerable and IEnumerator interfaces by creating a simple container class with an associated enumerator.

The example consists of three files. Two of the files are classes named Container and ContainerEnumerator. There is also one BAS file that contains the Main method.

The Container class implementation.
Option Explicit
Implements IEnumerable

Private mItems() As Variant
Private mCount As Long

Public Property Get Count() As Long
    Count = mCount
End Property

Public Sub Add(ByRef Value As Variant)
    If mCount > UBound(mItems) Then
        ReDim Preserve mItems(0 To UBound(mItems) * 2)
    End If

    CopyVariant mItems(mCount), Value
    mCount = mCount + 1
End Sub

Public Property Get Item(ByVal Index As Long) As Variant
    CopyVariant Item, mItems(Index)
End Property

Public Function GetEnumerator() As IEnumerator
    Dim En As New ContainerEnumerator

    En.Init Me
    Set GetEnumerator = En
End Function

Public Function NewEnum() As IUnknown
    Set NewEnum = CreateEnumerator(GetEnumerator)
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   Constructors
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub Class_Initialize()
    ReDim mItems(4)
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IEnumerable
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IEnumerable_GetEnumerator() As CorLib.IEnumerator
    Set IEnumerable_GetEnumerator = GetEnumerator
End Function

Private Function IEnumerable_NewEnum() As stdole.IUnknown
    Set IEnumerable_NewEnum = NewEnum
End Function

The ContainerEnumerator class implementation.
Option Explicit
Implements IEnumerator

Private mBase As EnumeratorBase
Private mContainer As Container

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   Constructors
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Sub Init(ByVal Container As Container)
    Set mBase = NewEnumeratorBase(0, Container.Count)
    Set mContainer = Container
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IEnumerator
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Property Get IEnumerator_Current() As Variant
    MoveVariant IEnumerator_Current, mContainer.Item(mBase.Index)
End Property

Private Function IEnumerator_MoveNext() As Boolean
    IEnumerator_MoveNext = mBase.MoveNext
End Function

Private Sub IEnumerator_Reset()
    mBase.Reset
End Sub

The Main method implemented in a BAS module.
Public Sub Main()
    Dim Items As New Container

    Items.Add "The"
    Items.Add "fox"
    Items.Add "jumps"
    Items.Add "over"
    Items.Add "the"
    Items.Add "lazy"
    Items.Add "dog."

    Debug.Print "Enumerate using 'For Each'."
    EnumerateWithForEach Items

    Debug.Print t("\nEnumerate using 'IEnumerator' interface.")
    EnumerateWithEnumerator Items
End Sub

Private Sub EnumerateWithForEach(ByVal Source As IEnumerable)
    Dim Value As Variant

    Debug.Print "   ";

    For Each Value In Source
        Debug.Print Value & " ";
    Next

    Debug.Print
End Sub

Private Sub EnumerateWithEnumerator(ByVal Source As IEnumerable)
    Dim En As IEnumerator

    Debug.Print "   ";

    Set En = Source.GetEnumerator

    Do While En.MoveNext
        Debug.Print En.Current & " ";
    Loop

    Debug.Print
End Sub

' The example code produces the following output.
'
'    Enumerate using 'For Each'.
'       The fox jumps over the lazy dog.
'
'    Enumerate using 'IEnumerator' interface.
'       The fox jumps over the lazy dog.

See Also

Project CorLib Overview

Class IEnumerable Overview


IEnumerable: GetEnumerator

GetEnumerator

Returns an enumerator that iterates through a collection.

 Public Function GetEnumerator ( ) As IEnumerator

Return Values

IEnumerator - An IEnumerator object that can be used to iterate through the collection.

See Also

Project CorLib Overview

Class IEnumerable Overview


IEnumerator

IEnumerator

Supports a simple iteration over a collection.

Public:

Properties:

Name | Description
Current (get) | Gets the current element in the collection.

Methods:

Name | Description
MoveNext | Advances the enumerator to the next element of the collection.
Reset | Requests the enumerator resets itself to begin enumerating from the beginning.

Remarks

The enumerator can be used manually to enumerate through the values of a list, or it can be wrapped in a custom enumerator to allow it to be used in the For..Each context.

To use an IEnumerator object in For..Each, call the CreateEnumerator method passing in the IEnumerator object. The returned value is then returned in the standard NewEnum(Procedure ID: -4) function called by For..Each. The enumeration will then be delegated to the custom IEnumerator object.

Examples

The following example shows an implementation of the IEnumerator interface.

This example is part of a larger complete example for IEnumerable.

Option Explicit
Implements IEnumerator

Private mBase As EnumeratorBase
Private mContainer As Container

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   Constructors
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Sub Init(ByVal Container As Container)
    Set mBase = NewEnumeratorBase(0, Container.Count)
    Set mContainer = Container
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IEnumerator
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Property Get IEnumerator_Current() As Variant
    MoveVariant IEnumerator_Current, mContainer.Item(mBase.Index)
End Property

Private Function IEnumerator_MoveNext() As Boolean
    IEnumerator_MoveNext = mBase.MoveNext
End Function

Private Sub IEnumerator_Reset()
    mBase.Reset
End Sub

See Also

Project CorLib Overview

Class IEnumerator Overview

IEnumerable


IEnumerator: Current (get)

Current

Gets the current element in the collection.

 Public Property Get Current ( ) As Variant

Return Values

Variant - The current element in the collection.

Remarks

After an enumerator is created or after the Reset method is called, the MoveNext method must be called to advance the enumerator to the first element of the collection before reading the value of the Current property; otherwise, Current is undefined.

Current also throws an exception if the last call to MoveNext returned False, which indicates the end of the collection.

Current does not move the position of the enumerator, and consecutive calls to Current return the same object until either MoveNext or Reset is called.

Read Only.

Examples

The following example shows an implementation of the IEnumerator interface.

This example is part of a larger complete example for IEnumerable.

Option Explicit
Implements IEnumerator

Private mBase As EnumeratorBase
Private mContainer As Container

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   Constructors
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Sub Init(ByVal Container As Container)
    Set mBase = NewEnumeratorBase(0, Container.Count)
    Set mContainer = Container
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IEnumerator
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Property Get IEnumerator_Current() As Variant
    MoveVariant IEnumerator_Current, mContainer.Item(mBase.Index)
End Property

Private Function IEnumerator_MoveNext() As Boolean
    IEnumerator_MoveNext = mBase.MoveNext
End Function

Private Sub IEnumerator_Reset()
    mBase.Reset
End Sub

See Also

Project CorLib Overview

Class IEnumerator Overview


IEnumerator: MoveNext

MoveNext

Advances the enumerator to the next element of the collection.

 Public Function MoveNext ( ) As Boolean

Return Values

Boolean - True if the enumerator was successfully advanced to the next element; False if the enumerator has passed the end of the collection.

Remarks

After an enumerator is created or after the Reset method is called, an enumerator is positioned before the first element of the collection, and the first call to the MoveNext method moves the enumerator over the first element of the collection.

If MoveNext passes the end of the collection, the enumerator is positioned after the last element in the collection and MoveNext returns False. When the enumerator is at this position, subsequent calls to MoveNext also return False until Reset is called.

Examples

The following example shows an implementation of the IEnumerator interface.

This example is part of a larger complete example for IEnumerable.

Option Explicit
Implements IEnumerator

Private mBase As EnumeratorBase
Private mContainer As Container

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   Constructors
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Sub Init(ByVal Container As Container)
    Set mBase = NewEnumeratorBase(0, Container.Count)
    Set mContainer = Container
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IEnumerator
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Property Get IEnumerator_Current() As Variant
    MoveVariant IEnumerator_Current, mContainer.Item(mBase.Index)
End Property

Private Function IEnumerator_MoveNext() As Boolean
    IEnumerator_MoveNext = mBase.MoveNext
End Function

Private Sub IEnumerator_Reset()
    mBase.Reset
End Sub

See Also

Project CorLib Overview

Class IEnumerator Overview


IEnumerator: Reset

Reset

Requests the enumerator resets itself to begin enumerating from the beginning.

 Public Sub Reset ( )

Examples

The following example shows an implementation of the IEnumerator interface.

This example is part of a larger complete example for IEnumerable.

Option Explicit
Implements IEnumerator

Private mBase As EnumeratorBase
Private mContainer As Container

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   Constructors
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Sub Init(ByVal Container As Container)
    Set mBase = NewEnumeratorBase(0, Container.Count)
    Set mContainer = Container
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IEnumerator
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Property Get IEnumerator_Current() As Variant
    MoveVariant IEnumerator_Current, mContainer.Item(mBase.Index)
End Property

Private Function IEnumerator_MoveNext() As Boolean
    IEnumerator_MoveNext = mBase.MoveNext
End Function

Private Sub IEnumerator_Reset()
    mBase.Reset
End Sub

See Also

Project CorLib Overview

Class IEnumerator Overview


IEqualityComparer

IEqualityComparer

Defines methods to support the comparison of values for equality.

Public:

Methods:

Name | Description
Equals | Determines whether the specified values are equal.
GetHashCode | Returns a hash code for the specified value.

Remarks

This interface allows the implementation of customized equality comparison for collections. That is, you can create your own definition of equality, and specify that this definition be used with a collection type that accepts the IEqualityComparer interface. In the VBCorLib Framework, constructor of the Hashtable collection type accepts this interface.

This interface supports only equality comparisons. Customization of comparisons for sorting and ordering is provided by the IComparer interface.

A default implementation can be accessed using EqualityComparer.Default.

See Also

Project CorLib Overview

Class IEqualityComparer Overview


IEqualityComparer: Equals

Equals

Determines whether the specified values are equal.

 Public Function Equals(
      ByRef x As Variant,
      ByRef y As Variant ) As Boolean

Parameters

x
[ByRef] Variant. The first value to compare.
y
[ByRef] Variant. The second value to compare.

Return Values

Boolean - True if the specified objects are equal; otherwise, False.

Remarks

Implement this method to provide a customized equality comparison for values.

Notes to Implementers

The Equals method is reflexive, symmetric, and transitive. That is, it returns True if used to compare a value with itself; True for two values x and y if it is True for y and x; and True for two values x and z if it is True for x and y and also True for y and z.

Implementations are required to ensure that if the Equals method returns true for two values x and y, then the value returned by the GetHashCode method for x must equal the value returned for y.

Exceptions

Exception | Condition
ArgumentException | x and y are of different types and neither one can handle comparisons with the other.

See Also

Project CorLib Overview

Class IEqualityComparer Overview


IEqualityComparer: GetHashCode

GetHashCode

Returns a hash code for the specified value.

 Public Function GetHashCode(
      ByRef Obj As Variant ) As Long

Parameters

Obj
[ByRef] Variant. The value for which a hash code is to be returned.

Return Values

Long - A hash code for the specified object.

Remarks

Implement this method to provide customized hash codes for values,corresponding to the customized equality comparison provided by the Equals method.

Notes to Implementers

Implementations are required to ensure that if the Equals method returns True for two values x and y, then the value returned by the GetHashCode method for x must equal the value returned for y.

See Also

Project CorLib Overview

Class IEqualityComparer Overview


IFormatProvider

IFormatProvider

Provides a mechanism for retrieving an object to control formatting.

Public:

Methods:

Name | Description
GetFormat | Returns an object to provide formatting services.

See Also

Project CorLib Overview

Class IFormatProvider Overview


IFormatProvider: GetFormat

GetFormat

Returns an object to provide formatting services.

 Public Function GetFormat(
      ByRef FormatType As String ) As Object

Parameters

FormatType
[ByRef] String. The TypeName of the formatting class requested.

Return Values

Object - An object to format data in a specific fashion for such methods as ToString.

Remarks

Calling this function should not raise an exception. If the requested FormatType is not supported then Nothing should be returned.

See Also

Project CorLib Overview

Class IFormatProvider Overview


IFormattable

IFormattable

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

Public:

Methods:

Name | Description
ToString | Returns the string representation of the object.

Remarks

The IFormattable interface converts an object to its string representation based on a format string and a format provider.

See Also

Project CorLib Overview

Class IFormattable Overview


IFormattable: ToString

ToString

Returns the string representation of the object.

 Public Function ToString(
      ByRef Format As String,
      ByVal Provider As IFormatProvider ) As String

Parameters

Format
[ByRef] String. The format string that describes the requested formatting of the value.
-or-
vbNullString to use the default formatting for the type.
Provider
[ByVal] IFormatProvider. A provider that can format the value.
-or-
Nothing to use the default formatter for the current locale.

Return Values

String - A string representation of the object with formatting applied.

See Also

Project CorLib Overview

Class IFormattable Overview

IFormatProvider


IHashAlgorithm

IHashAlgorithm

Provides an interface all hash algorithm callbacks must implement.

Public:

Methods:

Name | Description
HashCore | Requests a callback to hash a set of bytes, maintaining any state needed between calls.
HashFinal | Requests the callback to hash any buffered data and return the resulting hash value.
Initialize | Requests that a callback reset itself to prepare for hashing a new value.

Remarks

The HashAlgorithmBase class uses callbacks to perform hashing functions. A callback object must implement this interface to be used.

See Also

Project CorLib Overview

Class IHashAlgorithm Overview


IHashAlgorithm: HashCore

HashCore

Requests a callback to hash a set of bytes, maintaining any state needed between calls.

 Public Sub HashCore(
      ByRef Bytes ( ) As Byte,
      ByVal Index As Long,
      ByVal Count As Long )

Parameters

Bytes
[ByRef] Byte. The data to be hashed.
Index
[ByVal] Long. The starting index in the data to begin hashing.
Count
[ByVal] Long. The number of bytes to be hashed.

Remarks

It is up to the callback to maintain any state needed between calls.

See Also

Project CorLib Overview

Class IHashAlgorithm Overview


IHashAlgorithm: HashFinal

HashFinal

Requests the callback to hash any buffered data and return the resulting hash value.

 Public Function HashFinal(
      ByRef Buffer ( ) As Byte,
      ByVal BufferCount As Long,
      ByVal MessageLength As Currency ) As Byte ( ) :

Parameters

Buffer
[ByRef] Byte. The internally kept buffered data.
BufferCount
[ByVal] Long. The number of bytes actually in the buffer.
MessageLength
[ByVal] Currency. The size of the message in bytes.

Return Values

Byte() - The resulting hash value.

See Also

Project CorLib Overview

Class IHashAlgorithm Overview


IHashAlgorithm: Initialize

Initialize

Requests that a callback reset itself to prepare for hashing a new value.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class IHashAlgorithm Overview


IList

IList

An interface that provides methods for accessing and manipulating values at specified indexes within a list.

Public:

Properties:

Name | Description
Count (get) | Returns the number of items in the list.
IsFixedSize (get) | Returns if the list is fixed-size.
IsReadOnly (get) | Returns if the list is read-only.
Item (get) | Returns an item at specified index.
Item (let) | Sets the item at the specified index to a new value.
Item (set) | Sets the item at the specified index to a new value.

Methods:

Name | Description
Add | Adds a new item to the list.
Clear | Clears the contents of the list.
Contains | Determines if the list contains a specific value.
CopyTo | Copies the elements in the list to the array.
GetEnumerator | Returns an enumerator used to iterate over the list.
IndexOf | Returns the index of the value within the list.
Insert | Inserts a value into a list at the specified index.
Remove | Removes a value from the list.
RemoveAt | Removes a value from the list at the specified index.

Remarks

This interface should be implemented in classes that provide a list style functionality.

See Also

Project CorLib Overview

Class IList Overview

ICollection

IEnumerable


IList: Add

Add

Adds a new item to the list.

 Public Function Add(
      ByRef Value As Variant ) As Long

Parameters

Value
[ByRef] Variant. The item to be added to the list.

Return Values

Long -

See Also

Project CorLib Overview

Class IList Overview


IList: Clear

Clear

Clears the contents of the list.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class IList Overview


IList: Contains

Contains

Determines if the list contains a specific value.

 Public Function Contains(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. the value to check the list for.

Return Values

Boolean - An indication of the value being found in the list.

See Also

Project CorLib Overview

Class IList Overview


IList: CopyTo

CopyTo

Copies the elements in the list to the array.

 Public Sub CopyTo(
      ByRef Arr As Variant,
      ByVal Index As Long )

Parameters

Arr
[ByRef] Variant. The array to copy the elements to.
Index
[ByVal] Long. The starting index in the array to begin copying to.

See Also

Project CorLib Overview

Class IList Overview


IList: Count (get)

Count

Returns the number of items in the list.

 Public Property Get Count ( ) As Long

Return Values

Long - The number of items in the list.

Read Only.

See Also

Project CorLib Overview

Class IList Overview


IList: GetEnumerator

GetEnumerator

Returns an enumerator used to iterate over the list.

 Public Function GetEnumerator ( ) As IEnumerator

Return Values

IEnumerator - An enumerator used to iterate over the list.

See Also

Project CorLib Overview

Class IList Overview


IList: IndexOf

IndexOf

Returns the index of the value within the list.

 Public Function IndexOf(
      ByRef Value As Variant ) As Long

Parameters

Value
[ByRef] Variant. The value to find the index of in the list.

Return Values

Long - The index the value was found, or -1 if the value was not found.

Remarks

In general, -1 is returned for an unfound value. If the lowerbound of the underlying list is not 0, then the return value should be the lowerbound-1 for values not found.

See Also

Project CorLib Overview

Class IList Overview


IList: Insert

Insert

Inserts a value into a list at the specified index.

 Public Sub Insert(
      ByVal Index As Long,
      ByRef Value As Variant )

Parameters

Index
[ByVal] Long. The postion in the list to insert the new value.
Value
[ByRef] Variant. The new value to be inserted into the list.

See Also

Project CorLib Overview

Class IList Overview


IList: IsFixedSize (get)

IsFixedSize

Returns if the list is fixed-size.

 Public Property Get IsFixedSize ( ) As Boolean

Return Values

Boolean - Indication of the list being fixed-size.

Remarks

A fixed-size list can have the elements changed, however, elements cannot be added or removed.

Read Only.

See Also

Project CorLib Overview

Class IList Overview


IList: IsReadOnly (get)

IsReadOnly

Returns if the list is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - Indication of the list being read-only.

Remarks

A read-only list can only view the elements in the list, however, elements cannot be added, removed, or modified.

Read Only.

See Also

Project CorLib Overview

Class IList Overview


IList: Item (get)

Item

Returns an item at specified index.

 Public Property Get Item(
      ByVal Index As Long ) As Variant

Parameters

Index
[ByVal] Long. The index of the item to return.

Return Values

Variant - The item at the specified index.

Read/Write.

See Also

Project CorLib Overview

Class IList Overview


IList: Item (let)

Item

Sets the item at the specified index to a new value.

 Public Property Let Item(
      ByVal Index As Long,
      ByRef Value As Variant ) :

Parameters

Index
[ByVal] Long. The index of the item to set the value to.
Value
[ByRef] Variant. The new value to set the item to.

Read/Write.

See Also

Project CorLib Overview

Class IList Overview


IList: Item (set)

Item

Sets the item at the specified index to a new value.

 Public Property Set Item(
      ByVal Index As Long,
      ByRef Value As Variant ) :

Parameters

Index
[ByVal] Long. The index of the item to set the value to.
Value
[ByRef] Variant. The new value to set the item to.

Read/Write.

See Also

Project CorLib Overview

Class IList Overview


IList: Remove

Remove

Removes a value from the list.

 Public Sub Remove(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. The value to be removed from the list.

Remarks

This method searches the list for the first instance of the value. If one is found, it is removed from the list.

See Also

Project CorLib Overview

Class IList Overview


IList: RemoveAt

RemoveAt

Removes a value from the list at the specified index.

 Public Sub RemoveAt(
      ByVal Index As Long )

Parameters

Index
[ByVal] Long. The position of the value in the list to be removed.

See Also

Project CorLib Overview

Class IList Overview


IndexOutOfRangeException

IndexOutOfRangeException

The exception that is thrown when an attempt is made to access an element of an array with an index that is outside the bounds of the array.

Implements:

Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

Remarks

This is the same as error 9, subcript out of range.

See Also

Project CorLib Overview

Class IndexOutOfRangeException Overview

Constructors

ExceptionMethods

Exception


IndexOutOfRangeException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class IndexOutOfRangeException Overview


IndexOutOfRangeException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class IndexOutOfRangeException Overview


IndexOutOfRangeException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class IndexOutOfRangeException Overview


IndexOutOfRangeException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class IndexOutOfRangeException Overview


IndexOutOfRangeException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class IndexOutOfRangeException Overview


IndexOutOfRangeException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class IndexOutOfRangeException Overview


IndexOutOfRangeException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class IndexOutOfRangeException Overview


IndexOutOfRangeException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class IndexOutOfRangeException Overview


IndexOutOfRangeException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class IndexOutOfRangeException Overview

Exception


IndexOutOfRangeException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class IndexOutOfRangeException Overview


IndexOutOfRangeException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class IndexOutOfRangeException Overview


IndexOutOfRangeException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewSystemException.

Read Only.

See Also

Project CorLib Overview

Class IndexOutOfRangeException Overview


IndexOutOfRangeException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class IndexOutOfRangeException Overview


IndexOutOfRangeException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class IndexOutOfRangeException Overview


IndexOutOfRangeException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class IndexOutOfRangeException Overview


IndexOutOfRangeException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class IndexOutOfRangeException Overview


IniFile

IniFile

Provides methods for manipulating an INI initialization file.

Implements:

IObject

Public:

Properties:

Name | Description
AutoFlush (get) | Returns the auto-flush state of the object.
AutoFlush (let) | Sets the auto-flush state of the object.
FileName (get) | Returns the name of the INI file being manipulated.

Methods:

Name | Description
DeleteKey | Deletes a key-value pair in a specific section within an INI file.
DeleteSection | Deletes an entire section from an INI file, including all key-value pairs.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
Flush | Flushes any cached updates to the INI file.
GetBoolean | Returns a Boolean value from the specified key in the specified section of an INI file.
GetByte | Returns a Byte value from the specified key in the specified section of an INI file.
GetCurrency | Returns a Currency value from the specified key in the specified section of an INI file.
GetDate | Returns a Date value from the specified key in the specified section of an INI file.
GetDateTime | Returns a CorDateTime value from the specified key in the specified section of an INI file.
GetDecimal | Returns a Decimal value from the specified key in the specified section of an INI file.
GetDouble | Returns a Double value from the specified key in the specified section of an INI file.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetInt16 | Returns a Integer value from the specified key in the specified section of an INI file.
GetInt32 | Returns a Long value from the specified key in the specified section of an INI file.
GetKeyNames | Returns a list of key names in an INI file.
GetSectionNames | Returns a list of section names in an INI file.
GetSectionWriter | Returns a IniResourceWriter used to create an entire section withing an INI file at once.
GetSingle | Returns a Single value from the specified key in the specified section of an INI file.
GetString | Returns the string value of the specified key in the specified section of an INI file.
GetTimeSpan | Returns a TimeSpan value from the specified key in the specified section of an INI file.
GetValues | Returns an IDictionary object containing the key-value pairs from a section in an INI file.
SetValue | Sets a key-value pair within a section of an INI file.
ToString | Returns a string representation of this object instance.

Remarks

An INI file contains sections in a format like

[section]
key=value

 A new IniFile object can be created using the NewIniFile method.

 Dim ini As IniFile
 Set ini = NewIniFile("c:\settings.ini")

If the file name does not specify the directory, then the file will be created in the Windows directory. In order to specify the current directory, preceed the file name with a current directory symbol ".".

 Dim Ini As IniFile
 Set Ini = NewIniFile(".\local.ini")

See Also

Project CorLib Overview

Class IniFile Overview

IniResourceWriter


IniFile: AutoFlush (get)

AutoFlush

Returns the auto-flush state of the object.

 Public Property Get AutoFlush ( ) As Boolean

Return Values

Boolean - True if AutoFlush is active, False otherwise.

Remarks

When AutoFlush is set to True, the object will call Flush after any method that writes to the INI file.

Read/Write.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: AutoFlush (let)

AutoFlush

Sets the auto-flush state of the object.

 Public Property Let AutoFlush(
      ByVal Value As Boolean )

Parameters

Value
[ByVal] Boolean. The new auto-flush state of the object.

Remarks

When AutoFlush is set to True, the object will call Flush after any method that writes to the INI file.

Read/Write.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: DeleteKey

DeleteKey

Deletes a key-value pair in a specific section within an INI file.

 Public Sub DeleteKey(
      ByRef Section As String,
      ByRef Key As String )

Parameters

Section
[ByRef] String. The section the key-value pair is to be deleted from.
Key
[ByRef] String. The key of the key-value pair to be deleted.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: DeleteSection

DeleteSection

Deletes an entire section from an INI file, including all key-value pairs.

 Public Sub DeleteSection(
      ByRef Section As String )

Parameters

Section
[ByRef] String. The name of the section to be deleted from an INI file.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: FileName (get)

FileName

Returns the name of the INI file being manipulated.

 Public Property Get FileName ( ) As String

Return Values

String - The INI file name.

Read Only.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: Flush

Flush

Flushes any cached updates to the INI file.

 Public Sub Flush ( )

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: GetBoolean

GetBoolean

Returns a Boolean value from the specified key in the specified section of an INI file.

 Public Function GetBoolean(
      ByRef Section As String,
      ByRef Key As String,
      Optional ByVal Default As Boolean ) As Boolean

Parameters

Section
[ByRef] String. The section within the INI file to search for the key.
Key
[ByRef] String. The key in the section of an INI file to retrieve the value of.
Default
[ByVal] Optional. Boolean. The default value to return if the key is not found in the section, or the value could not be converted to a Boolean.

Return Values

Boolean -

Remarks

An INI file contains all values as strings. The value is converted back into a Boolean using the CBool function. If an error occurs, then the default is returned.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: GetByte

GetByte

Returns a Byte value from the specified key in the specified section of an INI file.

 Public Function GetByte(
      ByRef Section As String,
      ByRef Key As String,
      Optional ByVal Default As Byte ) As Byte

Parameters

Section
[ByRef] String. The section within the INI file to search for the key.
Key
[ByRef] String. The key in the section of an INI file to retrieve the value of.
Default
[ByVal] Optional. Byte. The default value to return if the key is not found in the section, or the value could not be converted to a Byte.

Return Values

Byte -

Remarks

An INI file contains all values as strings. The value is converted back into a Byte using the CByte function. If an error occurs, then the default is returned.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: GetCurrency

GetCurrency

Returns a Currency value from the specified key in the specified section of an INI file.

 Public Function GetCurrency(
      ByVal Section As String,
      ByVal Key As String,
      Optional ByVal Default As Currency ) As Currency

Parameters

Section
[ByVal] String. The section within the INI file to search for the key.
Key
[ByVal] String. The key in the section of an INI file to retrieve the value of.
Default
[ByVal] Optional. Currency. The default value to return if the key is not found in the section, or the value could not be converted to a Currency.

Return Values

Currency -

Remarks

An INI file contains all values as strings. The value is converted back into a Currency using the CCur function. If an error occurs, then the default is returned.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: GetDate

GetDate

Returns a Date value from the specified key in the specified section of an INI file.

 Public Function GetDate(
      ByRef Section As String,
      ByRef Key As String,
      Optional ByVal Default As Date ) As Date

Parameters

Section
[ByRef] String. The section within the INI file to search for the key.
Key
[ByRef] String. The key in the section of an INI file to retrieve the value of.
Default
[ByVal] Optional. Date. The default value to return if the key is not found in the section, or the value could not be converted to a Date.

Return Values

Date -

Remarks

An INI file contains all values as strings. The value is converted back into a Date using the CDate function. If an error occurs, then the default is returned.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: GetDateTime

GetDateTime

Returns a CorDateTime value from the specified key in the specified section of an INI file.

 Public Function GetDateTime(
      ByRef Section As String,
      ByRef Key As String,
      Optional ByVal Default As CorDateTime ) As CorDateTime

Parameters

Section
[ByRef] String. The section within the INI file to search for the key.
Key
[ByRef] String. The key in the section of an INI file to retrieve the value of.
Default
[ByVal] Optional. CorDateTime. The default value to return if the key is not found in the section, or the value could not be converted to a CorDateTime.

Return Values

CorDateTime -

Remarks

An INI file contains all values as strings. The value is converted back into a CorDateTime using the CorDateTime.TryParse function. If an error occurs, then the default is returned.

Passing in Nothing as the default will return CorDateTime.MinValue.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: GetDecimal

GetDecimal

Returns a Decimal value from the specified key in the specified section of an INI file.

 Public Function GetDecimal(
      ByRef Section As String,
      ByRef Key As String,
      Optional ByRef Default As Variant ) As Variant

Parameters

Section
[ByRef] String. The section within the INI file to search for the key.
Key
[ByRef] String. The key in the section of an INI file to retrieve the value of.
Default
[ByRef] Optional. Variant. The default value to return if the key is not found in the section, or the value could not be converted to a Decimal.

Return Values

Variant -

Remarks

An INI file contains all values as strings. The value is converted back into a Decimal using the CDec function. If an error occurs, then the default is returned.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: GetDouble

GetDouble

Returns a Double value from the specified key in the specified section of an INI file.

 Public Function GetDouble(
      ByRef Section As String,
      ByRef Key As String,
      Optional ByVal Default As Double ) As Double

Parameters

Section
[ByRef] String. The section within the INI file to search for the key.
Key
[ByRef] String. The key in the section of an INI file to retrieve the value of.
Default
[ByVal] Optional. Double. The default value to return if the key is not found in the section, or the value could not be converted to a Double.

Return Values

Double -

Remarks

An INI file contains all values as strings. The value is converted back into a Double using the CDbl function. If an error occurs, then the default is returned.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: GetInt16

GetInt16

Returns a Integer value from the specified key in the specified section of an INI file.

 Public Function GetInt16(
      ByRef Section As String,
      ByRef Key As String,
      Optional ByVal Default As Integer ) As Integer

Parameters

Section
[ByRef] String. The section within the INI file to search for the key.
Key
[ByRef] String. The key in the section of an INI file to retrieve the value of.
Default
[ByVal] Optional. Integer. The default value to return if the key is not found in the section, or the value could not be converted to an Integer.

Return Values

Integer -

Remarks

An INI file contains all values as strings. The value is converted back into an Integer using the CInt function. If an error occurs, then the default is returned.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: GetInt32

GetInt32

Returns a Long value from the specified key in the specified section of an INI file.

 Public Function GetInt32(
      ByRef Section As String,
      ByRef Key As String,
      Optional ByVal Default As Long ) As Long

Parameters

Section
[ByRef] String. The section within the INI file to search for the key.
Key
[ByRef] String. The key in the section of an INI file to retrieve the value of.
Default
[ByVal] Optional. Long. The default value to return if the key is not found in the section, or the value could not be converted to a Long.

Return Values

Long -

Remarks

An INI file contains all values as strings. The value is converted back into a Long using the CLng function. If an error occurs, then the default is returned.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: GetKeyNames

GetKeyNames

Returns a list of key names in an INI file.

 Public Function GetKeyNames(
      ByRef Section As String ) As String ( )

Parameters

Section
[ByRef] String. The section within an INI file to retrieve key names.

Return Values

String() - An array of key names from a section, or a zero-length array if no keys exist in the section.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: GetSectionNames

GetSectionNames

Returns a list of section names in an INI file.

 Public Function GetSectionNames ( ) As String ( )

Return Values

String() - An array of section names, or a zero-length array if no sections exist.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: GetSectionWriter

GetSectionWriter

Returns a IniResourceWriter used to create an entire section withing an INI file at once.

 Public Function GetSectionWriter(
      ByRef Section As String ) As IniResourceWriter

Parameters

Section
[ByRef] String. The section to create using the writer.

Return Values

IniResourceWriter - The IniResourceWriter used to create an entire section.

See Also

Project CorLib Overview

Class IniFile Overview

IniResourceWriter


IniFile: GetSingle

GetSingle

Returns a Single value from the specified key in the specified section of an INI file.

 Public Function GetSingle(
      ByRef Section As String,
      ByRef Key As String,
      Optional ByVal Default As Single ) As Single

Parameters

Section
[ByRef] String. The section within the INI file to search for the key.
Key
[ByRef] String. The key in the section of an INI file to retrieve the value of.
Default
[ByVal] Optional. Single. The default value to return if the key is not found in the section, or the value could not be converted to a Single.

Return Values

Single -

Remarks

An INI file contains all values as strings. The value is converted back into a Single using the CSng function. If an error occurs, then the default is returned.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: GetString

GetString

Returns the string value of the specified key in the specified section of an INI file.

 Public Function GetString(
      ByRef Section As String,
      ByRef Key As String,
      Optional ByVal Default As String ) As String

Parameters

Section
[ByRef] String. The section within the INI file to search for the key.
Key
[ByRef] String. The key in the section of an INI file to retrieve the value of.
Default
[ByVal] Optional. String. The default value to return if the key is not found in the section.

An empty string is a valid value in an INI file. Testing for an empty string does not mean the value was not found.

Return Values

String -

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: GetTimeSpan

GetTimeSpan

Returns a TimeSpan value from the specified key in the specified section of an INI file.

 Public Function GetTimeSpan(
      ByRef Section As String,
      ByRef Key As String,
      Optional ByVal Default As TimeSpan ) As TimeSpan

Parameters

Section
[ByRef] String. The section within the INI file to search for the key.
Key
[ByRef] String. The key in the section of an INI file to retrieve the value of.
Default
[ByVal] Optional. TimeSpan. The default value to return if the key is not found in the section, or the value could not be converted to a TimeSpan.

Return Values

TimeSpan -

Remarks

An INI file contains all values as strings. The value is converted back into a TimeSpan by first attempting to parse the string as a TimeSpan object. If that fails, an attempt is made by testing for a Date value and retrieving the time portion. If an error occurs, then the default is returned.

Passing in Nothing for the default will return TimeSpan.Zero for the default.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: GetValues

GetValues

Returns an IDictionary object containing the key-value pairs from a section in an INI file.

 Public Function GetValues(
      ByRef Section As String ) As IDictionary

Parameters

Section
[ByRef] String. The section to retrieve all the key-value pairs from.

Return Values

IDictionary - An IDictionary object containing zero or more key-value pairs.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: SetValue

SetValue

Sets a key-value pair within a section of an INI file.

 Public Sub SetValue(
      ByRef Section As String,
      ByRef Key As String,
      ByRef Value As Variant )

Parameters

Section
[ByRef] String. The INI section within the file to set the value.
Key
[ByRef] String. The name of the value to be set.
Value
[ByRef] Variant. The value to be set in the INI file.

Remarks

If an object is passed in, then it must implement the IObject interface or an exception will be thrown. All other datatypes will be converted to their normal string value.

See Also

Project CorLib Overview

Class IniFile Overview


IniFile: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class IniFile Overview


IniResourceWriter

IniResourceWriter

Creates an entire section at once in an INI file.

Implements:

IObject
IResourceWriter

Public:

Properties:

Name | Description
FileName (get) | Returns the name of the INI file.
Section (get) | Returns the name of the section to write all the key-value pairs to.

Methods:

Name | Description
AddResource | Adds a key-value pair into the writer in preparation of creating an INI section.
CloseWriter | Saves the resources to the ini file and then closes it.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
Generate | Creates a section within an INI file.
GetHashCode | Returns a pseudo-unique number identifying this instance.
ToString | Returns a string representation of this object instance.

Remarks

All values in the specified section are deleted, so there is no merging of the existing section key-value pairs and the new key-value pairs. Only the new key-value pairs will exist in the section once generated.

See Also

Project CorLib Overview

Class IniResourceWriter Overview


IniResourceWriter: AddResource

AddResource

Adds a key-value pair into the writer in preparation of creating an INI section.

 Public Sub AddResource(
      ByRef Key As String,
      ByRef Value As Variant )

Parameters

Key
[ByRef] String. The identifier of the value to be written to the INI file section.
Value
[ByRef] Variant. The value to be written to the INI file section.

Remarks

If an object is passed in, then it must implement the IObject interface or an exception will be thrown. All other datatypes will be converted to their normal string value.

See Also

Project CorLib Overview

Class IniResourceWriter Overview


IniResourceWriter: CloseWriter

CloseWriter

Saves the resources to the ini file and then closes it.

 Public Sub CloseWriter ( )

Remarks

Generate is called implicitly by CloseWriter, if required.

See Also

Project CorLib Overview

Class IniResourceWriter Overview


IniResourceWriter: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class IniResourceWriter Overview


IniResourceWriter: FileName (get)

FileName

Returns the name of the INI file.

 Public Property Get FileName ( ) As String

Return Values

String - The name of the INI file.

Read Only.

See Also

Project CorLib Overview

Class IniResourceWriter Overview


IniResourceWriter: Generate

Generate

Creates a section within an INI file.

 Public Sub Generate ( )

Remarks

All existing key-value pairs already in the specified section of the INI file will be removed.

The Generate method is called implicitly by the CloseWriter method if it is not called by your application code.

Generate can be called only once. After you call Generate, all IniResourceWriter methods other than CloseWriter will throw an exception.

See Also

Project CorLib Overview

Class IniResourceWriter Overview


IniResourceWriter: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class IniResourceWriter Overview


IniResourceWriter: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class IniResourceWriter Overview


IniResourceWriter: IResourceWriter

IResourceWriter

 Implements IResourceWriter

Return Values

IResourceWriter -

See Also

Project CorLib Overview

Class IniResourceWriter Overview


IniResourceWriter: Section (get)

Section

Returns the name of the section to write all the key-value pairs to.

 Public Property Get Section ( ) As String

Return Values

String - The name of the section in the INI file.

Read Only.

See Also

Project CorLib Overview

Class IniResourceWriter Overview


IniResourceWriter: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class IniResourceWriter Overview


Int64Static

Int64Static

Provides methods for manipulating a 64-bit signed integer.

Public:

Types:

Name | Description
Int64 | Represents a 64-bit signed integer.

Properties:

Name | Description
MaxValue (get) | Represents the largest possible value of an Int64.
MinusOne (get) | Returns an Int64 value represnting minus-one.
MinValue (get) | Represents the smallest possible value of an Int64.
One (get) | Returns an Int64 value representing one.
Zero (get) | Returns an Int64 value representing zero.

Methods:

Name | Description
Absolute | Returns a new Int64 whose value is the absolute value of Value.
Add | Returns the sum of two Int64 values.
BitwiseAnd | Performs a bitwise AND of two Int64 values.
BitwiseNot | Performs a bitwise NOT of two Int64 values.
BitwiseOr | Performs a bitwise OR of two Int64 values.
BitwiseXor | Performs a bitwise XOR of two Int64 values.
Compare | Compares two Int64 values and returns a value indicating whether one is less than, equal to, or greater than the other.
Divide | Calculates the quotient of two 64-bit signed integers.
DivRem | Calculates the quotient of two 64-bit signed integers and also returns the remainder in an output parameter.
Equals | Determines of two Int64 values are equal.
GetHashCode | Returns the hash code for this instance.
IsMinusOne | Returns if value is equal to minue one.
IsNegative | Returns if an Int64 value is negative.
IsOne | Returns if value is equal to one.
IsZero | Returns if value is equal to zero.
Max | Returns the larger of two 64-bit signed integers.
Min | Returns the smaller of two 64-bit signed integers.
Modulus | Calculates the remainder of two 64-bit signed integers.
Multiply | Multiplies two Int64 values returning the product.
Negate | Returns a new Int64 whose value is the negated value of Value.
Parse | Converts the string representation of a number to its 64-bit signed integer equivalent.
ParseEx | Converts the string representation of a number in a specified style and culture-specific format to its 64-bit signed integer equivalent.
ShiftLeft | Performs a left shift operation on an Int64.
ShiftRight | Performs a right shift operation on an Int64.
Sign | Returns an integer indicating the sign of the value.
Subtract | Returns the difference of two Int64 values.
ToDecimal | Converts an Int64 value to a type Decimal.
ToString | Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.
TryParse | Converts the string representation of a number to its 64-bit signed integer equivalent. A return value indicates whether the conversion succeeded or failed.
TryParseEx | Converts the string representation of a number in a specified style and culture-specific format to its 64-bit signed integer equivalent.

Remarks

The 64-bit value is stored in an Int64 UDT represented by a low 32bits and high 32bits.

Examples

The example demonstrates mathematical operations using Int64.

Public Sub Main()
    Dim x As Int64
    Dim y As Int64
    Dim r As Int64

    x = CInt64(55)
    y = CInt64(500)

    r = Int64.Add(x, y)
    PrintOutput "+", x, y, r

    r = Int64.Subtract(x, y)
    PrintOutput "-", x, y, r

    r = Int64.Multiply(x, y)
    PrintOutput "*", x, y, r

    r = Int64.Divide(y, x)
    PrintOutput "/", y, x, r
End Sub

Private Sub PrintOutput(ByVal Op As String, ByRef x As Int64, ByRef y As Int64, ByRef r As Int64)
    Debug.Print CorString.Format("{1} {0} {2} = {3}", Op, x, y, r)
End Sub

' This code produces the following.
'    55 + 500 = 555
'    55 - 500 = -445
'    55 * 500 = 27500
'    500 / 55 = 9

See Also

Project CorLib Overview

Class Int64Static Overview

Constructors

Conversion


Int64Static: Absolute

Absolute

Returns a new Int64 whose value is the absolute value of Value.

 Public Function Absolute(
      ByRef Value As Int64 ) As Int64

Parameters

Value
[ByRef] Int64. The value to return the absolute value of.

Return Values

Int64 - The absolute value of Value.

Examples

The following code displays the absolute value of a give value.

Public Sub Main()
    PrintAbsolute CInt64(100)
    PrintAbsolute CInt64(-200)
End Sub

Private Sub PrintAbsolute(ByRef Value As Int64)
    Debug.Print CorString.Format("The absolute value of {0} is {1}.", Value, Int64.Absolute(Value))
End Sub

'This code produces the following.
'    The absolute value of 100 is 100.
'    The absolute value of -200 is 200.

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: Add

Add

Returns the sum of two Int64 values.

 Public Function Add(
      ByRef a As Int64,
      ByRef b As Int64 ) As Int64

Parameters

a
[ByRef] Int64. The first value to be added.
b
[ByRef] Int64. The second value to be added.

Return Values

Int64 - The sum of a and b.

Examples

The example demonstrates mathematical operations using Int64.

Public Sub Main()
    Dim x As Int64
    Dim y As Int64
    Dim r As Int64

    x = CInt64(55)
    y = CInt64(500)

    r = Int64.Add(x, y)
    PrintOutput "+", x, y, r

    r = Int64.Subtract(x, y)
    PrintOutput "-", x, y, r

    r = Int64.Multiply(x, y)
    PrintOutput "*", x, y, r

    r = Int64.Divide(y, x)
    PrintOutput "/", y, x, r
End Sub

Private Sub PrintOutput(ByVal Op As String, ByRef x As Int64, ByRef y As Int64, ByRef r As Int64)
    Debug.Print CorString.Format("{1} {0} {2} = {3}", Op, x, y, r)
End Sub

' This code produces the following.
'    55 + 500 = 555
'    55 - 500 = -445
'    55 * 500 = 27500
'    500 / 55 = 9

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: BitwiseAnd

BitwiseAnd

Performs a bitwise AND of two Int64 values.

 Public Function BitwiseAnd(
      ByRef a As Int64,
      ByRef b As Int64 ) As Int64

Parameters

a
[ByRef] Int64. The first value of the AND operation.
b
[ByRef] Int64. The second value of the AND operation.

Return Values

Int64 - A new Int64 value containing the performed bitwise operation.

Examples

The following code performs a bitwise and operation between two 64-bit integer values.

Public Sub Main()
    Dim x As Int64
    Dim y As Int64
    Dim r As Int64

    x = CInt64("0xfffffff0")
    y = CInt64("0xffff")
    r = Int64.BitwiseAnd(x, y)

    Debug.Print CorString.Format("0x{0:x} AND 0x{1:x8} = 0x{2:x8}", x, y, r)
End Sub

'This code produces the following.
'    0xfffffff0 AND 0x0000ffff = 0x0000fff0

See Also

Project CorLib Overview

Class Int64Static Overview

BitwiseOr

BitwiseNot

BitwiseXor


Int64Static: BitwiseNot

BitwiseNot

Performs a bitwise NOT of two Int64 values.

 Public Function BitwiseNot(
      ByRef a As Int64 ) As Int64

Parameters

a
[ByRef] Int64. The first value of the NOT operation.

Return Values

Int64 - A new Int64 value containing the performed bitwise operation.

Examples

The following code performs a NOT operation on a 64-bit integer value.

Public Sub Main()
    Dim x As Int64
    Dim r As Int64

    x = CInt64("0xf0000000")
    r = Int64.BitwiseNot(x)

    Debug.Print CorString.Format("NOT 0x{0:x} = 0x{1:x8}", x, r)
End Sub

'This code produces the following.
'    NOT 0xf0000000 = 0xffffffff0fffffff

See Also

Project CorLib Overview

Class Int64Static Overview

BitwiseAnd

BitwiseOr

BitwiseXor


Int64Static: BitwiseOr

BitwiseOr

Performs a bitwise OR of two Int64 values.

 Public Function BitwiseOr(
      ByRef a As Int64,
      ByRef b As Int64 ) As Int64

Parameters

a
[ByRef] Int64. The first value of the OR operation.
b
[ByRef] Int64. The second value of the OR operation.

Return Values

Int64 - A new Int64 value containing the performed bitwise operation.

Inlcude

"..\DocIncludes\Int64Static.BitwiseOr.html"

See Also

Project CorLib Overview

Class Int64Static Overview

BitwiseAnd

BitwiseNot

BitwiseXor


Int64Static: BitwiseXor

BitwiseXor

Performs a bitwise XOR of two Int64 values.

 Public Function BitwiseXor(
      ByRef a As Int64,
      ByRef b As Int64 ) As Int64

Parameters

a
[ByRef] Int64. The first value of the XOR operation.
b
[ByRef] Int64. The second value of the XOR operation.

Return Values

Int64 - A new Int64 value containing the performed bitwise operation.

Examples

The following code performs a bitwise exclusive-or operation between two 64-bit integers.

Public Sub Main()
    Dim x As Int64
    Dim y As Int64
    Dim r As Int64

    x = CInt64("0xffffffff")
    y = CInt64("0x000ff000")
    r = Int64.BitwiseXor(x, y)

    Debug.Print CorString.Format("0x{0:x8} XOR 0x{1:x8} = 0x{2:x8}", x, y, r)
End Sub

'This code produces the following.
'    0xffffffff XOR 0x000ff000 = 0xfff00fff

See Also

Project CorLib Overview

Class Int64Static Overview

BitwiseAnd

BitwiseOr

BitwiseNot


Int64Static: Compare

Compare

Compares two Int64 values and returns a value indicating whether one is less than, equal to, or greater than the other.

 Public Function Compare(
      ByRef a As Int64,
      ByRef b As Int64 ) As Long

Parameters

a
[ByRef] Int64. The first Int64 to compare.
b
[ByRef] Int64. The second Int64 to compare.

Return Values

Long - A signed integer that indicates the relative values of x and y, as shown in the following table.
Value | Meaning
Less than zero | X is less than Y.
Zero | X equals Y.
Greater than zero | X is greater than Y.

Example

The following code illustrates comparing two 64-bit integer values.

    Public Sub Main()
        Dim x As Int64
        Dim y As Int64

        x = CInt64(1922)
        y = CInt64(400)

        Debug.Print Int64.Compare(x, y)  Displays 1
        Debug.Print Int64.Compare(x, x)  Displays 0
        Debug.Print Int64.Compare(y, x)  Displays -1
    End Sub

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: Divide

Divide

Calculates the quotient of two 64-bit signed integers.

 Public Function Divide(
      ByRef Dividend As Int64,
      ByRef Divisor As Int64 ) As Int64

Parameters

Dividend
[ByRef] Int64. The value to be divided.
Divisor
[ByRef] Int64. The value to divide by.

Return Values

Int64 - The integer quotient of the division.

Remarks

This method performs integer division, discarding the remainder.

Exceptions

Exception | Condition
DivideByZeroException | Attempt to divide by zero.

Examples

The example demonstrates mathematical operations using Int64.

Public Sub Main()
    Dim x As Int64
    Dim y As Int64
    Dim r As Int64

    x = CInt64(55)
    y = CInt64(500)

    r = Int64.Add(x, y)
    PrintOutput "+", x, y, r

    r = Int64.Subtract(x, y)
    PrintOutput "-", x, y, r

    r = Int64.Multiply(x, y)
    PrintOutput "*", x, y, r

    r = Int64.Divide(y, x)
    PrintOutput "/", y, x, r
End Sub

Private Sub PrintOutput(ByVal Op As String, ByRef x As Int64, ByRef y As Int64, ByRef r As Int64)
    Debug.Print CorString.Format("{1} {0} {2} = {3}", Op, x, y, r)
End Sub

' This code produces the following.
'    55 + 500 = 555
'    55 - 500 = -445
'    55 * 500 = 27500
'    500 / 55 = 9

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: DivRem

DivRem

Calculates the quotient of two 64-bit signed integers and also returns the remainder in an output parameter.

 Public Function DivRem(
      ByRef Dividend As Int64,
      ByRef Divisor As Int64,
      ByRef Remainder As Int64 ) As Int64

Parameters

Dividend
[ByRef] Int64. The value to be divided.
Divisor
[ByRef] Int64. The value to divide by.
Remainder
[ByRef] Int64. The remainder of the division.

Return Values

Int64 - The integer quotient of the division.

Exceptions

Exception | Condition
DivideByZeroException | Attempt to divide by zero.

Examples

The following code will calculate the quotient and remainder of a division operation.

Public Sub Main()
    Dim x As Int64
    Dim y As Int64
    Dim q As Int64
    Dim r As Int64

    x = CInt64(500)
    y = CInt64(55)
    q = Int64.DivRem(x, y, r)

    Debug.Print CorString.Format("The quotient of {0} / {1} = {2}", x, y, q)
    Debug.Print CorString.Format("The remainder of {0} / {1} = {2}.", x, y, r)
End Sub

'This code produces the following.
'    The quotient of 500 / 55 = 9
'    The remainder of 500 / 55 = 5.

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: Equals

Equals

Determines of two Int64 values are equal.

 Public Function Equals(
      ByRef Int64A As Int64,
      ByRef Int64B As Int64 ) As Boolean

Parameters

Int64A
[ByRef] Int64. The first value to compare.
Int64B
[ByRef] Int64. The second value to compare.

Return Values

Boolean - True if the values are equal; otherwise, False.

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: GetHashCode

GetHashCode

Returns the hash code for this instance.

 Public Function GetHashCode(
      ByRef Value As Int64 ) As Long

Parameters

Value
[ByRef] Int64. The 64-bit integer value to get a hash code for.

Return Values

Long - A 32-bit signed integer hash code.

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: Int64

Int64

Represents a 64-bit signed integer.

 Public Type Int64

Parameters

LowPart
Long. The least significant 32-bits of the integer value.
HighPart
Long. The most significant 32-bits of the integer value.

Remarks

An Int64 can be created using one of several methods.

  • Using the conversion method CInt64().
  • Calling the NewInt64(lo, hi) constructor method.
  • Parsing a string using one of the parse methods: Int64.Parse or Int64.TryParse.

See Also

Project CorLib Overview

Class Int64Static Overview

Conversion

Constructors

Parse

TryParse


Int64Static: IsMinusOne

IsMinusOne

Returns if value is equal to minue one.

 Public Function IsMinusOne(
      ByRef Value As Int64 ) As Boolean

Parameters

Value
[ByRef] Int64. The Int64 value to check.

Return Values

Boolean - True if the value is equal to minus one; False otherwise.

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: IsNegative

IsNegative

Returns if an Int64 value is negative.

 Public Function IsNegative(
      ByRef Value As Int64 ) As Boolean

Parameters

Value
[ByRef] Int64. The Int64 value to check negative for.

Return Values

Boolean - True if the value is negative, False otherwise.

Remarks

An Int64 is negative if the high bit of Int64.HighPart is set.

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: IsOne

IsOne

Returns if value is equal to one.

 Public Function IsOne(
      ByRef Value As Int64 ) As Boolean

Parameters

Value
[ByRef] Int64. The Int64 value to check.

Return Values

Boolean - True if the value is equal to one; False otherwise.

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: IsZero

IsZero

Returns if value is equal to zero.

 Public Function IsZero(
      ByRef Value As Int64 ) As Boolean

Parameters

Value
[ByRef] Int64. The Int64 value to check.

Return Values

Boolean - True if the value is equal to zero; False otherwise.

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: Max

Max

Returns the larger of two 64-bit signed integers.

 Public Function Max(
      ByRef Val1 As Int64,
      ByRef Val2 As Int64 ) As Int64

Parameters

Val1
[ByRef] Int64. The first of two 64-bit signed integers to compare.
Val2
[ByRef] Int64. The second of two 64-bit signed integers to compare.

Return Values

Int64 - Parameter Val1 or Val2, which ever is larger.

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: MaxValue (get)

MaxValue

Represents the largest possible value of an Int64.

 Public Property Get MaxValue ( ) As Int64

Return Values

Int64 - The maximum value constant.

Remarks

The value of this constant is 9,223,372,036,854,775,807; that is, hexadecimal 0x7FFFFFFFFFFFFFFF.

Read Only.

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: Min

Min

Returns the smaller of two 64-bit signed integers.

 Public Function Min(
      ByRef Val1 As Int64,
      ByRef Val2 As Int64 ) As Int64

Parameters

Val1
[ByRef] Int64. The first of two 64-bit signed integers to compare.
Val2
[ByRef] Int64. The second of two 64-bit signed integers to compare.

Return Values

Int64 - Parameter Val1 or Val2, which ever is smaller.

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: MinusOne (get)

MinusOne

Returns an Int64 value represnting minus-one.

 Public Property Get MinusOne ( ) As Int64

Return Values

Int64 - The Int64 with a value of minus-one.

Read Only.

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: MinValue (get)

MinValue

Represents the smallest possible value of an Int64.

 Public Property Get MinValue ( ) As Int64

Return Values

Int64 - The minimum value constant.

Remarks

The value of this constant is negative 9,223,372,036,854,775,808; that is, hexadecimal 0x8000000000000000.

Read Only.

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: Modulus

Modulus

Calculates the remainder of two 64-bit signed integers.

 Public Function Modulus(
      ByRef Dividend As Int64,
      ByRef Divisor As Int64 ) As Int64

Parameters

Dividend
[ByRef] Int64. The value to be divided.
Divisor
[ByRef] Int64. The value to divide by.

Return Values

Int64 - Returns the remainder portion of the division operation.

Remarks

A modulus operation is used to calculate the remainder of a division operation.

Exceptions

Exception | Condition
DivideByZeroException | Attempt to divide by zero.

Examples

The following code calculates the modulus of two 64-bit integers.

Public Sub Main()
    Dim x As Int64
    Dim y As Int64
    Dim r As Int64

    x = CInt64(500)
    y = CInt64(55)
    r = Int64.Modulus(x, y)

    Debug.Print CorString.Format("The remainder of {0} / {1} = {2}.", x, y, r)
End Sub

'This code produces the following.
'    The remainder of 500 / 55 = 5.

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: Multiply

Multiply

Multiplies two Int64 values returning the product.

 Public Function Multiply(
      ByRef a As Int64,
      ByRef b As Int64 ) As Int64

Parameters

a
[ByRef] Int64. The first value to be multiplied.
b
[ByRef] Int64. The second value to be multiplied.

Return Values

Int64 - The product of a and b.

Examples

The example demonstrates mathematical operations using Int64.

Public Sub Main()
    Dim x As Int64
    Dim y As Int64
    Dim r As Int64

    x = CInt64(55)
    y = CInt64(500)

    r = Int64.Add(x, y)
    PrintOutput "+", x, y, r

    r = Int64.Subtract(x, y)
    PrintOutput "-", x, y, r

    r = Int64.Multiply(x, y)
    PrintOutput "*", x, y, r

    r = Int64.Divide(y, x)
    PrintOutput "/", y, x, r
End Sub

Private Sub PrintOutput(ByVal Op As String, ByRef x As Int64, ByRef y As Int64, ByRef r As Int64)
    Debug.Print CorString.Format("{1} {0} {2} = {3}", Op, x, y, r)
End Sub

' This code produces the following.
'    55 + 500 = 555
'    55 - 500 = -445
'    55 * 500 = 27500
'    500 / 55 = 9

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: Negate

Negate

Returns a new Int64 whose value is the negated value of Value.

 Public Function Negate(
      ByRef Value As Int64 ) As Int64

Parameters

Value
[ByRef] Int64. The value to be negated.

Return Values

Int64 - The negated value of Value.

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: One (get)

One

Returns an Int64 value representing one.

 Public Property Get One ( ) As Int64

Return Values

Int64 - The Int64 with a value of one.

Read Only.

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: Parse

Parse

Converts the string representation of a number to its 64-bit signed integer equivalent.

 Public Function Parse(
      ByRef s As String ) As Int64

Parameters

s
[ByRef] String. A string containing a number to convert.

Return Values

Int64 - A 64-bit signed integer equivalent to the number contained in s.

Remarks

The s parameter contains a number of the form:

[ws][sign]digits[ws]

Elements in square brackets ([ and ]) are optional. The following table describes each element.

Element | Description
ws | Optional white space.
sign | An optional sign.
digits | A sequence of digits ranging from 0 to 9.

The s parameter is interpreted using the NumberStyles.Integer style. In addition to decimal digits, only leading and trailing spaces together with a leading sign are allowed. To explicitly define the style elements that can be present in s, use Int64.ParseEx(String, NumberStyles) or the Int64.Parse(String, NumberStyles, IFormatProvider) method.

A string expression beginning with "0x" or "&h" will be parsed as a hex value.

Exceptions

Exception | Condition
FormatException | s is not in the correct format.
OverflowException | s represents a number less than MinValue or greater than MaxValue.

See Also

Project CorLib Overview

Class Int64Static Overview

ParseEx

TryParse

TryParseEx


Int64Static: ParseEx

ParseEx

Converts the string representation of a number in a specified style and culture-specific format to its 64-bit signed integer equivalent.

 Public Function ParseEx(
      ByRef s As String,
      ByVal Style As NumberStyles,
      ByVal Provider As IFormatProvider ) As Int64

Parameters

s
[ByRef] String. A string containing a number to convert.
Style
[ByVal] NumberStyles. A bitwise combination of enumeration values that indicates the style elements that can be present in s. A typical value to specify is Integer.
Provider
[ByVal] IFormatProvider. An IFormatProvider that supplies culture-specific formatting information about s.

Return Values

Int64 - A 64-bit signed integer equivalent to the number specified in s.

Remarks

The Style parameter defines the style elements (such as white space or the positive sign) that are allowed in the s parameter for the parse operation to succeed. It must be a combination of bit flags from the NumberStyles enumeration. Depending on the value of Style, the s parameter may include the following elements:

[ws][$][sign][digits,]digits[.fractional_digits][e[sign]exponential_digits][ws]

Or, if style includes AllowHexSpecifier:

[ws]hexdigits[ws]

Elements in square brackets ([ and ]) are optional. The following table describes each element.

Element | Description
ws | Optional white space. White space can appear at the beginning of s if Style includes the NumberStyles.AllowLeadingWhite flag, and it can appear at the end of s if Style includes the NumberStyles.AllowTrailingWhite flag.
$ | A culture-specific currency symbol. Its position in the string is defined by the NumberFormatInfo.CurrencyPositivePattern property of the NumberFormatInfo object returned by the GetFormat method of the Provider parameter. The currency symbol can appear in s if style includes the NumberStyles.AllowCurrencySymbol flag.
digits fractional_digits expontial_digits | A sequence of digits from 0 through 9.
, | A culture-specific thousands separator symbol. The thousands separator of the culture specified by Provider can appear in s if Style includes the NumberStyles.AllowThousands flag.
. | A culture-specific decimal point symbol. The decimal point symbol of the culture specified by Provider can appear in s if style includes the NumberStyles.AllowDecimalPoint flag. Only the digit 0 can appear as a fractional digit for the parse operation to succeed; if fractional_digits includes any other digit, an OverflowException is thrown.
e | The e' or 'E' character, which indicates that the value is represented in exponential notation. The s parameter can represent a number in exponential notation if Style includes the NumberStyles.AllowExponent flag.
hexdigits | A sequence of hexadecimal digits from 0 through f, or 0 through F.

A string expression beginning with "0x" or "&h" will be parsed as a hex value.

Exceptions

Exception | Condition
FormatException | s is not in the correct format.
OverflowException | s represents a number less than MinValue or greater than MaxValue.

See Also

Project CorLib Overview

Class Int64Static Overview

Parse

TryParse

TryParseEx


Int64Static: ShiftLeft

ShiftLeft

Performs a left shift operation on an Int64.

 Public Function ShiftLeft(
      ByRef Value As Int64,
      ByVal BitCount As Long ) As Int64

Parameters

Value
[ByRef] Int64. The to shift left.
BitCount
[ByVal] Long. The number of bits the value is to be shifted left.

Return Values

Int64 - Returns a new Int64 containing the shifted value.

Remarks

If BitCount is negative, then a right shift is performed.

See Also

Project CorLib Overview

Class Int64Static Overview

ShiftRight


Int64Static: ShiftRight

ShiftRight

Performs a right shift operation on an Int64.

 Public Function ShiftRight(
      ByRef Value As Int64,
      ByVal BitCount As Long ) As Int64

Parameters

Value
[ByRef] Int64. The to shift right.
BitCount
[ByVal] Long. The number of bits the value is to be shifted right.

Return Values

Int64 - Returns a new Int64 containing the shifted value.

Remarks

If BitCount is negative, then a left shift is performed.

See Also

Project CorLib Overview

Class Int64Static Overview

ShiftLeft


Int64Static: Sign

Sign

Returns an integer indicating the sign of the value.

 Public Function Sign(
      ByRef Value As Int64 ) As Long

Parameters

Value
[ByRef] Int64. The number to return the sign of.

Return Values

Long - The sign of the number.
Value | Meaning
1 | Value is greater than zero.
0 | Value equals zero.
-1 | Value is less than zero.

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: Subtract

Subtract

Returns the difference of two Int64 values.

 Public Function Subtract(
      ByRef a As Int64,
      ByRef b As Int64 ) As Int64

Parameters

a
[ByRef] Int64. The value to be subtracted from.
b
[ByRef] Int64. The value to be subtracted.

Return Values

Int64 - The difference of a and b.

Examples

The example demonstrates mathematical operations using Int64.

Public Sub Main()
    Dim x As Int64
    Dim y As Int64
    Dim r As Int64

    x = CInt64(55)
    y = CInt64(500)

    r = Int64.Add(x, y)
    PrintOutput "+", x, y, r

    r = Int64.Subtract(x, y)
    PrintOutput "-", x, y, r

    r = Int64.Multiply(x, y)
    PrintOutput "*", x, y, r

    r = Int64.Divide(y, x)
    PrintOutput "/", y, x, r
End Sub

Private Sub PrintOutput(ByVal Op As String, ByRef x As Int64, ByRef y As Int64, ByRef r As Int64)
    Debug.Print CorString.Format("{1} {0} {2} = {3}", Op, x, y, r)
End Sub

' This code produces the following.
'    55 + 500 = 555
'    55 - 500 = -445
'    55 * 500 = 27500
'    500 / 55 = 9

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: ToDecimal

ToDecimal

Converts an Int64 value to a type Decimal.

 Public Function ToDecimal(
      ByRef Value As Int64 ) As Variant

Parameters

Value
[ByRef] Int64. The Int64 value to be converted to a Decimal.

Return Values

Variant - The Decimal value of the Int64.

See Also

Project CorLib Overview

Class Int64Static Overview


Int64Static: ToString

ToString

Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.

 Public Function ToString(
      ByRef Value As Int64,
      Optional ByRef Format As String,
      Optional ByVal Provider As IFormatProvider ) As String

Parameters

Value
[ByRef] Int64. The 64-bit integer to be converted to a string.
Format
[ByRef] Optional. String. A numeric format string.
Provider
[ByVal] Optional. IFormatProvider. An object that supplies culture-specific formatting information about this instance.

Return Values

String - The string representation of the value of this instance as specified by Format and Provider.

Remarks

The Format parameter can be either a standard or a custom numeric format string. All standard numeric format strings other than "R" (or "r") are supported, as are all custom numeric format characters. If Format is not provided or an empty string (""), the return value for this instance is formatted with the general numeric format specifier ("G").

The Provider parameter is an object that implements the IFormatProvider interface. Its GetFormat method returns a NumberFormatInfo object that provides culture-specific information about the format of the string that is returned by this method. The object that implements IFormatProvider can be any of the following:

  • A CultureInfo object that represents the culture whose formatting rules are to be used.
  • A NumberFormatInfo object that contains specific numeric formatting information for this value.
  • A custom object that implements IFormatProvider and whose GetFormat method returns a NumberFormatInfo object that provides formatting information.

If Provider is Nothing or a NumberFormatInfo object cannot be obtained from provider, the return value for this instance is formatted with the NumberFormatInfo for the current culture.

Exceptions

Exception | Condition
FormatException | Format is invalid or not supported.

Examples

The following example displays an Int64 value using the default ToString() method. It also displays the string representations of the Int64 value that results from using a number of standard format specifiers. The examples are displayed using the formatting conventions of the en-US culture.

Public Sub Main()
    Dim Value As Int64

    Value = CInt64(-16325091)

    ' Display value with default ToString method.
    Debug.Print Int64.ToString(Value) '' Displays -16325091

    ' Display value using some standard format specifiers.
    Debug.Print Int64.ToString(Value, "G")  '' Displays -16325091
    Debug.Print Int64.ToString(Value, "C")  '' Displays ($16,325,091.00)
    Debug.Print Int64.ToString(Value, "D")  '' Displays -16325091
    Debug.Print Int64.ToString(Value, "F")  '' Displays -16325091.00
    Debug.Print Int64.ToString(Value, "N")  '' Displays -16,325,091.00
    Debug.Print Int64.ToString(Value, "X")  '' Displays FFFFFFFFFF06E61D
End Sub

See Also

Project CorLib Overview

Class Int64Static Overview

IFormatProvider


Int64Static: TryParse

TryParse

Converts the string representation of a number to its 64-bit signed integer equivalent. A return value indicates whether the conversion succeeded or failed.

 Public Function TryParse(
      ByRef s As String,
      ByRef Result As Int64 ) As Boolean

Parameters

s
[ByRef] String. A string containing a number to convert.
Result
[ByRef] Int64. When this method returns, contains the 64-bit signed integer value equivalent of the number contained in s, if the conversion succeeded, or zero if the conversion failed. The conversion fails if the s parameter is empty, is not in a format compliant withstyle, or represents a number less than MinValue or greater than MaxValue. This parameter is passed uninitialized; any value originally supplied in Result will be overwritten.

Return Values

Boolean - True if s was converted successfully; otherwise, False.

Remarks

The TryParse method is like the Parse method, except the TryParse method does not throw an exception if the conversion fails. It eliminates the need to use exception handling to test for a FormatException in the event that s is invalid and cannot be successfully parsed.

The s parameter contains a number of the form:

[ws][sign]digits[ws]

Elements in square brackets ([ and ]) are optional. The following table describes each element.

Element | Description
ws | Optional white space.
sign | An optional sign.
digits | A sequence of digits ranging from 0 to 9.

The s parameter is interpreted using the NumberStyles.Integer style. In addition to decimal digits, only leading and trailing spaces together with a leading sign are allowed. To explicitly define the style elements that can be present in s, use Int64.ParseEx(String, NumberStyles) or the Int64.Parse(String, NumberStyles, IFormatProvider) method.

A string expression beginning with "0x" or "&h" will be parsed as a hex value.

See Also

Project CorLib Overview

Class Int64Static Overview

Parse

ParseEx

TryParseEx


Int64Static: TryParseEx

TryParseEx

Converts the string representation of a number in a specified style and culture-specific format to its 64-bit signed integer equivalent.

 Public Function TryParseEx(
      ByRef s As String,
      ByVal Style As NumberStyles,
      ByVal Provider As IFormatProvider,
      ByRef Result As Int64 ) As Boolean

Parameters

s
[ByRef] String. A string containing a number to convert.
Style
[ByVal] NumberStyles. A bitwise combination of enumeration values that indicates the style elements that can be present in s. A typical value to specify is Integer.
Provider
[ByVal] IFormatProvider. An IFormatProvider that supplies culture-specific formatting information about s.
Result
[ByRef] Int64. When this method returns, contains the 64-bit signed integer value equivalent of the number contained in s, if the conversion succeeded, or zero if the conversion failed. The conversion fails if the s parameter is empty, is not in a format compliant withstyle, or represents a number less than MinValue or greater than MaxValue. This parameter is passed uninitialized; any value originally supplied in Result will be overwritten.

Return Values

Boolean - True if s was converted successfully; otherwise, False.

Remarks

The Style parameter defines the style elements (such as white space or the positive sign) that are allowed in the s parameter for the parse operation to succeed. It must be a combination of bit flags from the NumberStyles enumeration. Depending on the value of Style, the s parameter may include the following elements:

[ws][$][sign][digits,]digits[.fractional_digits][e[sign]exponential_digits][ws]

Or, if style includes AllowHexSpecifier:

[ws]hexdigits[ws]

Elements in square brackets ([ and ]) are optional. The following table describes each element.

Element | Description
ws | Optional white space. White space can appear at the beginning of s if Style includes the NumberStyles.AllowLeadingWhite flag, and it can appear at the end of s if Style includes the NumberStyles.AllowTrailingWhite flag.
$ | A culture-specific currency symbol. Its position in the string is defined by the NumberFormatInfo.CurrencyPositivePattern property of the NumberFormatInfo object returned by the GetFormat method of the Provider parameter. The currency symbol can appear in s if style includes the NumberStyles.AllowCurrencySymbol flag.
digits fractional_digits expontial_digits | A sequence of digits from 0 through 9.
, | A culture-specific thousands separator symbol. The thousands separator of the culture specified by Provider can appear in s if Style includes the NumberStyles.AllowThousands flag.
. | A culture-specific decimal point symbol. The decimal point symbol of the culture specified by Provider can appear in s if style includes the NumberStyles.AllowDecimalPoint flag. Only the digit 0 can appear as a fractional digit for the parse operation to succeed; if fractional_digits includes any other digit, an OverflowException is thrown.
e | The e' or 'E' character, which indicates that the value is represented in exponential notation. The s parameter can represent a number in exponential notation if Style includes the NumberStyles.AllowExponent flag.
hexdigits | A sequence of hexadecimal digits from 0 through f, or 0 through F.

A string expression beginning with "0x" or "&h" will be parsed as a hex value.

See Also

Project CorLib Overview

Class Int64Static Overview

Parse

ParseEx

TryParse


Int64Static: Zero (get)

Zero

Returns an Int64 value representing zero.

 Public Property Get Zero ( ) As Int64

Return Values

Int64 - The Int64 with zero value.

Read Only.

See Also

Project CorLib Overview

Class Int64Static Overview


InvalidCastException

InvalidCastException

The exception that is thrown for invalid casting or explicit conversion.

Implements:

Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

Remarks

This exception is thrown for the same reasone a type mismatch would be thrown. There may be additional situations in which this exception is thrown.

See Also

Project CorLib Overview

Class InvalidCastException Overview

Constructors

ExceptionMethods

Exception


InvalidCastException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Read Only.

See Also

Project CorLib Overview

Class InvalidCastException Overview


InvalidCastException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class InvalidCastException Overview


InvalidCastException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class InvalidCastException Overview


InvalidCastException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class InvalidCastException Overview


InvalidCastException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class InvalidCastException Overview


InvalidCastException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class InvalidCastException Overview


InvalidCastException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class InvalidCastException Overview


InvalidCastException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class InvalidCastException Overview


InvalidCastException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class InvalidCastException Overview

Exception


InvalidCastException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class InvalidCastException Overview


InvalidCastException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class InvalidCastException Overview


InvalidCastException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewSystemException.

Read Only.

See Also

Project CorLib Overview

Class InvalidCastException Overview


InvalidCastException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class InvalidCastException Overview


InvalidCastException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class InvalidCastException Overview


InvalidCastException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class InvalidCastException Overview


InvalidCastException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class InvalidCastException Overview


InvalidOperationException

InvalidOperationException

The exception that is thrown when a method call is invalid for the objects current state.

Implements:

Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

Remarks

InvalidOperationException is used in cases when the failure to invoke a method is caused by reasons other than invalid arguments.

See Also

Project CorLib Overview

Class InvalidOperationException Overview

Constructors

ExceptionMethods

Exception


InvalidOperationException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class InvalidOperationException Overview


InvalidOperationException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class InvalidOperationException Overview


InvalidOperationException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class InvalidOperationException Overview


InvalidOperationException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class InvalidOperationException Overview


InvalidOperationException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class InvalidOperationException Overview


InvalidOperationException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class InvalidOperationException Overview


InvalidOperationException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class InvalidOperationException Overview


InvalidOperationException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class InvalidOperationException Overview


InvalidOperationException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class InvalidOperationException Overview

Exception


InvalidOperationException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class InvalidOperationException Overview


InvalidOperationException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class InvalidOperationException Overview


InvalidOperationException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewSystemException.

Read Only.

See Also

Project CorLib Overview

Class InvalidOperationException Overview


InvalidOperationException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class InvalidOperationException Overview


InvalidOperationException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class InvalidOperationException Overview


InvalidOperationException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class InvalidOperationException Overview


InvalidOperationException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class InvalidOperationException Overview


IObject

IObject

This is the base interface to allow objects to be utilized throughout most of VBCorLib.

Public:

Methods:

Name | Description
Equals | Determines whether the specified value is equal to the current IObject.
GetHashCode | Serves as a hash function for a particular type.
ToString | Returns a string representation of the current object.

Remarks

The IObject interface is a low-level interface utilized by VBCorLib to provide basic services when interacting with objects. Many of the classes in VBCorLib implement this interface. By implementing this interface in new classes, those classes can be better serviced by the VBCorLib eco-system.

If this interface is implemented, then the same methods should be implemented in the normal public interface to maintain consistency.

If a class is not expected to be used by VBCorLib, then implementing this interface is not necessary.

Examples

The following code example shows a common default implementation of the IObject interface. It simply forwards calls to default method implementations through the MyBase global property.

Override the individual methods for custom functionality.

Implements IObject

Public Function Equals(ByRef Value As Variant) As Boolean
    Equals = MyBase.Equals(Me, Value)
End Function

Public Function GetHashCode() As Long
    GetHashCode = MyBase.GetHashCode(Me)
End Function

Public Function ToString() As String
    ToString = MyBase.ToString(Me, App)
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Object Interface
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IObject_Equals(Value As Variant) As Boolean
    IObject_Equals = Equals(Value)
End Function

Private Function IObject_GetHashCode() As Long
    IObject_GetHashCode = GetHashCode
End Function

Private Function IObject_ToString() As String
    IObject_ToString = ToString
End Function

See Also

Project CorLib Overview

Class IObject Overview


IObject: Equals

Equals

Determines whether the specified value is equal to the current IObject.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare the current IObject.

Return Values

Boolean - True if the specified value is equal to the current IObject; otherwise, False.

Remarks

The Equals method is used to check for equality between two objects. It is up to each object to perform the equality check through the Equals so VBCorLib can function correctly when handling objects.

The Equals method should be overridden to provide the type of equality checking that is appropriate for each class. Most classes simply check to see if the value is the same object instance as this object, meaning, they are both the same object in memory. For example CorDateTime checks for equality by comparing the dates of the two objects. And TimeSpan checks to see if the value has the same number of milliseconds to determine equality.

This method should not throw an exception. If a value passed in cannot be used for comparison then False should be returned.

Examples

The following code example demonstrates an implementation of the Equals method that may be more appropriate than the default method.

A Point class is created with the IObject interface appropriate for the class.

There are two modules created for this example. A BAS module containing the Main method and a Class module implementing the IComparer interface.

The following is a Visual Basic Class module named Point.

Option Explicit
Implements IObject

Public X As Long
Public Y As Long

Public Function Copy() As Point
    Set Copy = New Point
    Copy.X = X
    Copy.Y = Y
End Function

Public Function Equals(ByRef Value As Variant) As Boolean
    Dim Other As Point

    ' we check for equality by comparing the X and Y
    ' values from the other Point object.
    On Error GoTo Catch
    Set Other = Value
    Equals = Other.X = X And Other.Y = Y

Catch:
End Function

Public Function GetHashCode() As Long
    ' generate a hashcode using fields that are
    ' used to represent this Point object.
    GetHashCode = LShift(X, 1) Xor Y
End Function

Public Function ToString() As String
    ' output a string representation of this Point object.
    ToString = CorString.Format("({0}, {1})", X, Y)
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' IObject Interface
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IObject_Equals(Value As Variant) As Boolean
    IObject_Equals = Equals(Value)
End Function

Private Function IObject_GetHashCode() As Long
    IObject_GetHashCode = GetHashCode
End Function

Private Function IObject_ToString() As String
    IObject_ToString = ToString
End Function

The following is a Visual Basic BAS module containing Main start-up method.

Public Sub Main()
    Dim P1 As New Point
    Dim P2 As Point

    P1.X = 1
    P1.Y = 2

    Set P2 = P1.Copy

    Console.WriteLine P1 Is P2
    Console.WriteLine Object.Equals(P1, P2)
    Console.WriteLine "P1's value is: {0}", P1
    Console.ReadKey

' This example produces the following output:
' False
' True
' P1's value is: (1, 2)
End Sub

See Also

Project CorLib Overview

Class IObject Overview


IObject: GetHashCode

GetHashCode

Serves as a hash function for a particular type.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A hash code for the current IObject.

Remarks

A hash code is a numeric value that is used to identify an object during equality testing. It can also serve as an index for an object in a collection.

The GetHashCode method is suitable for use in hashing algorithms and data structures such as a hash table.

The default implementation of the GetHashCode method does not guarantee unique return values for different values. Furthermore, VBCorLib does not guarantee the default implementation of the GetHashCode method, and the value it returns will be the same between different versions of VBCorLib. Consequently, the default implementation of this method must not be used as a unique object identifier for hashing purposes.

Notes to Implementers
A hash function is used to quickly generate a number (hash code) that corresponds to the value of an object. Hash functions are usually specific to each Type and, for uniqueness, must use at least one of the instance fields as input. A hash function must have the following properties:
  • If two values compare as equal, the GetHashCode method for each value must return the same value. However, if two values do not compare as equal, the GetHashCode methods for the two values do not have to return different values.
  • The GetHashCode method for an object must consistently return the same hash code as long as there is no modification to the object state that determines the return value of the objects Equals method. Note that this is true only for the current execution of an application, and that a different hash code can be returned if the application is run again.
  • For the best performance, a hash function must generate a random distribution for all input.

Implementations of the GetHashCode method must not result in circular references. For example, if ClassA.GetHashCode calls ClassB.GetHashCode, ClassB.GetHashCode must not call ClassA.GetHashCode either directly or indirectly.

Implementations of the GetHashCode method must not throw exceptions.

Examples

The following code demonstrates an implementation of the GetHashCode method. This does not show the complete implementation of the IObject interface.

Implements IObject

Public X As Long

Public Y As Long

Public Function GetHashCode() As Long
    GetHashCode = X Xor Y
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IObject
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IObject_GetHashCode() As Long
    IObject_GetHashCode = GetHashCode
End Function

See Also

Project CorLib Overview

Class IObject Overview


IObject: ToString

ToString

Returns a string representation of the current object.

 Public Function ToString ( ) As String

Return Values

String - A string representation of the current object.

Remarks

ToString is the major formatting method in VBCorLib. It converts an object to its string representation so that it is suitable for display.

A default implementation of the ToString method would be to call the MyBase.ToString method as the following example shows.

Implements IObject

Public Function ToString() As String
    ToString = MyBase.ToString(Me, App)
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IObject Implementation
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IObject_ToString() As String
    IObject_ToString = ToString
End Function

Types commonly implement the ToString method to return a string that represents the object instance. For example, the types such as CorDateTime, and StringBuilder provide ToString implementations that return the string form of the value that the object represents. The following example defines a class, Class2, that customizes the ToString method to return the type name along with its value.

Implements IObject

Public Value As Variant

Public Function ToString() As String
    ToString = MyBase.ToString(Me, App) & ": " & Object.ToString(Value)
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IObject Implementation
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IObject_ToString() As String
    IObject_ToString = ToString
End Function

See Also

Project CorLib Overview

Class IObject Overview


IOException

IOException

This exception is thrown when an I/O error occurs.

Implements:

Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

See Also

Project CorLib Overview

Class IOException Overview

Constructors

ExceptionMethods

Exception


IOException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class IOException Overview


IOException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class IOException Overview


IOException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class IOException Overview


IOException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class IOException Overview


IOException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class IOException Overview


IOException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class IOException Overview


IOException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class IOException Overview


IOException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class IOException Overview


IOException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class IOException Overview

Exception


IOException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class IOException Overview


IOException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class IOException Overview


IOException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewSystemException.

Read Only.

See Also

Project CorLib Overview

Class IOException Overview


IOException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class IOException Overview


IOException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class IOException Overview


IOException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class IOException Overview


IOException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class IOException Overview


IResourceDecoder

IResourceDecoder

Provides an interface to allow a ResourceReader to decode resource types found within a .RES file.

Public:

Methods:

Name | Description
Decode | Decodes a raw resource data, returning the number of embedded resources created.
GetDecodeType | Returns the type of resource this decoder can decode.
GetResource | Returns the next resource key and data that was decoded from DecodeResource.

See Also

Project CorLib Overview

Class IResourceDecoder Overview


IResourceDecoder: Decode

Decode

Decodes a raw resource data, returning the number of embedded resources created.

 Public Function Decode(
      ByVal Key As ResourceKey,
      ByRef Bytes ( ) As Byte ) As Long

Parameters

Key
[ByVal] ResourceKey. The key associated with the raw resource data.
Bytes
[ByRef] Byte. The raw resource data to be decoded.

Return Values

Long - The number of resources created from the raw data.

Remarks

The decoder needs to maintain the newly decoded resource. Only one resource is decoded at a time and then retrieved, so the need to maintain multiple decoded resources is unecessary.

See Also

Project CorLib Overview

Class IResourceDecoder Overview


IResourceDecoder: GetDecodeType

GetDecodeType

Returns the type of resource this decoder can decode.

 Public Function GetDecodeType ( ) As Variant

Return Values

Variant - Either the resource name or ID.

See Also

Project CorLib Overview

Class IResourceDecoder Overview


IResourceDecoder: GetResource

GetResource

Returns the next resource key and data that was decoded from DecodeResource.

 Public Function GetResource(
      ByRef ReturnKey As ResourceKey,
      ByRef ReturnValue As Variant ) As Boolean

Parameters

ReturnKey
[ByRef] ResourceKey. The next resource key return to be returned.
ReturnValue
[ByRef] Variant. The next resource value to be returned.

Return Values

Boolean -

Remarks

Returns the next available decoded resource. Once that resource has been returned, it should not be returned again.

This function will be called as long as it returns True.

See Also

Project CorLib Overview

Class IResourceDecoder Overview


IResourceEncoder

IResourceEncoder

Provides an interface for classes to be used to encode data into byte arrays used by the ResourceWriter.

Public:

Methods:

Name | Description
Encode | Encodes a value into a byte array for later retrieval.
GetEncodedResource | Returns the next available resource from the encoder.
Reset | Requests that the encoder release all currently encoded values.

Remarks

An encoder needs to hold multiple encoded resources. Once all resources have been encoded, each resource will be requested one at a time. The same resource should never be returned more than once.

See Also

Project CorLib Overview

Class IResourceEncoder Overview


IResourceEncoder: Encode

Encode

Encodes a value into a byte array for later retrieval.

 Public Function Encode(
      ByRef Value As Variant,
      ByRef ResourceName As Variant,
      Optional ByRef ResourceType As Variant,
      Optional ByRef LanguageID As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to be encoded into a resource compatible byte array.
ResourceName
[ByRef] Variant. The identifier for the specific resource. Should be converted to a string or numeric value.
ResourceType
[ByRef] Optional. Variant. The type of resource. This can be a string or numeric value. If the is value is not supplied, then an attempt to determine the type should be made based on the Value itself.
LanguageID
[ByRef] Optional. Variant. The Locale identifier this resource belongs to. If this value is not supplied, then the current cultures LCID should be used.

Return Values

Boolean - Returns True if the encoder accepted and encoded the value, False otherwise.

Remarks

This function should not throw an exception. If the encoder cannot handle the the value for encoding, it should just return False.

See Also

Project CorLib Overview

Class IResourceEncoder Overview


IResourceEncoder: GetEncodedResource

GetEncodedResource

Returns the next available resource from the encoder.

 Public Function GetEncodedResource(
      ByRef OutKey As ResourceKey,
      ByRef OutValue ( ) As Byte ) As Boolean

Parameters

OutKey
[ByRef] ResourceKey. This is the unique identifier for the resource to be returned.
OutValue
[ByRef] Byte. A byte array representing the encoded resource value.

Return Values

Boolean - Returns True if a resource has been returned, False otherwise.

Remarks

This function should not throw an exception. If there are no more resources to be returned, then False should just be returned.

See Also

Project CorLib Overview

Class IResourceEncoder Overview


IResourceEncoder: Reset

Reset

Requests that the encoder release all currently encoded values.

 Public Sub Reset ( )

See Also

Project CorLib Overview

Class IResourceEncoder Overview


IResourceReader

IResourceReader

Provides a standard interface for resource readers

Public:

Methods:

Name | Description
CloseReader | Closes the resource reader.
GetEnumerator | Returns an enumerator used to enumerate a resource.

Remarks

Implement this interface to allow multiple resource reader types to be shared to read different resources.

See Also

Project CorLib Overview

Class IResourceReader Overview


IResourceReader: CloseReader

CloseReader

Closes the resource reader.

 Public Sub CloseReader ( )

See Also

Project CorLib Overview

Class IResourceReader Overview


IResourceReader: GetEnumerator

GetEnumerator

Returns an enumerator used to enumerate a resource.

 Public Function GetEnumerator ( ) As IDictionaryEnumerator

Return Values

IDictionaryEnumerator - A resource enumerator.

See Also

Project CorLib Overview

Class IResourceReader Overview


IResourceWriter

IResourceWriter

Provides an interface for resource writers.

Public:

Methods:

Name | Description
AddResource | Adds a new resource to the collection of resources to be written.
CloseWriter | Closes the underlying resource file or stream, ensuring all the data has been written to the file.
Generate | Writes all the resources added by the AddResource method to the output file or stream.

Remarks

Implement this interface to allow multiple resource writer types to be shared for different resources.

See Also

Project CorLib Overview

Class IResourceWriter Overview


IResourceWriter: AddResource

AddResource

Adds a new resource to the collection of resources to be written.

 Public Sub AddResource(
      ByRef Value As Variant,
      ByRef ResourceName As Variant,
      Optional ByRef ResourceType As Variant,
      Optional ByRef LanguageID As Variant )

Parameters

Value
[ByRef] Variant. The value of the resource.
ResourceName
[ByRef] Variant. The identifier of the resource value.
ResourceType
[ByRef] Optional. Variant. A number or name of the resource type.
LanguageID
[ByRef] Optional. Variant. A CultureInfo, Culture Name, or LCID.

See Also

Project CorLib Overview

Class IResourceWriter Overview


IResourceWriter: CloseWriter

CloseWriter

Closes the underlying resource file or stream, ensuring all the data has been written to the file.

 Public Sub CloseWriter ( )

Remarks

If necessary, CloseWriter will call the Generate method to output the resources to the underlying file or stream before closing it.

See Also

Project CorLib Overview

Class IResourceWriter Overview


IResourceWriter: Generate

Generate

Writes all the resources added by the AddResource method to the output file or stream.

 Public Sub Generate ( )

Remarks

Generate does not close the output file or output stream. Instead, consider calling the Close method.

Generate is useful when you want to create a resource file, but you dont want to close the output stream.

Generate can be called only once. After you call Generate, all IResourceWriter methods other than CloseWriter will throw an exception.

See Also

Project CorLib Overview

Class IResourceWriter Overview


IVersionable

IVersionable

This interface is used to inspect classes that have changed, like a collection class.

Public:

Properties:

Name | Description
Version (get) | Returns the current version of an object.

See Also

Project CorLib Overview

Class IVersionable Overview


IVersionable: Version (get)

Version

Returns the current version of an object.

 Public Property Get Version ( ) As Long

Return Values

Long - Returns a count that represents the current version of an object.

Remarks

This is primarily used to track if a collection has been modified.

Read Only.

See Also

Project CorLib Overview

Class IVersionable Overview


JapaneseCalendar

JapaneseCalendar

Provides functions for manipulating Japanese dates.

Implements:

Calendar
ICloneable
IObject

Public:

Properties:

Name | Description
AlgorithmType (get) | Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.
Eras (get) | Gets the list of eras in the JapaneseCalendar.
IsReadOnly (get) | Gets a value indicating whether this JapaneseCalendar object is read-only.
MaxSupportedDateTime (get) | Gets the latest date and time supported by the JapaneseCalendar object.
MinSupportedDateTime (get) | Gets the earliest date and time supported by the JapaneseCalendar object.
TwoDigitYearMax (get) | Gets the last year of a 100-year range that can be represented by a 2-digit year.
TwoDigitYearMax (let) | Sets the last year of a 100-year range that can be represented by a 2-digit year.

Methods:

Name | Description
AddDays | Returns a CorDateTime that is the specified number of days away from the specified CorDateTime.
AddHours | Returns a CorDateTime this is the specified number of hours from the original Time.
AddMilliseconds | Returns a CorDateTime this is the specified number of Milliseconds from the original Time.
AddMinutes | Returns a CorDateTime this is the specified number of Minutes from the original Time.
AddMonths | Returns a CorDateTime this is the specified number of Months from the original Time.
AddSeconds | Returns a CorDateTime this is the specified number of Seconds from the original Time.
AddWeeks | Returns a CorDateTime this is the specified number of Weeks from the original Time.
AddYears | Returns a CorDateTime this is the specified number of Years from the original Time.
Clone | Creates a new object that is a copy of the current JapaneseCalendar object.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetDayOfMonth | Returns the day of the months for the specified date.
GetDayOfWeek | Returns the DayOfWeek enum of the specified date.
GetDayOfYear | Returns the day of the year for the specified date.
GetDaysInMonth | Returns the number of days in the specified month.
GetDaysInYear | Returns the number of days in the specified year.
GetEra | Returns the era in the specified Date or CorDateTime.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetHour | Returns the hour of the specified time.
GetLeapMonth | Calculates the leap month for a specified year and era.
GetMilliseconds | Returns the milliseconds of the specified time.
GetMinute | Returns the minute of the specified time.
GetMonth | Returns the month of the specified time.
GetMonthsInYear | Returns the number of months in the specified year.
GetSecond | Returns the second of the specified time.
GetWeekOfYear | Returns the week of the year that the specified date belongs to.
GetYear | Returns the year of the specified time.
IsLeapDay | Returns a boolean indicating if the specific day is a leap day.
IsLeapMonth | Returns a boolean indicating if the specific month is a leap month.
IsLeapYear | Returns a boolean indicating if the specific year is a leap year.
ToDateTime | Returns a Gregorian CorDateTime computed using the specific calendar rules.
ToFourDigitYear | Returns a 4-digit year from a 2-digit number.
ToString | Returns a string representation of this object instance.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview

JapaneseCalendarStatic

Calendar


JapaneseCalendar: AddDays

AddDays

Returns a CorDateTime that is the specified number of days away from the specified CorDateTime.

 Public Function AddDays(
      ByRef Time As Variant,
      ByVal Days As Double ) As CorDateTime

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to add days to.
Days
[ByVal] Double. The number of days to add.

Return Values

CorDateTime - The CorDateTime that results from adding the specified number of days to the specified CorDateTime.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: AddHours

AddHours

Returns a CorDateTime this is the specified number of hours from the original Time.

 Public Function AddHours(
      ByRef Time As Variant,
      ByVal Hours As Double ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of hours to.
Hours
[ByVal] Double. The number of hours to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of hours added.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: AddMilliseconds

AddMilliseconds

Returns a CorDateTime this is the specified number of Milliseconds from the original Time.

 Public Function AddMilliseconds(
      ByRef Time As Variant,
      ByVal Milliseconds As Double ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Milliseconds to.
Milliseconds
[ByVal] Double. The number of Milliseconds to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Milliseconds added.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: AddMinutes

AddMinutes

Returns a CorDateTime this is the specified number of Minutes from the original Time.

 Public Function AddMinutes(
      ByRef Time As Variant,
      ByVal Minutes As Double ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Minutes to.
Minutes
[ByVal] Double. The number of Minutes to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Minutes added.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: AddMonths

AddMonths

Returns a CorDateTime this is the specified number of Months from the original Time.

 Public Function AddMonths(
      ByRef Time As Variant,
      ByVal Months As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Months to.
Months
[ByVal] Long. The number of Months to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Months added.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: AddSeconds

AddSeconds

Returns a CorDateTime this is the specified number of Seconds from the original Time.

 Public Function AddSeconds(
      ByRef Time As Variant,
      ByVal Seconds As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Seconds to.
Seconds
[ByVal] Long. The number of Seconds to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Seconds added.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: AddWeeks

AddWeeks

Returns a CorDateTime this is the specified number of Weeks from the original Time.

 Public Function AddWeeks(
      ByRef Time As Variant,
      ByVal Weeks As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Weeks to.
Weeks
[ByVal] Long. The number of Weeks to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Weeks added.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: AddYears

AddYears

Returns a CorDateTime this is the specified number of Years from the original Time.

 Public Function AddYears(
      ByRef Time As Variant,
      ByVal Years As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Years to.
Years
[ByVal] Long. The number of Years to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Years added.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: AlgorithmType (get)

AlgorithmType

Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.

 Public Property Get AlgorithmType ( ) As CalendarAlgorithmType

Return Values

CalendarAlgorithmType - Always returns CalendarAlgorithmType.SolarCalendar.

Read Only.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: Calendar

Calendar

 Implements Calendar

Return Values

Calendar -

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: Clone

Clone

Creates a new object that is a copy of the current JapaneseCalendar object.

 Public Function Clone ( ) As JapaneseCalendar

Return Values

JapaneseCalendar - A copy of the JapaneseCalendar object.

Remarks

The clone will always be a non-readonly version.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: Eras (get)

Eras

Gets the list of eras in the JapaneseCalendar.

 Public Property Get Eras ( ) As Long ( )

Return Values

Long() - An array of integers that represents the eras in the JapaneseCalendar.

Remarks

The Japanese calendar recognizes one era for every emperors reign. The current era is the Heisei era, which began in the Gregorian calendar year 1989. The era name is typically displayed before the year. For example, the Gregorian calendar year 2001 is the Japanese calendar year Heisei 13. Note that the first year of an era is called "Gannen." Therefore, the Gregorian calendar year 1989 was the Japanese calendar year Heisei Gannen.

This class assigns numbers to the eras as follows:

GetEra Value | Era Name | Era Abbreviation | Gregorian Dates
4 | 平成 (Heisei) | 平 (H, h) | January 8, 1989 to present
3 | 昭和 (Showa) | 昭 (S, s) | December 25, 1926 to January 7, 1989
2 | 大正 (Taisho) | 大 (T, t) | July 30, 1912 to December 24, 1926
1 | 明治 (Meiji) | 明 (M, m) | September 8, 1868 to July 29, 1912

This class handles dates from September 8 in the year Meiji 1 (January 1, 1868 of the Gregorian calendar). Although the Japanese calendar was switched from a lunar calendar to a solar calendar in the year Meiji 6 (1873 of the Gregorian calendar), this implementation is based on the solar calendar only.

Read Only.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: GetDayOfMonth

GetDayOfMonth

Returns the day of the months for the specified date.

 Public Function GetDayOfMonth(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The date inwhich to retrieve the day of the month.

Return Values

Long - An integer from 1 to 31 that represents the day of the month in the specified Date or CorDateTime.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: GetDayOfWeek

GetDayOfWeek

Returns the DayOfWeek enum of the specified date.

 Public Function GetDayOfWeek(
      ByRef Time As Variant ) As DayOfWeek

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to read the day of the week from.

Return Values

DayOfWeek - A DayOfWeek enum representing the day of the week.

Remarks

The DayOfWeek is Sunday and is 0-based. The Visual Basic enum vbDayOfWeek is 1-based.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: GetDayOfYear

GetDayOfYear

Returns the day of the year for the specified date.

 Public Function GetDayOfYear(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to read the day of the year from.

Return Values

Long - An integer from 1 to 366 that represents the day of the year in the specified Date or CorDateTime.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: GetDaysInMonth

GetDaysInMonth

Returns the number of days in the specified month.

 Public Function GetDaysInMonth(
      ByVal Year As Long,
      ByVal Month As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year inwhich the month exists. This is used by calendars that have months that change based on the year, such as leap years.
Month
[ByVal] Long. The month to retrieve the number of days of.
Era
[ByRef] Optional. Variant. The time period inwhich the year exists.

Return Values

Long -

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: GetDaysInYear

GetDaysInYear

Returns the number of days in the specified year.

 Public Function GetDaysInYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year to retrieve the number of days of.
Era
[ByRef] Optional. Variant. The era the year exists in.

Return Values

Long - The number of days in the year.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: GetEra

GetEra

Returns the era in the specified Date or CorDateTime.

 Public Function GetEra(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to read.

Return Values

Long - An integer that represents the era in the specified Date or CorDateTime.

Remarks

The Japanese calendar recognizes one era for every emperors reign. The current era is the Heisei era, which began in the Gregorian calendar year 1989. The era name is typically displayed before the year. For example, the Gregorian calendar year 2001 is the Japanese calendar year Heisei 13. Note that the first year of an era is called "Gannen." Therefore, the Gregorian calendar year 1989 was the Japanese calendar year Heisei Gannen.

This class assigns numbers to the eras as follows:

GetEra Value | Era Name | Era Abbreviation | Gregorian Dates
4 | 平成 (Heisei) | 平 (H, h) | January 8, 1989 to present
3 | 昭和 (Showa) | 昭 (S, s) | December 25, 1926 to January 7, 1989
2 | 大正 (Taisho) | 大 (T, t) | July 30, 1912 to December 24, 1926
1 | 明治 (Meiji) | 明 (M, m) | September 8, 1868 to July 29, 1912

Ordinarily, the JapaneseCalendar class supports dates from September 8 in the year Meiji 1 (September 8, 1868 of the Gregorian calendar), which is the value of the MinSupportedDateTime property. However, the GetEra method successfully returns the era for dates from January 1 through September 7 in the year Meiji 1 (January 1, 1868 through September 7, 1868 in the Gregorian calendar). For dates earlier than January 1, 1868 in the Gregorian calendar, the method throws an ArgumentOutOfRangeException exception.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: GetHour

GetHour

Returns the hour of the specified time.

 Public Function GetHour(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the hour from.

Return Values

Long - The hour portion of the Time.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: GetLeapMonth

GetLeapMonth

Calculates the leap month for a specified year and era.

 Public Function GetLeapMonth(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. A year.
Era
[ByRef] Optional. Variant. An era.

Return Values

Long - Always 0 because the JapaneseCalendar does not recognize leap months.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: GetMilliseconds

GetMilliseconds

Returns the milliseconds of the specified time.

 Public Function GetMilliseconds(
      ByRef Time As Variant ) As Double

Parameters

Time
[ByRef] Variant. The time to retrieve the milliseconds from.

Return Values

Double - The millisecond portion of the Time.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: GetMinute

GetMinute

Returns the minute of the specified time.

 Public Function GetMinute(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the minute from.

Return Values

Long - The minute portion of the Time.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: GetMonth

GetMonth

Returns the month of the specified time.

 Public Function GetMonth(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the month from.

Return Values

Long - The month portion of the Time.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: GetMonthsInYear

GetMonthsInYear

Returns the number of months in the specified year.

 Public Function GetMonthsInYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year to get the number of months of.
Era
[ByRef] Optional. Variant. The era the year exists in.

Return Values

Long - The number of months in the year.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: GetSecond

GetSecond

Returns the second of the specified time.

 Public Function GetSecond(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the second from.

Return Values

Long - The second portion of the Time.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: GetWeekOfYear

GetWeekOfYear

Returns the week of the year that the specified date belongs to.

 Public Function GetWeekOfYear(
      ByRef Time As Variant,
      ByVal Rule As CalendarWeekRule,
      ByVal FirstDayOfWeek As DayOfWeek ) As Long

Parameters

Time
[ByRef] Variant. The date to find the week it belongs.
Rule
[ByVal] CalendarWeekRule. Rule to decide what constitutes the first week of the year.
FirstDayOfWeek
[ByVal] DayOfWeek. Defines which week day is the start of a new week.

Return Values

Long - The week that the date belongs to.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: GetYear

GetYear

Returns the year of the specified time.

 Public Function GetYear(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the year from.

Return Values

Long - The year portion of the Time.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: IsLeapDay

IsLeapDay

Returns a boolean indicating if the specific day is a leap day.

 Public Function IsLeapDay(
      ByVal Year As Long,
      ByVal Month As Long,
      ByVal Day As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year the day is in.
Month
[ByVal] Long. The month the day is in.
Day
[ByVal] Long. The day to check if is a leap day.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the day is a leap day.

Remarks

A leap day only exists in a leap year, such as February 29th in the Gregorian calendar.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: IsLeapMonth

IsLeapMonth

Returns a boolean indicating if the specific month is a leap month.

 Public Function IsLeapMonth(
      ByVal Year As Long,
      ByVal Month As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year the month is in.
Month
[ByVal] Long. The month to check if it is a leap month.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the month is a leap month.

Remarks

This method a always returns False.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: IsLeapYear

IsLeapYear

Returns a boolean indicating if the specific year is a leap year.

 Public Function IsLeapYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year to check if is a leap year.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the year is a leap year.

Remarks

A leap year in the Gregorian calendar occurs when the year is evenly divisible by 4, but not by 100, unless it is divisible by 400.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: IsReadOnly (get)

IsReadOnly

Gets a value indicating whether this JapaneseCalendar object is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - True if this JapaneseCalendar object is read-only; otherwise, False.

Read Only.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: MaxSupportedDateTime (get)

MaxSupportedDateTime

Gets the latest date and time supported by the JapaneseCalendar object.

 Public Property Get MaxSupportedDateTime ( ) As CorDateTime

Return Values

CorDateTime - The latest date and time supported by the JapaneseCalendar which is the last moment of December 31, 9999 C.E. in the Gregorian calendar.

Read Only.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: MinSupportedDateTime (get)

MinSupportedDateTime

Gets the earliest date and time supported by the JapaneseCalendar object.

 Public Property Get MinSupportedDateTime ( ) As CorDateTime

Return Values

CorDateTime - The earliest date and time supported by the JapaneseCalendar which is September 8, 1868 C.E in the Gregorian calendar.

Read Only.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: ToDateTime

ToDateTime

Returns a Gregorian CorDateTime computed using the specific calendar rules.

 Public Function ToDateTime(
      ByVal Year As Long,
      ByVal Month As Long,
      ByVal Day As Long,
      ByVal Hour As Long,
      ByVal Minute As Long,
      ByVal Second As Long,
      ByVal Millisecond As Long,
      Optional ByRef Era As Variant ) As CorDateTime

Parameters

Year
[ByVal] Long. The Year in the specific calendar type.
Month
[ByVal] Long. The Month in the specific calendar type.
Day
[ByVal] Long. The Day in the specific calendar type.
Hour
[ByVal] Long. The hour for the new time.
Minute
[ByVal] Long. The minute for the new time.
Second
[ByVal] Long. The second for the new time.
Millisecond
[ByVal] Long. The milliseconds for the new time.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

CorDateTime - A Gregorian version of the date specified.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: ToFourDigitYear

ToFourDigitYear

Returns a 4-digit year from a 2-digit number.

 Public Function ToFourDigitYear(
      ByVal Year As Long ) As Long

Parameters

Year
[ByVal] Long. The year to be converted to 4-digits.

Return Values

Long - A 4-digit year in the specific calendar.

Remarks

Because the year in the Japanese calendar is typically less than four digits long, this implementation always returns the value of the year parameter.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: TwoDigitYearMax (get)

TwoDigitYearMax

Gets the last year of a 100-year range that can be represented by a 2-digit year.

 Public Property Get TwoDigitYearMax ( ) As Long

Return Values

Long - The last year of a 100-year range that can be represented by a 2-digit year.

Read/Write.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JapaneseCalendar: TwoDigitYearMax (let)

TwoDigitYearMax

Sets the last year of a 100-year range that can be represented by a 2-digit year.

 Public Property Let TwoDigitYearMax(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The last year of a 100-year range that can be represented by a 2-digit year.

Read/Write.

See Also

Project CorLib Overview

Class JapaneseCalendar Overview


JulianCalendar

JulianCalendar

Provides methods to manipulate Julian dates.

Implements:

Calendar
ICloneable
IObject

Public:

Properties:

Name | Description
AlgorithmType (get) | Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.
Eras (get) | Gets the list of eras in the JulianCalendar.
IsReadOnly (get) | Gets a value indicating whether this JulianCalendar object is read-only.
MaxSupportedDateTime (get) | Gets the latest date and time supported by this JulianCalendar object.
MinSupportedDateTime (get) | Gets the earliest date and time supported by this JulianCalendar object.
TwoDigitYearMax (get) | Gets the last year of a 100-year range that can be represented by a 2-digit year.
TwoDigitYearMax (let) | Sets the last year of a 100-year range that can be represented by a 2-digit year.

Methods:

Name | Description
AddDays | Returns a CorDateTime that is the specified number of days away from the specified CorDateTime.
AddHours | Returns a CorDateTime this is the specified number of hours from the original Time.
AddMilliseconds | Returns a CorDateTime this is the specified number of Milliseconds from the original Time.
AddMinutes | Returns a CorDateTime this is the specified number of Minutes from the original Time.
AddMonths | Returns a CorDateTime this is the specified number of Months from the original Time.
AddSeconds | Returns a CorDateTime this is the specified number of Seconds from the original Time.
AddWeeks | Returns a CorDateTime this is the specified number of Weeks from the original Time.
AddYears | Returns a CorDateTime this is the specified number of Years from the original Time.
Clone | Creates a new object that is a copy of the current JulianCalendar object.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetDayOfMonth | Returns the day of the months for the specified date.
GetDayOfWeek | Returns the DayOfWeek enum of the specified date.
GetDayOfYear | Returns the day of the year for the specified date.
GetDaysInMonth | Returns the number of days in the specified month.
GetDaysInYear | Returns the number of days in the specified year.
GetEra | Returns the era that the specified time exists in.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetHour | Returns the hour of the specified time.
GetLeapMonth | Calculates the leap month for a specified year and era.
GetMilliseconds | Returns the milliseconds of the specified time.
GetMinute | Returns the minute of the specified time.
GetMonth | Returns the month of the specified time.
GetMonthsInYear | Returns the number of months in the specified year.
GetSecond | Returns the second of the specified time.
GetWeekOfYear | Returns the week of the year that the specified date belongs to.
GetYear | Returns the year of the specified time.
IsLeapDay | Returns a boolean indicating if the specific day is a leap day.
IsLeapMonth | Returns a boolean indicating if the specific month is a leap month.
IsLeapYear | Returns a boolean indicating if the specific year is a leap year.
ToDateTime | Returns a Gregorian CorDateTime computed using the specific calendar rules.
ToFourDigitYear | Converts the specified year to a four-digit year by using the TwoDigitYearMax property to determine the appropriate century.
ToString | Returns a string representation of this object instance.

See Also

Project CorLib Overview

Class JulianCalendar Overview

JulianCalendarStatic

Calendar


JulianCalendar: AddDays

AddDays

Returns a CorDateTime that is the specified number of days away from the specified CorDateTime.

 Public Function AddDays(
      ByRef Time As Variant,
      ByVal Days As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to add days to.
Days
[ByVal] Long. The number of days to add.

Return Values

CorDateTime - The CorDateTime that results from adding the specified number of days to the specified CorDateTime.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: AddHours

AddHours

Returns a CorDateTime this is the specified number of hours from the original Time.

 Public Function AddHours(
      ByRef Time As Variant,
      ByVal Hours As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of hours to.
Hours
[ByVal] Long. The number of hours to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a with the specified number of hours added.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: AddMilliseconds

AddMilliseconds

Returns a CorDateTime this is the specified number of Milliseconds from the original Time.

 Public Function AddMilliseconds(
      ByRef Time As Variant,
      ByVal Milliseconds As Double ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Milliseconds to.
Milliseconds
[ByVal] Double. The number of Milliseconds to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Milliseconds added.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: AddMinutes

AddMinutes

Returns a CorDateTime this is the specified number of Minutes from the original Time.

 Public Function AddMinutes(
      ByRef Time As Variant,
      ByVal Minutes As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Minutes to.
Minutes
[ByVal] Long. The number of Minutes to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Minutes added.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: AddMonths

AddMonths

Returns a CorDateTime this is the specified number of Months from the original Time.

 Public Function AddMonths(
      ByRef Time As Variant,
      ByVal Months As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Months to.
Months
[ByVal] Long. The number of Months to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Months added.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: AddSeconds

AddSeconds

Returns a CorDateTime this is the specified number of Seconds from the original Time.

 Public Function AddSeconds(
      ByRef Time As Variant,
      ByVal Seconds As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Seconds to.
Seconds
[ByVal] Long. The number of Seconds to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Seconds added.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: AddWeeks

AddWeeks

Returns a CorDateTime this is the specified number of Weeks from the original Time.

 Public Function AddWeeks(
      ByRef Time As Variant,
      ByVal Weeks As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Weeks to.
Weeks
[ByVal] Long. The number of Weeks to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Weeks added.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: AddYears

AddYears

Returns a CorDateTime this is the specified number of Years from the original Time.

 Public Function AddYears(
      ByRef Time As Variant,
      ByVal Years As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Years to.
Years
[ByVal] Long. The number of Years to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Years added.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: AlgorithmType (get)

AlgorithmType

Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.

 Public Property Get AlgorithmType ( ) As CalendarAlgorithmType

Return Values

CalendarAlgorithmType - Always returns CalendarAlgorithmType.SolarCalendar.

Read Only.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: Calendar

Calendar

 Implements Calendar

Return Values

Calendar -

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: Clone

Clone

Creates a new object that is a copy of the current JulianCalendar object.

 Public Function Clone ( ) As JulianCalendar

Return Values

JulianCalendar - A copy of the JulianCalendar object.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: Eras (get)

Eras

Gets the list of eras in the JulianCalendar.

 Public Property Get Eras ( ) As Long ( )

Return Values

Long() - An array of integers that represents the eras in the JulianCalendar.

Remarks

The JulianCalendar class recognizes only the current era. This property always returns an array with only one element.

Read Only.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: GetDayOfMonth

GetDayOfMonth

Returns the day of the months for the specified date.

 Public Function GetDayOfMonth(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The date inwhich to retrieve the day of the month.

Return Values

Long - The day of the month for the specified date.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: GetDayOfWeek

GetDayOfWeek

Returns the DayOfWeek enum of the specified date.

 Public Function GetDayOfWeek(
      ByRef Time As Variant ) As DayOfWeek

Parameters

Time
[ByRef] Variant. The date to retrieve the day of the week for.

Return Values

DayOfWeek - A DayOfWeek enum representing the day of the week.

Remarks

The DayOfWeek is Sunday and is 0-based. The Visual Basic enum vbDayOfWeek is 1-based.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: GetDayOfYear

GetDayOfYear

Returns the day of the year for the specified date.

 Public Function GetDayOfYear(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The date to retrieve the day of the year from.

Return Values

Long - An integer from 1 to 366 that represents the day of the year in Time.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: GetDaysInMonth

GetDaysInMonth

Returns the number of days in the specified month.

 Public Function GetDaysInMonth(
      ByVal Year As Long,
      ByVal Month As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year inwhich the month exists. This is used by calendars that have months that change based on the year, such as leap years.
Month
[ByVal] Long. The month to retrieve the number of days of.
Era
[ByRef] Optional. Variant. The time period inwhich the year exists.

Return Values

Long -

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: GetDaysInYear

GetDaysInYear

Returns the number of days in the specified year.

 Public Function GetDaysInYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year to retrieve the number of days of.
Era
[ByRef] Optional. Variant. The era the year exists in.

Return Values

Long - The number of days in the year.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: GetEra

GetEra

Returns the era that the specified time exists in.

 Public Function GetEra(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to find the containing era of.

Return Values

Long - The era for the Time.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: GetHour

GetHour

Returns the hour of the specified time.

 Public Function GetHour(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the hour from.

Return Values

Long - The hour portion of the Time.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: GetLeapMonth

GetLeapMonth

Calculates the leap month for a specified year and era.

 Public Function GetLeapMonth(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. A year.
Era
[ByRef] Optional. Variant. An era.

Return Values

Long - Always 0 because the JulianCalendar does not recognize leap months.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: GetMilliseconds

GetMilliseconds

Returns the milliseconds of the specified time.

 Public Function GetMilliseconds(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the milliseconds from.

Return Values

Long - The millisecond portion of the Time.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: GetMinute

GetMinute

Returns the minute of the specified time.

 Public Function GetMinute(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the minute from.

Return Values

Long - The minute portion of the Time.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: GetMonth

GetMonth

Returns the month of the specified time.

 Public Function GetMonth(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the month from.

Return Values

Long - The month portion of the Time.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: GetMonthsInYear

GetMonthsInYear

Returns the number of months in the specified year.

 Public Function GetMonthsInYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year to get the number of months of.
Era
[ByRef] Optional. Variant. The era the year exists in.

Return Values

Long - The number of months in the year.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: GetSecond

GetSecond

Returns the second of the specified time.

 Public Function GetSecond(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the second from.

Return Values

Long - The second portion of the Time.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: GetWeekOfYear

GetWeekOfYear

Returns the week of the year that the specified date belongs to.

 Public Function GetWeekOfYear(
      ByRef Time As Variant,
      ByVal Rule As CalendarWeekRule,
      ByVal FirstDayOfWeek As DayOfWeek ) As Long

Parameters

Time
[ByRef] Variant. The date to find the week it belongs.
Rule
[ByVal] CalendarWeekRule. Rule to decide what constitutes the first week of the year.
FirstDayOfWeek
[ByVal] DayOfWeek. Defines which week day is the start of a new week.

Return Values

Long - The week that the date belongs to.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: GetYear

GetYear

Returns the year of the specified time.

 Public Function GetYear(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the year from.

Return Values

Long - The year portion of the Time.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: IsLeapDay

IsLeapDay

Returns a boolean indicating if the specific day is a leap day.

 Public Function IsLeapDay(
      ByVal Year As Long,
      ByVal Month As Long,
      ByVal Day As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year the day is in.
Month
[ByVal] Long. The month the day is in.
Day
[ByVal] Long. The day to check if is a leap day.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the day is a leap day.

Remarks

Unlike the Gregorian calendar, the Julian calendar defines a leap year as a year that is evenly divisible by four with no exceptions. Therefore, the calendar is inaccurate by one day every 128 years. For example, the year 1999 was not a leap year, but the year 2000 was. A common year has 365 days and a leap year has 366 days.

A leap day is a day that occurs only in a leap year. In the Julian calendar, the 29th day of February is the only leap day.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Year is outside the range supported by the calendar. -or- Month is outside the range supported by the calendar. -or- Day is outside the range supported by the calendar. -or- Era is outside the range supported by the calendar.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: IsLeapMonth

IsLeapMonth

Returns a boolean indicating if the specific month is a leap month.

 Public Function IsLeapMonth(
      ByVal Year As Long,
      ByVal Month As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year the month is in.
Month
[ByVal] Long. The month to check if it is a leap month.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the month is a leap month.

Remarks

Unlike the Gregorian calendar, the Julian calendar defines a leap year as a year that is evenly divisible by four with no exceptions. Therefore, the calendar is inaccurate by one day every 128 years. For example, the year 1999 was not a leap year, but the year 2000 was. A common year has 365 days and a leap year has 366 days.

A leap month is an entire month that occurs only in a leap year. The Julian calendar does not have any leap months.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Year is outside the range supported by the calendar. -or- Month is outside the range supported by the calendar. -or- Era is outside the range supported by the calendar.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: IsLeapYear

IsLeapYear

Returns a boolean indicating if the specific year is a leap year.

 Public Function IsLeapYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year to check if is a leap year.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the year is a leap year.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: IsReadOnly (get)

IsReadOnly

Gets a value indicating whether this JulianCalendar object is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - True if this JulianCalendar object is read-only; otherwise, False.

Read Only.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: MaxSupportedDateTime (get)

MaxSupportedDateTime

Gets the latest date and time supported by this JulianCalendar object.

 Public Property Get MaxSupportedDateTime ( ) As CorDateTime

Return Values

CorDateTime - The latest date and time supported by the JulianCalendar type, which is equivalent to the last moment of December 31, 9999 C.E. in the Gregorian calendar.

Read Only.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: MinSupportedDateTime (get)

MinSupportedDateTime

Gets the earliest date and time supported by this JulianCalendar object.

 Public Property Get MinSupportedDateTime ( ) As CorDateTime

Return Values

CorDateTime - The earliest date and time supported by the JulianCalendar type, which is equivalent to the first moment of January 1, 0001 C.E. in the Gregorian calendar.

Read Only.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: ToDateTime

ToDateTime

Returns a Gregorian CorDateTime computed using the specific calendar rules.

 Public Function ToDateTime(
      ByVal Year As Long,
      ByVal Month As Long,
      ByVal Day As Long,
      ByVal Hour As Long,
      ByVal Minute As Long,
      ByVal Second As Long,
      ByVal Millisecond As Long,
      Optional ByVal Era As Variant ) As CorDateTime

Parameters

Year
[ByVal] Long. The Year in the specific calendar type.
Month
[ByVal] Long. The Month in the specific calendar type.
Day
[ByVal] Long. The Day in the specific calendar type.
Hour
[ByVal] Long. The hour for the new time.
Minute
[ByVal] Long. The minute for the new time.
Second
[ByVal] Long. The second for the new time.
Millisecond
[ByVal] Long. The milliseconds for the new time.
Era
[ByVal] Optional. Variant. The era the year is in.

Return Values

CorDateTime - A Gregorian version of the date specified.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: ToFourDigitYear

ToFourDigitYear

Converts the specified year to a four-digit year by using the TwoDigitYearMax property to determine the appropriate century.

 Public Function ToFourDigitYear(
      ByVal Year As Long ) As Long

Parameters

Year
[ByVal] Long. A two-digit or four-digit integer that represents the year to convert.

Return Values

Long - A 4-digit year in the specific calendar.

Remarks

A normal way of dealing with years is by refering to them as a 2-digit value. This is evident in the Gregorian calendar system. The year 2005 may be referenced as 05 (pronounced oh-five). When converting a 2-digit year to a 4-digit the century is unknown. 05 could be 2005 or 1905. This property gives the calendar a rule to follow when converting 2-digit years to 4-digit.

A max year of 2029 will cause a minimum year of 1930. These two years represent 100 years which 2-digit years will fall. 00-99 will fall within 1930-2029.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: TwoDigitYearMax (get)

TwoDigitYearMax

Gets the last year of a 100-year range that can be represented by a 2-digit year.

 Public Property Get TwoDigitYearMax ( ) As Long

Return Values

Long - The last year of a 100-year range that can be represented by a 2-digit year.

Read/Write.

See Also

Project CorLib Overview

Class JulianCalendar Overview


JulianCalendar: TwoDigitYearMax (let)

TwoDigitYearMax

Sets the last year of a 100-year range that can be represented by a 2-digit year.

 Public Property Let TwoDigitYearMax(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The last year of a 100-year range.

Remarks

This property allows a 2-digit year to be properly translated to a 4-digit year. For example, if this property is set to 1429, the 100-year range is from 1330 to 1429. Therefore, a 2-digit value of 30 is interpreted as 1330, while a 2-digit value of 29 is interpreted as 1429.

The application should set this value to 99 to indicate that 2-digit years are to be taken literally. For example, if this property is set to 99, the 100-year range is from 0 (not a valid value for most calendars) to 99. Therefore, a 2-digit value of 30 is interpreted as 30.

Exceptions

Read/Write.

See Also

Project CorLib Overview

Class JulianCalendar Overview

Build on Sunday, October 11, 2020 by VBDOX
Exception | Condition
InvalidOperationException | This calendar is read-only.
ArgumentOutOfRangeException | The value in a set operation is less than 99 or greater than 9999.


JulianCalendarStatic

JulianCalendarStatic

Provides static methods for the JulianCalendar class.

Public:

Properties:

Name | Description
JulianEra (get) | Returns the current era of the Julian calendar.

See Also

Project CorLib Overview

Class JulianCalendarStatic Overview

JulianCalendar


JulianCalendarStatic: JulianEra (get)

JulianEra

Returns the current era of the Julian calendar.

 Public Property Get JulianEra ( ) As Long

Return Values

Long - Returns a constant of 1.

Read Only.

See Also

Project CorLib Overview

Class JulianCalendarStatic Overview


KeyedHashAlgorithm

KeyedHashAlgorithm

Provides a common interface to be implementated by all keyed hash implentations.

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if the hash algorithm implementation can be reused once a hash has been computed.
CanTransformMultipleBlocks (get) | Returns if the hash algorithm implementation can processd multiple blocks of data at a time.
Hash (get) | Returns the computed hash after all data has been processed.
HashSize (get) | Returns the size of the hash value in bits.
InputBlockSize (get) | Returns the size of the input block size allowed.
Key (get) | Returns the key being used by the algorithm.
Key (let) | Sets the key to be used by the algorithm.
OutputBlockSize (get) | Returns the size of the output block.

Methods:

Name | Description
Clear | Releases any resources being held by the hash algorithm.
ComputeHash | Computes the hash on a source in its entirety.
Equals | Returns if the Value is equal to this object instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
Initialize | Resets a hashing object to begin hashing a new value.
ToString | Returns a string representation of this object instance.
TransformBlock | Continues to compute the hash value for blocks of data.
TransformFinalBlock | Finalizes the hash computation by processing the last block of data.

See Also

Project CorLib Overview

Class KeyedHashAlgorithm Overview

HMACMD5

HMACSHA1

HMACSHA256

HMACSHA384

HMACSHA512

HMACRIPEMD160

MACTripleDES


KeyedHashAlgorithm: CanReuseTransform (get)

CanReuseTransform

Returns if the hash algorithm implementation can be reused once a hash has been computed.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - True if the implementation can be reused, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class KeyedHashAlgorithm Overview


KeyedHashAlgorithm: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if the hash algorithm implementation can processd multiple blocks of data at a time.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - True if multiple blocks of data can be processed at a time, False otherwise.

Remarks

The size of 1 block of data is defined by the InputBlockSize property.

Read Only.

See Also

Project CorLib Overview

Class KeyedHashAlgorithm Overview


KeyedHashAlgorithm: Clear

Clear

Releases any resources being held by the hash algorithm.

 Public Sub Clear ( )

Remarks

Once this is called, the object is disposed and cannot be reused.

See Also

Project CorLib Overview

Class KeyedHashAlgorithm Overview


KeyedHashAlgorithm: ComputeHash

ComputeHash

Computes the hash on a source in its entirety.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( ) :

Parameters

Source
[ByRef] Variant. The source of data compute the hash for. This can be a byte array or object implementing the Stream interface.
Index
[ByRef] Optional. Variant. The starting index in a byte array source. If the source is not a byte array, this argument is ignored.
Count
[ByRef] Optional. Variant. The number of bytes to compute the hash on. If the source is not a byte array, this argument is ignored.

Return Values

Byte() - The hash value computed from the source provided.

Remarks

If the source is a Stream based object, then the stream is read from and the hash continuously computed until the stream no longer returns data.

If data has already been processed using TransformBlock, then that data will be included in the hashing process.

See Also

Project CorLib Overview

Class KeyedHashAlgorithm Overview


KeyedHashAlgorithm: Equals

Equals

Returns if the Value is equal to this object instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this object instance.

Return Values

Boolean - True if they are considered equal, False otherwise.

See Also

Project CorLib Overview

Class KeyedHashAlgorithm Overview


KeyedHashAlgorithm: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class KeyedHashAlgorithm Overview


KeyedHashAlgorithm: Hash (get)

Hash

Returns the computed hash after all data has been processed.

 Public Property Get Hash ( ) As Byte ( ) :

Return Values

Byte() - A byte array containing the computed hash.

Remarks

The size of the array will vary depending on the hash algorithm being performed.

Read Only.

See Also

Project CorLib Overview

Class KeyedHashAlgorithm Overview


KeyedHashAlgorithm: HashSize (get)

HashSize

Returns the size of the hash value in bits.

 Public Property Get HashSize ( ) As Long

Return Values

Long - The size of the hash value in bits.

Read Only.

See Also

Project CorLib Overview

Class KeyedHashAlgorithm Overview


KeyedHashAlgorithm: Initialize

Initialize

Resets a hashing object to begin hashing a new value.

 Public Sub Initialize ( )

Remarks

If Clear has been called, then the object cannot be re-initialized.

See Also

Project CorLib Overview

Class KeyedHashAlgorithm Overview


KeyedHashAlgorithm: InputBlockSize (get)

InputBlockSize

Returns the size of the input block size allowed.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - The number of bytes a single input block is.

Remarks

When calling the TransformBlock method, the InputCount must equal this value. If the hashs CanTransformMultipleBlocks returns True, then the InputCount can be larger than the InputBlockSize, but must be an even multiple of InputBlockSize.

Read Only.

See Also

Project CorLib Overview

Class KeyedHashAlgorithm Overview


KeyedHashAlgorithm: Key (get)

Key

Returns the key being used by the algorithm.

 Public Property Get Key ( ) As Byte ( ) :

Return Values

Byte() - The key being used.

Read/Write.

See Also

Project CorLib Overview

Class KeyedHashAlgorithm Overview


KeyedHashAlgorithm: Key (let)

Key

Sets the key to be used by the algorithm.

 Public Property Let Key(
      ByRef Value ( ) As Byte ) :

Parameters

Value
[ByRef] Byte. The key to be used.

Read/Write.

See Also

Project CorLib Overview

Class KeyedHashAlgorithm Overview


KeyedHashAlgorithm: OutputBlockSize (get)

OutputBlockSize

Returns the size of the output block.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - The size of the output block.

Remarks

When calling the TransformBlock method, the return value will be 0 or a multiple of this value.

Read Only.

See Also

Project CorLib Overview

Class KeyedHashAlgorithm Overview


KeyedHashAlgorithm: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class KeyedHashAlgorithm Overview


KeyedHashAlgorithm: TransformBlock

TransformBlock

Continues to compute the hash value for blocks of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The bytes to continue computing the hash from.
InputOffset
[ByVal] Long. The index into the byte array to begin computing from.
InputCount
[ByVal] Long. The number of bytes to be included in the hash computation.
OutputBuffer
[ByRef] Byte. The data after it has been processed. This will be the same as the input data, no changes are made.
OutputOffset
[ByVal] Long. The starting index in the output buffer to place the processed data.

Return Values

Long - The number of bytes that were processed.

Remarks

The OutputBuffer will contain the same plain text data as the input buffer. No transformation of the data is applied. The OutputBuffer array can be a Null array or the same array as the InputBuffer. If the InputBuffer is used as the OutputBuffer and the InputOffset equals the OutputOffset, no data is copied.

Once this method is called, the Hash property cannot be called until the TransformFinalBlock is called, finishing the hash computation.

See Also

Project CorLib Overview

Class KeyedHashAlgorithm Overview


KeyedHashAlgorithm: TransformFinalBlock

TransformFinalBlock

Finalizes the hash computation by processing the last block of data.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( ) :

Parameters

InputBuffer
[ByRef] Byte. The bytes to finish the hash computation with.
InputOffset
[ByVal] Long. The index into the byte array to begin hash computations.
InputCount
[ByVal] Long. The number of bytes to be included in the final hash computation.

Return Values

Byte() - A copy of the portion of the InputBuffer that was processed.

Remarks

The hash value is not returned by this method. To retrieve the final hash value, call the Hash property.

The Hash property can only be called after this method is called. If the Hash property is called before this method, then an exception is thrown.

If the implementation can be reused (CanReuseTransform) then the implemntation is reset to allow computing of a new hash value.

See Also

Project CorLib Overview

Class KeyedHashAlgorithm Overview


KeySizes

KeySizes

Represents a set of key sizes.

Implements:

IObject

Public:

Properties:

Name | Description
MaxSize (get) | The maximum key size in bits.
MinSize (get) | The mininum key size in bits.
SkipSize (get) | The step size between keys in bits.

Methods:

Name | Description
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function. An override might be necessary if the hashcode should be derived from a value contained within the class.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides. A Person class may return the persons name instead.

Remarks

All of the key sizes are represented by indicating a minimum key size and a maximum key size, then using a step to fill in key sizes between the two.

See Also

Project CorLib Overview

Class KeySizes Overview


KeySizes: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test for equality.

Return Values

Boolean -

See Also

Project CorLib Overview

Class KeySizes Overview


KeySizes: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

An override might be necessary if the hashcode should be derived from a value contained within the class.

 Public Function GetHashCode ( ) As Long

Return Values

Long -

See Also

Project CorLib Overview

Class KeySizes Overview


KeySizes: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class KeySizes Overview


KeySizes: MaxSize (get)

MaxSize

The maximum key size in bits.

 Public Property Get MaxSize ( ) As Long

Return Values

Long - The maximum key size in bits.

Read Only.

See Also

Project CorLib Overview

Class KeySizes Overview


KeySizes: MinSize (get)

MinSize

The mininum key size in bits.

 Public Property Get MinSize ( ) As Long

Return Values

Long - The mininum key size in bits.

Read Only.

See Also

Project CorLib Overview

Class KeySizes Overview


KeySizes: SkipSize (get)

SkipSize

The step size between keys in bits.

 Public Property Get SkipSize ( ) As Long

Return Values

Long - the step size in bits.

Read Only.

See Also

Project CorLib Overview

Class KeySizes Overview


KeySizes: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

A Person class may return the persons name instead.

 Public Function ToString ( ) As String

Return Values

String -

See Also

Project CorLib Overview

Class KeySizes Overview


KoreanCalendar

KoreanCalendar

Provides functions to manipulate Korean dates.

Implements:

Calendar
ICloneable
IObject

Public:

Properties:

Name | Description
AlgorithmType (get) | Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.
Eras (get) | Gets a list of eras in the KoreanCalendar.
IsReadOnly (get) | Gets a value indicating whether this KoreanCalendar object is read-only.
MaxSupportedDateTime (get) | Gets the latest date and time supported by the KoreanCalendar class.
MinSupportedDateTime (get) | Gets the earliest date and time supported by the KoreanCalendar class.
TwoDigitYearMax (get) | Gets the last year of a 100-year range that can be represented by a 2-digit year.
TwoDigitYearMax (let) | Sets the last year of a 100-year range that can be represented by a 2-digit year.
InvalidOperationException | In a set operation, the current instance is read-only.

This property allows a 2-digit year to be properly translated to a 4-digit year. For example, in the Gregorian calendar, if this property is set to 2029, the 100-year range is from 1930 to 2029. Therefore, a 2-digit value of 30 is interpreted as 1930, while a 2-digit value of 29 is interpreted as 2029.

The initial value of this property is derived from the settings in the regional and language options portion of Control Panel. However, that information can change during the life of the application. The KoreanCalendar class does not detect changes in the system settings automatically.

The application should set this value to 99 to indicate that 2-digit years are to be taken literally. For example, if this property is set to 99, the 100-year range is from 0 (not a valid value for most calendars) to 99. Therefore, a 2-digit value of 30 is interpreted as 30.

Methods:

Name | Description
AddDays | Returns a CorDateTime that is the specified number of days away from the specified CorDateTime.
AddHours | Returns a CorDateTime this is the specified number of hours from the original Time.
AddMilliseconds | Returns a CorDateTime this is the specified number of Milliseconds from the original Time.
AddMinutes | Returns a CorDateTime this is the specified number of Minutes from the original Time.
AddMonths | Returns a CorDateTime this is the specified number of Months from the original Time.
AddSeconds | Returns a CorDateTime this is the specified number of Seconds from the original Time.
AddWeeks | Returns a CorDateTime this is the specified number of Weeks from the original Time.
AddYears | Returns a CorDateTime this is the specified number of Years from the original Time.
Clone | Creates a new object that is a copy of the current KoreanCalendar object.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetDayOfMonth | Returns the day of the months for the specified date.
GetDayOfWeek | Returns the DayOfWeek enum of the specified date.
GetDayOfYear | Returns the day of the year for the specified date.
GetDaysInMonth | Returns the number of days in the specified month.
GetDaysInYear | Returns the number of days in the specified year.
GetEra | Returns the era in the specified CorDateTime.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetHour | Returns the hour of the specified time.
GetLeapMonth | Calculates the leap month for a specified year and era.
GetMilliseconds | Returns the milliseconds of the specified time.
GetMinute | Returns the minute of the specified time.
GetMonth | Returns the month of the specified time.
GetMonthsInYear | Returns the number of months in the specified year.
GetSecond | Returns the second of the specified time.
GetWeekOfYear | Returns the week of the year that the specified date belongs to.
GetYear | Returns the year of the specified time.
IsLeapDay | Returns a boolean indicating if the specific day is a leap day.
IsLeapMonth | Returns a boolean indicating if the specific month is a leap month.
IsLeapYear | Returns a boolean indicating if the specific year is a leap year.
ToDateTime | Returns a Gregorian CorDateTime computed using the specific calendar rules.
ToFourDigitYear | Returns a 4-digit year from a 2-digit number.
ToString | Returns a string representation of this object instance.

See Also

Project CorLib Overview

Class KoreanCalendar Overview

KoreanStatic

Calendar


KoreanCalendar: AddDays

AddDays

Returns a CorDateTime that is the specified number of days away from the specified CorDateTime.

 Public Function AddDays(
      ByRef Time As Variant,
      ByVal Days As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to add days to.
Days
[ByVal] Long. The number of days to add.

Return Values

CorDateTime - The CorDateTime that results from adding the specified number of days to the specified CorDateTime.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: AddHours

AddHours

Returns a CorDateTime this is the specified number of hours from the original Time.

 Public Function AddHours(
      ByRef Time As Variant,
      ByVal Hours As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of hours to.
Hours
[ByVal] Long. The number of hours to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of hours added.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: AddMilliseconds

AddMilliseconds

Returns a CorDateTime this is the specified number of Milliseconds from the original Time.

 Public Function AddMilliseconds(
      ByRef Time As Variant,
      ByVal Milliseconds As Double ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Milliseconds to.
Milliseconds
[ByVal] Double. The number of Milliseconds to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Milliseconds added.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: AddMinutes

AddMinutes

Returns a CorDateTime this is the specified number of Minutes from the original Time.

 Public Function AddMinutes(
      ByRef Time As Variant,
      ByVal Minutes As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Minutes to.
Minutes
[ByVal] Long. The number of Minutes to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Minutes added.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: AddMonths

AddMonths

Returns a CorDateTime this is the specified number of Months from the original Time.

 Public Function AddMonths(
      ByRef Time As Variant,
      ByVal Months As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Months to.
Months
[ByVal] Long. The number of Months to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Months added.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: AddSeconds

AddSeconds

Returns a CorDateTime this is the specified number of Seconds from the original Time.

 Public Function AddSeconds(
      ByRef Time As Variant,
      ByVal Seconds As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Seconds to.
Seconds
[ByVal] Long. The number of Seconds to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Seconds added.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: AddWeeks

AddWeeks

Returns a CorDateTime this is the specified number of Weeks from the original Time.

 Public Function AddWeeks(
      ByRef Time As Variant,
      ByVal Weeks As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Weeks to.
Weeks
[ByVal] Long. The number of Weeks to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Weeks added.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: AddYears

AddYears

Returns a CorDateTime this is the specified number of Years from the original Time.

 Public Function AddYears(
      ByRef Time As Variant,
      ByVal Years As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Years to.
Years
[ByVal] Long. The number of Years to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Years added.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: AlgorithmType (get)

AlgorithmType

Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.

 Public Property Get AlgorithmType ( ) As CalendarAlgorithmType

Return Values

CalendarAlgorithmType - Always returns CalendarAlgorithmType.SolarCalendar.

Read Only.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: Calendar

Calendar

 Implements Calendar

Return Values

Calendar -

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: Clone

Clone

Creates a new object that is a copy of the current KoreanCalendar object.

 Public Function Clone ( ) As KoreanCalendar

Return Values

KoreanCalendar - A copy of the KoreanCalendar object.

Remarks

The clone will always be a non-readonly version.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: Eras (get)

Eras

Gets a list of eras in the KoreanCalendar.

 Public Property Get Eras ( ) As Long ( )

Return Values

Long() - An array of integers that represents the eras in the KoreanCalendar.

Remarks

The KoreanCalendar class recognizes only the current era. This property always returns an array with only one element.

Read Only.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: GetDayOfMonth

GetDayOfMonth

Returns the day of the months for the specified date.

 Public Function GetDayOfMonth(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The date inwhich to retrieve the day of the month.

Return Values

Long - An integer from 1 to 31 that represents the day of the month in the specified Date or CorDateTime.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: GetDayOfWeek

GetDayOfWeek

Returns the DayOfWeek enum of the specified date.

 Public Function GetDayOfWeek(
      ByRef Time As Variant ) As DayOfWeek

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to read the day of the week from.

Return Values

DayOfWeek - A DayOfWeek enum representing the day of the week.

Remarks

The DayOfWeek is Sunday and is 0-based. The Visual Basic enum vbDayOfWeek is 1-based.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: GetDayOfYear

GetDayOfYear

Returns the day of the year for the specified date.

 Public Function GetDayOfYear(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to read the day of the year from.

Return Values

Long - An integer from 1 to 366 that represents the day of the year in the specified Date or CorDateTime.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: GetDaysInMonth

GetDaysInMonth

Returns the number of days in the specified month.

 Public Function GetDaysInMonth(
      ByVal Year As Long,
      ByVal Month As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year inwhich the month exists. This is used by calendars that have months that change based on the year, such as leap years.
Month
[ByVal] Long. The month to retrieve the number of days of.
Era
[ByRef] Optional. Variant. The time period inwhich the year exists.

Return Values

Long -

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: GetDaysInYear

GetDaysInYear

Returns the number of days in the specified year.

 Public Function GetDaysInYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year to retrieve the number of days of.
Era
[ByRef] Optional. Variant. The era the year exists in.

Return Values

Long - The number of days in the year.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: GetEra

GetEra

Returns the era in the specified CorDateTime.

 Public Function GetEra(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The CorDateTime to read.

Return Values

Long - An integer that represents the era in the specified CorDateTime.

Remarks

The KoreanCalendar class recognizes only the current era.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: GetHour

GetHour

Returns the hour of the specified time.

 Public Function GetHour(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the hour from.

Return Values

Long - The hour portion of the time.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: GetLeapMonth

GetLeapMonth

Calculates the leap month for a specified year and era.

 Public Function GetLeapMonth(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. A year.
Era
[ByRef] Optional. Variant. An era.

Return Values

Long - Always 0 because the KoreanCalendar calendar does not recognize leap months.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: GetMilliseconds

GetMilliseconds

Returns the milliseconds of the specified time.

 Public Function GetMilliseconds(
      ByRef Time As Variant ) As Double

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the milliseconds from.

Return Values

Double - The millisecond portion of the time.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: GetMinute

GetMinute

Returns the minute of the specified time.

 Public Function GetMinute(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the minute from.

Return Values

Long - The minute portion of the time.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: GetMonth

GetMonth

Returns the month of the specified time.

 Public Function GetMonth(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the month from.

Return Values

Long - The month portion of the time.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: GetMonthsInYear

GetMonthsInYear

Returns the number of months in the specified year.

 Public Function GetMonthsInYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year to get the number of months of.
Era
[ByRef] Optional. Variant. The era the year exists in.

Return Values

Long - The number of months in the year.

Remarks

The Korean calendar has 12 months in a year.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: GetSecond

GetSecond

Returns the second of the specified time.

 Public Function GetSecond(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the second from.

Return Values

Long - The second portion of the time.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: GetWeekOfYear

GetWeekOfYear

Returns the week of the year that the specified date belongs to.

 Public Function GetWeekOfYear(
      ByRef Time As Variant,
      ByVal Rule As CalendarWeekRule,
      ByVal FirstDayOfWeek As DayOfWeek ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to find the week it belongs.
Rule
[ByVal] CalendarWeekRule. Rule to decide what constitutes the first week of the year.
FirstDayOfWeek
[ByVal] DayOfWeek. Defines which week day is the start of a new week.

Return Values

Long - The week that the date belongs to.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: GetYear

GetYear

Returns the year of the specified time.

 Public Function GetYear(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the year from.

Return Values

Long - The year portion of the time.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: IsLeapDay

IsLeapDay

Returns a boolean indicating if the specific day is a leap day.

 Public Function IsLeapDay(
      ByVal Year As Long,
      ByVal Month As Long,
      ByVal Day As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year the day is in.
Month
[ByVal] Long. The month the day is in.
Day
[ByVal] Long. The day to check if is a leap day.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the day is a leap day.

Remarks

A leap day only exists in a leap year, such as February 29th in the Korean calendar.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: IsLeapMonth

IsLeapMonth

Returns a boolean indicating if the specific month is a leap month.

 Public Function IsLeapMonth(
      ByVal Year As Long,
      ByVal Month As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year the month is in.
Month
[ByVal] Long. The month to check if it is a leap month.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the month is a leap month.

Remarks

A leap month only exists in a leap year, such as Adar II in the Hebrew calendar. This always returns False.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: IsLeapYear

IsLeapYear

Returns a boolean indicating if the specific year is a leap year.

 Public Function IsLeapYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year to check if is a leap year.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the year is a leap year.

Remarks

A leap year in the Korean calendar occurs when the year is evenly divisible by 4, but not by 100, unless it is divisible by 400.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: IsReadOnly (get)

IsReadOnly

Gets a value indicating whether this KoreanCalendar object is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - True if this KoreanCalendar object is read-only; otherwise, False.

Read Only.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: MaxSupportedDateTime (get)

MaxSupportedDateTime

Gets the latest date and time supported by the KoreanCalendar class.

 Public Property Get MaxSupportedDateTime ( ) As CorDateTime

Return Values

CorDateTime - The latest date and time supported by the KoreanCalendar class, which is equivalent to the last moment of December 31, 9999 C.E. in the Gregorian calendar.

Read Only.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: MinSupportedDateTime (get)

MinSupportedDateTime

Gets the earliest date and time supported by the KoreanCalendar class.

 Public Property Get MinSupportedDateTime ( ) As CorDateTime

Return Values

CorDateTime - The earliest date and time supported by the KoreanCalendar class, which is equivalent to the first moment of January 1, 0001 C.E. in the Gregorian calendar.

Read Only.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: ToDateTime

ToDateTime

Returns a Gregorian CorDateTime computed using the specific calendar rules.

 Public Function ToDateTime(
      ByVal Year As Long,
      ByVal Month As Long,
      ByVal Day As Long,
      ByVal Hour As Long,
      ByVal Minute As Long,
      ByVal Second As Long,
      ByVal Millisecond As Long,
      Optional ByRef Era As Variant ) As CorDateTime

Parameters

Year
[ByVal] Long. The Year in the specific calendar type.
Month
[ByVal] Long. The Month in the specific calendar type.
Day
[ByVal] Long. The Day in the specific calendar type.
Hour
[ByVal] Long. The hour for the new time.
Minute
[ByVal] Long. The minute for the new time.
Second
[ByVal] Long. The second for the new time.
Millisecond
[ByVal] Long. The milliseconds for the new time.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

CorDateTime - A Gregorian version of the date specified.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: ToFourDigitYear

ToFourDigitYear

Returns a 4-digit year from a 2-digit number.

 Public Function ToFourDigitYear(
      ByVal Year As Long ) As Long

Parameters

Year
[ByVal] Long. The year to be converted to 4-digits.

Return Values

Long - A 4-digit year in the specific calendar.

Remarks

A normal way of dealing with years is by refering to them as a 2-digit value. This is evident in the Gregorian calendar system. The year 2005 may be referenced as 05 (pronounced oh-five). When converting a 2-digit year to a 4-digit the century is unknown. 05 could be 2005 or 1905. This property gives the calendar a rule to follow when converting 2-digit years to 4-digit.

A max year of 2029 will cause a minimum year of 1930. These two years represent 100 years which 2-digit years will fall. 00-99 will fall within 1930-2029.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: TwoDigitYearMax (get)

TwoDigitYearMax

Gets the last year of a 100-year range that can be represented by a 2-digit year.

 Public Property Get TwoDigitYearMax ( ) As Long

Return Values

Long - The last year of a 100-year range that can be represented by a 2-digit year.

Remarks

This property allows a 2-digit year to be properly translated to a 4-digit year. For example, in the Gregorian calendar, if this property is set to 2029, the 100-year range is from 1930 to 2029. Therefore, a 2-digit value of 30 is interpreted as 1930, while a 2-digit value of 29 is interpreted as 2029.

The initial value of this property is derived from the settings in the regional and language options portion of Control Panel. However, that information can change during the life of the application. The KoreanCalendar class does not detect changes in the system settings automatically.

The application should set this value to 99 to indicate that 2-digit years are to be taken literally. For example, if this property is set to 99, the 100-year range is from 0 (not a valid value for most calendars) to 99. Therefore, a 2-digit value of 30 is interpreted as 30.

Read/Write.

See Also

Project CorLib Overview

Class KoreanCalendar Overview


KoreanCalendar: TwoDigitYearMax (let)

TwoDigitYearMax

Sets the last year of a 100-year range that can be represented by a 2-digit year.

InvalidOperationException In a set operation, the current instance is read-only.

This property allows a 2-digit year to be properly translated to a 4-digit year. For example, in the Gregorian calendar, if this property is set to 2029, the 100-year range is from 1930 to 2029. Therefore, a 2-digit value of 30 is interpreted as 1930, while a 2-digit value of 29 is interpreted as 2029.

The initial value of this property is derived from the settings in the regional and language options portion of Control Panel. However, that information can change during the life of the application. The KoreanCalendar class does not detect changes in the system settings automatically.

The application should set this value to 99 to indicate that 2-digit years are to be taken literally. For example, if this property is set to 99, the 100-year range is from 0 (not a valid value for most calendars) to 99. Therefore, a 2-digit value of 30 is interpreted as 30.

 Public Property Let TwoDigitYearMax(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The last year of a 100-year range that can be represented by a 2-digit year.

Remarks

Read/Write.

See Also

Project CorLib Overview

Class KoreanCalendar Overview

Build on Sunday, October 11, 2020 by VBDOX
Exception | Condition
ArgumentOutOfRangeException | The value specified in a set operation is less than 99. -or- The value specified in a set operation is greater than MaxSupportedDateTime.Year.


KoreanCalendarStatic

KoreanCalendarStatic

Provides static methods for the KoreanCalendar class.

Public:

Properties:

Name | Description
KoreanEra (get) | Returns the current era of the Korean calendar.

See Also

Project CorLib Overview

Class KoreanCalendarStatic Overview

KoreanCalendar


KoreanCalendarStatic: KoreanEra (get)

KoreanEra

Returns the current era of the Korean calendar.

 Public Property Get KoreanEra ( ) As Long

Return Values

Long - Returns a constant of 1.

Read Only.

See Also

Project CorLib Overview

Class KoreanCalendarStatic Overview


MACTripleDES

MACTripleDES

Represents a TripleDES implementation of an HMAC algorithm.

Implements:

HashAlgorithm
ICryptoTransform
IObject
KeyedHashAlgorithm

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if the hash algorithm implementation can be reused once a hash has been computed.
CanTransformMultipleBlocks (get) | Returns if the hash algorithm implementation can processd multiple blocks of data at a time.
Hash (get) | Returns the computed hash after all data has been processed.
HashSize (get) | Returns the size of the hash value in bits.
InputBlockSize (get) | Returns the size of the input block size allowed.
Key (get) | Returns the key being used by the hash algorithm.
Key (let) | Sets the key to be used by the hash algorithm.
OutputBlockSize (get) | Returns the size of the output block.
Padding (get) | Returns the padding being used by the algorithm.
Padding (let) | Sets the padding to be used by the hash algorithm.

Methods:

Name | Description
Clear | Releases any resources being held by the hash algorithm.
ComputeHash | Computes the hash on a source in its entirety.
Equals | Returns if the Value is equal to this object instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
Initialize | Resets a hashing object to begin hashing a new value.
ToString | Returns a string representation of this object instance.
TransformBlock | Continues to compute the hash value for blocks of data.
TransformFinalBlock | Finalizes the hash computation by processing the last block of data.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: CanReuseTransform (get)

CanReuseTransform

Returns if the hash algorithm implementation can be reused once a hash has been computed.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - True if the implementation can be reused, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if the hash algorithm implementation can processd multiple blocks of data at a time.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - True if multiple blocks of data can be processed at a time, False otherwise.

Remarks

The size of 1 block of data is defined by the InputBlockSize property.

Read Only.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: Clear

Clear

Releases any resources being held by the hash algorithm.

 Public Sub Clear ( )

Remarks

Once this is called, the object is disposed and cannot be reused.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: ComputeHash

ComputeHash

Computes the hash on a source in its entirety.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Source
[ByRef] Variant. The source of data compute the hash for. This can be a byte array or object implementing the Stream interface.
Index
[ByRef] Optional. Variant. The starting index in a byte array source. If the source is not a byte array, this argument is ignored.
Count
[ByRef] Optional. Variant. The number of bytes to compute the hash on. If the source is not a byte array, this argument is ignored.

Return Values

Byte() - The hash value computed from the source provided.

Remarks

If the source is a Stream based object, then the stream is read from and the hash continuously computed until the stream no longer returns data.

If data has already been processed using TransformBlock, then that data will be included in the hashing process.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: Equals

Equals

Returns if the Value is equal to this object instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this object instance.

Return Values

Boolean - True if they are considered equal, False otherwise.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: Hash (get)

Hash

Returns the computed hash after all data has been processed.

 Public Property Get Hash ( ) As Byte ( )

Return Values

Byte() - A byte array containing the computed hash.

Remarks

The size of the array will vary depending on the hash algorithm being performed.

Read Only.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: HashAlgorithm

HashAlgorithm

 Implements HashAlgorithm

Return Values

HashAlgorithm -

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: HashSize (get)

HashSize

Returns the size of the hash value in bits.

 Public Property Get HashSize ( ) As Long

Return Values

Long - The size of the hash value in bits.

Read Only.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: ICryptoTransform

ICryptoTransform

 Implements ICryptoTransform

Return Values

ICryptoTransform -

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: Initialize

Initialize

Resets a hashing object to begin hashing a new value.

 Public Sub Initialize ( )

Remarks

If Clear has been called, then the object cannot be re-initialized.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: InputBlockSize (get)

InputBlockSize

Returns the size of the input block size allowed.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - The number of bytes a single input block is.

Remarks

When calling the TransformBlock method, the InputCount must equal this value. If the hashs CanTransformMultipleBlocks returns True, then the InputCount can be larger than the InputBlockSize, but must be an even multiple of InputBlockSize.

Read Only.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: Key (get)

Key

Returns the key being used by the hash algorithm.

 Public Property Get Key ( ) As Byte ( )

Return Values

Byte() - The key being used.

Read/Write.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: Key (let)

Key

Sets the key to be used by the hash algorithm.

 Public Property Let Key(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new key to be used.

Read/Write.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: KeyedHashAlgorithm

KeyedHashAlgorithm

 Implements KeyedHashAlgorithm

Return Values

KeyedHashAlgorithm -

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: OutputBlockSize (get)

OutputBlockSize

Returns the size of the output block.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - The size of the output block.

Remarks

When calling the TransformBlock method, the return value will be 0 or a multiple of this value.

Read Only.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: Padding (get)

Padding

Returns the padding being used by the algorithm.

 Public Property Get Padding ( ) As PaddingMode

Return Values

PaddingMode - The padding being used.

Read/Write.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: Padding (let)

Padding

Sets the padding to be used by the hash algorithm.

 Public Property Let Padding(
      ByVal Value As PaddingMode )

Parameters

Value
[ByVal] PaddingMode. The new padding value.

Read/Write.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: TransformBlock

TransformBlock

Continues to compute the hash value for blocks of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The bytes to continue computing the hash from.
InputOffset
[ByVal] Long. The index into the byte array to begin computing from.
InputCount
[ByVal] Long. The number of bytes to be included in the hash computation.
OutputBuffer
[ByRef] Byte. The data after it has been processed. This will be the same as the input data, no changes are made.
OutputOffset
[ByVal] Long. The starting index in the output buffer to place the processed data.

Return Values

Long - The number of bytes that were processed.

Remarks

The OutputBuffer will contain the same plain text data as the input buffer. No transformation of the data is applied. The OutputBuffer array can be a Null array or the same array as the InputBuffer. If the InputBuffer is used as the OutputBuffer and the InputOffset equals the OutputOffset, no data is copied.

Once this method is called, the Hash property cannot be called until the TransformFinalBlock is called, finishing the hash computation.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDES: TransformFinalBlock

TransformFinalBlock

Finalizes the hash computation by processing the last block of data.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The bytes to finish the hash computation with.
InputOffset
[ByVal] Long. The index into the byte array to begin hash computations.
InputCount
[ByVal] Long. The number of bytes to be included in the final hash computation.

Return Values

Byte() - A copy of the portion of the InputBuffer that was processed.

Remarks

The hash value is not returned by this method. To retrieve the final hash value, call the Hash property.

The Hash property can only be called after this method is called. If the Hash property is called before this method, then an exception is thrown.

If the implementation can be reused (CanReuseTransform) then the implemntation is reset to allow computing of a new hash value.

See Also

Project CorLib Overview

Class MACTripleDES Overview


MACTripleDESStatic

MACTripleDESStatic

Provides static methods associated with the MACTripleDES class.

Public:

Methods:

Name | Description
Create | Returns an implementation of the MACTripleDES class.

See Also

Project CorLib Overview

Class MACTripleDESStatic Overview

MACTripleDES


MACTripleDESStatic: Create

Create

Returns an implementation of the MACTripleDES class.

 Public Function Create(
      Optional ByVal AlgName As String ) As KeyedHashAlgorithm

Parameters

AlgName
[ByVal] Optional. String. The name of the implementation to create and return.

Return Values

KeyedHashAlgorithm - An implementation of a TripleDES MAC algorithm.

Remarks

By default the HMACSHA1 implementation is returned. If a different implementation is desired, then use the standard Server.Class' naming convention.

See Also

Project CorLib Overview

Class MACTripleDESStatic Overview


MD5

MD5

Represents a base interface to be implemented by all MD5 hash algorithms.

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if the hash algorithm implementation can be reused once a hash has been computed.
CanTransformMultipleBlocks (get) | Returns if the hash algorithm implementation can processd multiple blocks of data at a time.
Hash (get) | Returns the computed hash after all data has been processed.
HashSize (get) | Returns the size of the hash value in bits.
InputBlockSize (get) | Returns the size of the input block size allowed.
OutputBlockSize (get) | Returns the size of the output block.

Methods:

Name | Description
Clear | Releases any resources being held by the hash algorithm.
ComputeHash | Computes the hash on a source in its entirety.
Equals | Returns if the Value is equal to this object instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
Initialize | Resets a hashing object to begin hashing a new value.
ToString | Returns a string representation of this object instance.
TransformBlock | Continues to compute the hash value for blocks of data.
TransformFinalBlock | Finalizes the hash computation by processing the last block of data.

See Also

Project CorLib Overview

Class MD5 Overview

MD5CryptoServiceProvider

MD5Static


MD5: CanReuseTransform (get)

CanReuseTransform

Returns if the hash algorithm implementation can be reused once a hash has been computed.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - True if the implementation can be reused, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class MD5 Overview


MD5: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if the hash algorithm implementation can processd multiple blocks of data at a time.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - True if multiple blocks of data can be processed at a time, False otherwise.

Remarks

The size of 1 block of data is defined by the InputBlockSize property.

Read Only.

See Also

Project CorLib Overview

Class MD5 Overview


MD5: Clear

Clear

Releases any resources being held by the hash algorithm.

 Public Sub Clear ( )

Remarks

Once this is called, the object is disposed and cannot be reused.

See Also

Project CorLib Overview

Class MD5 Overview


MD5: ComputeHash

ComputeHash

Computes the hash on a source in its entirety.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( ) :

Parameters

Source
[ByRef] Variant. The source of data compute the hash for. This can be a byte array or object implementing the Stream interface.
Index
[ByRef] Optional. Variant. The starting index in a byte array source. If the source is not a byte array, this argument is ignored.
Count
[ByRef] Optional. Variant. The number of bytes to compute the hash on. If the source is not a byte array, this argument is ignored.

Return Values

Byte() - The hash value computed from the source provided.

Remarks

If the source is a Stream based object, then the stream is read from and the hash continuously computed until the stream no longer returns data.

If data has already been processed using TransformBlock, then that data will be included in the hashing process.

See Also

Project CorLib Overview

Class MD5 Overview


MD5: Equals

Equals

Returns if the Value is equal to this object instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this object instance.

Return Values

Boolean - True if they are considered equal, False otherwise.

See Also

Project CorLib Overview

Class MD5 Overview


MD5: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class MD5 Overview


MD5: Hash (get)

Hash

Returns the computed hash after all data has been processed.

 Public Property Get Hash ( ) As Byte ( ) :

Return Values

Byte() - A byte array containing the computed hash.

Remarks

The size of the array will vary depending on the hash algorithm being performed.

Read Only.

See Also

Project CorLib Overview

Class MD5 Overview


MD5: HashSize (get)

HashSize

Returns the size of the hash value in bits.

 Public Property Get HashSize ( ) As Long

Return Values

Long - The size of the hash value in bits.

Read Only.

See Also

Project CorLib Overview

Class MD5 Overview


MD5: Initialize

Initialize

Resets a hashing object to begin hashing a new value.

 Public Sub Initialize ( )

Remarks

If Clear has been called, then the object cannot be re-initialized.

See Also

Project CorLib Overview

Class MD5 Overview


MD5: InputBlockSize (get)

InputBlockSize

Returns the size of the input block size allowed.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - The number of bytes a single input block is.

Remarks

When calling the TransformBlock method, the InputCount must equal this value. If the hashs CanTransformMultipleBlocks returns True, then the InputCount can be larger than the InputBlockSize, but must be an even multiple of InputBlockSize.

Read Only.

See Also

Project CorLib Overview

Class MD5 Overview


MD5: OutputBlockSize (get)

OutputBlockSize

Returns the size of the output block.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - The size of the output block.

Remarks

When calling the TransformBlock method, the return value will be 0 or a multiple of this value.

Read Only.

See Also

Project CorLib Overview

Class MD5 Overview


MD5: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class MD5 Overview


MD5: TransformBlock

TransformBlock

Continues to compute the hash value for blocks of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The bytes to continue computing the hash from.
InputOffset
[ByVal] Long. The index into the byte array to begin computing from.
InputCount
[ByVal] Long. The number of bytes to be included in the hash computation.
OutputBuffer
[ByRef] Byte. The data after it has been processed. This will be the same as the input data, no changes are made.
OutputOffset
[ByVal] Long. The starting index in the output buffer to place the processed data.

Return Values

Long - The number of bytes that were processed.

Remarks

The OutputBuffer will contain the same plain text data as the input buffer. No transformation of the data is applied. The OutputBuffer array can be a Null array or the same array as the InputBuffer. If the InputBuffer is used as the OutputBuffer and the InputOffset equals the OutputOffset, no data is copied.

Once this method is called, the Hash property cannot be called until the TransformFinalBlock is called, finishing the hash computation.

See Also

Project CorLib Overview

Class MD5 Overview


MD5: TransformFinalBlock

TransformFinalBlock

Finalizes the hash computation by processing the last block of data.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( ) :

Parameters

InputBuffer
[ByRef] Byte. The bytes to finish the hash computation with.
InputOffset
[ByVal] Long. The index into the byte array to begin hash computations.
InputCount
[ByVal] Long. The number of bytes to be included in the final hash computation.

Return Values

Byte() - A copy of the portion of the InputBuffer that was processed.

Remarks

The hash value is not returned by this method. To retrieve the final hash value, call the Hash property.

The Hash property can only be called after this method is called. If the Hash property is called before this method, then an exception is thrown.

If the implementation can be reused (CanReuseTransform) then the implementation is reset to allow computing of a new hash value.

See Also

Project CorLib Overview

Class MD5 Overview


MD5CryptoServiceProvider

MD5CryptoServiceProvider

Provides MD5 hashing services through the CryptoAPI interface.

Implements:

HashAlgorithm
ICryptoTransform
IObject
MD5

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if this service provider can be reused to transfrom more data.
CanTransformMultipleBlocks (get) | Returns if this transform can operate on multiple blocks at once.
Hash (get) | Returns the computed hash.
HashSize (get) | Returns the size of the computed hash.
InputBlockSize (get) | Returns the input block size this transform can work on.
OutputBlockSize (get) | Returns the output block size this transform can produce.

Methods:

Name | Description
Clear | Releases any resources.
ComputeHash | Computes a hash value for a source in a single pass.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Initialize | Resets the hashing algorithm to start again.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Computes the hash for the specified block of data.
TransformFinalBlock | Processes the final data and retrieves the hash value.

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5CryptoServiceProvider: CanReuseTransform (get)

CanReuseTransform

Returns if this service provider can be reused to transfrom more data.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5CryptoServiceProvider: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if this transform can operate on multiple blocks at once.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5CryptoServiceProvider: Clear

Clear

Releases any resources.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5CryptoServiceProvider: ComputeHash

ComputeHash

Computes a hash value for a source in a single pass.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Source
[ByRef] Variant. This can be either a Byte array or any Stream compatible object.
Index
[ByRef] Optional. Variant. The starting index in the Byte array. This is ignored for Stream objects.
Count
[ByRef] Optional. Variant. The number of bytes in the array to be computed. This is ignored for Stream objects.

Return Values

Byte() - A 16-byte hash value.

Remarks

If a Stream object is passed in, then the stream is continuously read and the hash calculated until there is no more data left to read from the stream.

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5CryptoServiceProvider: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the values are the same.

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5CryptoServiceProvider: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5CryptoServiceProvider: Hash (get)

Hash

Returns the computed hash.

 Public Property Get Hash ( ) As Byte ( )

Return Values

Byte() - A 16-byte array containing the hash value.

Remarks

The TransformFinalBlock must be called before accessing this property or an InvalidOperationException will be thrown.

Read Only.

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5CryptoServiceProvider: HashAlgorithm

HashAlgorithm

 Implements HashAlgorithm

Return Values

HashAlgorithm -

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5CryptoServiceProvider: HashSize (get)

HashSize

Returns the size of the computed hash.

 Public Property Get HashSize ( ) As Long

Return Values

Long - Always returns 128 bits.

Read Only.

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5CryptoServiceProvider: ICryptoTransform

ICryptoTransform

 Implements ICryptoTransform

Return Values

ICryptoTransform -

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5CryptoServiceProvider: Initialize

Initialize

Resets the hashing algorithm to start again.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5CryptoServiceProvider: InputBlockSize (get)

InputBlockSize

Returns the input block size this transform can work on.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Read Only.

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5CryptoServiceProvider: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5CryptoServiceProvider: MD5

MD5

 Implements MD5

Return Values

MD5 -

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5CryptoServiceProvider: OutputBlockSize (get)

OutputBlockSize

Returns the output block size this transform can produce.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Read Only.

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5CryptoServiceProvider: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5CryptoServiceProvider: TransformBlock

TransformBlock

Computes the hash for the specified block of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to compute the hash from.
InputOffset
[ByVal] Long. The starting index in the input data to compute the hash.
InputCount
[ByVal] Long. The number of bytes to compute the hash from.
OutputBuffer
[ByRef] Byte. The array to place the input buffer bytes in.
OutputOffset
[ByVal] Long. The starting index to beging copying the bytes to.

Return Values

Long - The number of bytes processed.

Remarks

The OutputBuffer will contain the same plain text data as the input buffer. No transformation of the data is applied. The OutputBuffer array can be a Null array or the same array as the InputBuffer. If the InputBuffer is used as the OutputBuffer and the InputOffset equals the OutputOffset, no data is copied.

Once this method is called, the Hash property cannot be called until the TransformFinalBlock is called, finishing the hash computation.

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5CryptoServiceProvider: TransformFinalBlock

TransformFinalBlock

Processes the final data and retrieves the hash value.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The final block of data to compute the hash for.
InputOffset
[ByVal] Long. The index in the InputBuffer to begin computing data.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - Returns the section of the InputBuffer that was processed.

Remarks

This does not return the computed hash value. A copy of the data that was process is returned. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class MD5CryptoServiceProvider Overview


MD5Static

MD5Static

Represents the abstract class from which all implementations of the MD5 hash algorithm inherit.

Public:

Methods:

Name | Description
Create | Creates an instance of the specified implementation of the MD5 hash algorithm.

See Also

Project CorLib Overview

Class MD5Static Overview

MD5

MD5CryptoServiceProvider


MD5Static: Create

Create

Creates an instance of the specified implementation of the MD5 hash algorithm.

 Public Function Create(
      Optional ByRef HashName As String = "CorLib.MD5" ) As MD5

Parameters

HashName
[ByRef] Optional. String. The name of the specific implementation of MD5 to use.

Default: "CorLib.MD5"

Return Values

MD5 - A new instance of the specified implementation of MD5.

Remarks

Possible values for HashName are MD5, CorLib.MD5, CorLib.MD5CryptoServiceProvider, and CorLib.MD5Managed.

See Also

Project CorLib Overview

Class MD5Static Overview


MemoryMappedFile

MemoryMappedFile

Represents a simple file-to-memory mapping.

Implements:

IObject

Public:

Types:

Name | Description
MemoryMappedFileAccess | Specifies access capabilities and restrictions for a memory-mapped file or view.
MemoryMappedFileRights | Specifies access rights to a memory-mapped file that is not associated with a file on disk.

Properties:

Name | Description
SafeMemoryMappedFileHandle (get) | Gets the file handle of a memory-mapped file.

Methods:

Name | Description
CreateViewAccessor | Creates a MemoryMappedViewAccessor that maps to a view of the memory-mapped file, and that has the specified offset, size, and access restrictions.
CreateViewStream | Creates a stream that maps to a view of the memory-mapped file, and that has the specified offset, size, and access type.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
ToString | Returns a string representation of this object instance.

Remarks

A memory-mapped file maps the contents of a file to an application’s logical address space. Memory-mapped files enable programmers to work with extremely large files because memory can be managed concurrently, and they allow complete, random access to a file without the need for seeking. Memory-mapped files can also be shared across multiple processes.

The CreateFromFile and CreateFromFileStream methods create a memory-mapped file from a specified path or a FileStream of an existing file on disk. Changes are automatically propagated to disk when the file is unmapped.

The CreateNew method creates a memory-mapped file that is not mapped to an existing file on disk; and are suitable for creating shared memory for interprocess communication (IPC).

A memory-mapped file is associated with a name.

You can create multiple views of the memory-mapped file, including views of parts of the file. You can map the same part of a file to more than one address to create concurrent memory. For two views to remain concurrent, they have to be created from the same memory-mapped file. Creating two file mappings of the same file with two views does not provide concurrency.

Examples

The following example creates a memory-mapped view of a part of an extremely large file and manipulates a portion of it.

The example uses the User-Defined type MyColor and passes it to several MemoryMappedViewAccessor methods. In order for the code sample to work, the MyColor type needs to be exposed through a public class in an ActiveX dll or Exe.

Public Type MyColor
    Red     As Integer
    Green   As Integer
    Blue    As Integer
    Alpha   As Integer
End Type

Public Sub Brightener()
    Const Offset As Long = &H10000000   ' 256 megabytes
    Const Length As Long = &H20000000   ' 512 megabytes

    Dim Mmf As MemoryMappedFile
    Dim Accessor As MemoryMappedViewAccessor

    Set Mmf = MemoryMappedFile.CreateFromFile("c:\ExtremelyLargeImage.data", FileMode.OpenExisting, "ImgA")

    ' Create a random access view, from the 256th megabyte (the offset)
    ' to the 768th megabyte (the offset plus length).
    Set Accessor = Mmf.CreateViewAccessor(Offset, Length)

    Dim i As Long
    Dim Color As MyColor

    ' Make changes to the view
    Do While i < Length
        Accessor.Read i, Color
        Brighten Color, 10
        Accessor.WriteValue i, Color

        i = i + LenB(Color)
    Loop
End Sub

Private Sub Brighten(ByRef Color As MyColor, ByVal Value As Integer)
    Const Int16Max As Integer = 32737

    Color.Red = Min(Int16Max, CLng(Color.Red) + Value)
    Color.Green = Min(Int16Max, CLng(Color.Green) + Value)
    Color.Blue = Min(Int16Max, CLng(Color.Blue) + Value)
    Color.Alpha = Min(Int16Max, CLng(Color.Alpha) + Value)
End Sub

See Also

Project CorLib Overview

Class MemoryMappedFile Overview

MemoryMappedFileStatic


MemoryMappedFile: CreateViewAccessor

CreateViewAccessor

Creates a MemoryMappedViewAccessor that maps to a view of the memory-mapped file, and that has the specified offset, size, and access restrictions.

 Public Function CreateViewAccessor(
      Optional ByVal Offset As Currency,
      Optional ByVal Size As Long,
      Optional ByVal Access As MemoryMappedFileAccess = MemoryMappedFileAccess. ReadWrite ) As MemoryMappedViewAccessor

Parameters

Offset
[ByVal] Optional. Currency. The byte at which to start the view.
Size
[ByVal] Optional. Long. The size of the view. Specify 0 (zero) to create a view that starts at Offset and ends approximately at the end of the memory-mapped file.
Access
[ByVal] Optional. MemoryMappedFileAccess. One of the enumeration values that specifies the type of access allowed to the memory-mapped file. The default is ReadWrite.

Default: MemoryMappedFileAccess . ReadWrite

Return Values

MemoryMappedViewAccessor - A randomly accessible block of memory.

Remarks

You can use the view returned by this method for random access to a memory-mapped file.

To create a complete view of the memory-mapped file, specify 0 (zero) for the Size parameter. If you do this, the size of the view might be smaller or larger than the size of the source file on disk. This is because views are provided in units of system pages, and the size of the view is rounded up to the next system page size.

Exceptions

Exception | Condition
Offset or Size is a negative value. -or- Access is not a valid MemoryMappedFileAccess enumeration value.
UnauthorizedAccessException | Access is invalid for the memory-mapped file.

See Also

Project CorLib Overview

Class MemoryMappedFile Overview


MemoryMappedFile: CreateViewStream

CreateViewStream

Creates a stream that maps to a view of the memory-mapped file, and that has the specified offset, size, and access type.

 Public Function CreateViewStream(
      Optional ByVal Offset As Currency,
      Optional ByVal Size As Long,
      Optional ByVal Access As MemoryMappedFileAccess = MemoryMappedFileAccess. ReadWrite ) As MemoryMappedViewStream

Parameters

Offset
[ByVal] Optional. Currency. The byte at which to start the view.
Size
[ByVal] Optional. Long. The size of the view. Specify 0 (zero) to create a view that starts at offset and ends approximately at the end of the memory-mapped file.
Access
[ByVal] Optional. MemoryMappedFileAccess. One of the enumeration values that specifies the type of access allowed to the memory-mapped file. The default is ReadWrite.

Default: MemoryMappedFileAccess . ReadWrite

Return Values

MemoryMappedViewStream - A stream of memory that has the specified characteristics.

Remarks

You can use the stream returned by this method for sequential access to a memory-mapped file, such as for inter-process communications.

To create a complete view of the memory-mapped file, specify 0 (zero) for the Size parameter. If you do this, the size of the view might be smaller or larger than the size of the source file on disk. This is because views are provided in units of system pages, and the size of the view is rounded up to the next system page size.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Offset or Size is a negative value. -or- Access is not a valid MemoryMappedFileAccess enumeration value.
UnauthorizedAccessException | Access is invalid for the memory-mapped file.

See Also

Project CorLib Overview

Class MemoryMappedFile Overview


MemoryMappedFile: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class MemoryMappedFile Overview


MemoryMappedFile: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class MemoryMappedFile Overview


MemoryMappedFile: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class MemoryMappedFile Overview


MemoryMappedFile: MemoryMappedFileAccess

MemoryMappedFileAccess

Specifies access capabilities and restrictions for a memory-mapped file or view.

 Public Enum MemoryMappedFileAccess

Values

ReadWrite = 0
Read and write access to the file.
ReadOnly
Read-only access to the file.
WriteOnly
Write-only access to file.
CopyOnWrite
Read and write access to the file, with the restriction that any write operations will not be seen by other processes.
ReadExecute
Read access to the file that can store and run executable code.
ReadWriteExecute
Read and write access to the file that can store and run executable code.

See Also

Project CorLib Overview

Class MemoryMappedFile Overview


MemoryMappedFile: MemoryMappedFileRights

MemoryMappedFileRights

Specifies access rights to a memory-mapped file that is not associated with a file on disk.

 Public Enum MemoryMappedFileRights

Values

CopyOnWrite = &H1
The right to read and write to a file with the restriction that write operations will not be seen by other processes.
[Write] = &H2
The right to add data to a file or remove data from a file.
Read = &H4
The right to open and copy a file as read-only.
Execute = &H8
The right to run an application file.
Delete = &H10000
The right to delete a file.
ReadPermissions = &H20000
The right to open and copy access and audit rules from a file. This does not include the right to read data, file system attributes, or extended file system attributes.
ChangePermissions = &H40000
The right to change the security and audit rules associated with a file.
TakeOwnership = &H80000
The right to change the owner of a file.
ReadWrite = MemoryMappedFileRights . Read Or MemoryMappedFileRights . Write
The right to open and copy a file, and the right to add data to a file or remove data from a file.
ReadExecute = MemoryMappedFileRights . Read Or MemoryMappedFileRights . Execute
The right to open and copy a folder or file as read-only, and to run application files. This right includes the Read right and the Execute right.
ReadWriteExecute = MemoryMappedFileRights . Read Or MemoryMappedFileRights . Write Or MemoryMappedFileRights . Execute
The right to open and copy a file, the right to add data to a file or remove data from a file, and the right to run an application file.
FullControl = MemoryMappedFileRights . CopyOnWrite Or MemoryMappedFileRights . Read Or MemoryMappedFileRights . Write Or MemoryMappedFileRights . Execute Or MemoryMappedFileRights . Delete Or MemoryMappedFileRights . ReadPermissions Or MemoryMappedFileRights . ChangePermissions Or MemoryMappedFileRights . TakeOwnership
The right to exert full control over a file, and to modify access control and audit rules. This value represents the right to do anything with a file and is the combination of all rights in this enumeration.
AccessSystemSecurity = &H1000000
The right to get or set permissions on a file.

See Also

Project CorLib Overview

Class MemoryMappedFile Overview


MemoryMappedFile: SafeMemoryMappedFileHandle (get)

SafeMemoryMappedFileHandle

Gets the file handle of a memory-mapped file.

 Public Property Get SafeMemoryMappedFileHandle ( ) As SafeMemoryMappedFileHandle

Return Values

SafeMemoryMappedFileHandle - The handle to the memory-mapped file.

Read Only.

See Also

Project CorLib Overview

Class MemoryMappedFile Overview


MemoryMappedFile: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class MemoryMappedFile Overview


MemoryMappedFileStatic

MemoryMappedFileStatic

Represents a simple file-to-memory mapping.

Public:

Methods:

Name | Description
CreateFromFile | Creates a memory-mapped file that has the specified access mode, name, capacity, and access type from a file on disk.
CreateFromFileStream | Creates a memory-mapped file that has the specified name, capacity, access type, and disposal requirement from a file on disk.
CreateNew | Creates a memory-mapped file that has the specified capacity and access type in system memory.
CreateOrOpen | Creates or opens a memory-mapped file that has the specified capacity and access type in system memory.
OpenExisting | Opens an existing memory-mapped file that has the specified name in system memory.

Remarks

A memory-mapped file maps the contents of a file to an application’s logical address space. Memory-mapped files enable programmers to work with extremely large files because memory can be managed concurrently, and they allow complete, random access to a file without the need for seeking. Memory-mapped files can also be shared across multiple processes.

The CreateFromFile and CreateFromFileStream methods create a memory-mapped file from a specified path or a FileStream of an existing file on disk. Changes are automatically propagated to disk when the file is unmapped.

The CreateNew method creates a memory-mapped file that is not mapped to an existing file on disk; and are suitable for creating shared memory for interprocess communication (IPC).

A memory-mapped file is associated with a name.

You can create multiple views of the memory-mapped file, including views of parts of the file. You can map the same part of a file to more than one address to create concurrent memory. For two views to remain concurrent, they have to be created from the same memory-mapped file. Creating two file mappings of the same file with two views does not provide concurrency.

Examples

The following example creates a memory-mapped view of a part of an extremely large file and manipulates a portion of it.

The example uses the User-Defined type MyColor and passes it to several MemoryMappedViewAccessor methods. In order for the code sample to work, the MyColor type needs to be exposed through a public class in an ActiveX dll or Exe.

Public Type MyColor
    Red     As Integer
    Green   As Integer
    Blue    As Integer
    Alpha   As Integer
End Type

Public Sub Brightener()
    Const Offset As Long = &H10000000   ' 256 megabytes
    Const Length As Long = &H20000000   ' 512 megabytes

    Dim Mmf As MemoryMappedFile
    Dim Accessor As MemoryMappedViewAccessor

    Set Mmf = MemoryMappedFile.CreateFromFile("c:\ExtremelyLargeImage.data", FileMode.OpenExisting, "ImgA")

    ' Create a random access view, from the 256th megabyte (the offset)
    ' to the 768th megabyte (the offset plus length).
    Set Accessor = Mmf.CreateViewAccessor(Offset, Length)

    Dim i As Long
    Dim Color As MyColor

    ' Make changes to the view
    Do While i < Length
        Accessor.Read i, Color
        Brighten Color, 10
        Accessor.WriteValue i, Color

        i = i + LenB(Color)
    Loop
End Sub

Private Sub Brighten(ByRef Color As MyColor, ByVal Value As Integer)
    Const Int16Max As Integer = 32737

    Color.Red = Min(Int16Max, CLng(Color.Red) + Value)
    Color.Green = Min(Int16Max, CLng(Color.Green) + Value)
    Color.Blue = Min(Int16Max, CLng(Color.Blue) + Value)
    Color.Alpha = Min(Int16Max, CLng(Color.Alpha) + Value)
End Sub

See Also

Project CorLib Overview

Class MemoryMappedFileStatic Overview

MemoryMappedFile


MemoryMappedFileStatic: CreateFromFile

CreateFromFile

Creates a memory-mapped file that has the specified access mode, name, capacity, and access type from a file on disk.

 Public Function CreateFromFile(
      ByRef Path As String,
      Optional ByVal Mode As FileMode = FileMode. OpenExisting,
      Optional ByRef MapName As String,
      Optional ByVal Capacity As Currency,
      Optional ByVal Access As MemoryMappedFileAccess = MemoryMappedFileAccess. ReadWrite ) As MemoryMappedFile

Parameters

Path
[ByRef] String. The path to the file to map.
Mode
[ByVal] Optional. FileMode. Access mode; can be any of the FileMode enumeration values except Append.

Default: FileMode . OpenExisting

MapName
[ByRef] Optional. String. A name to assign to the memory-mapped file. Specify vbNullString to rename unnamed.
Capacity
[ByVal] Optional. Currency. The maximum size, in bytes, to allocate to the memory-mapped file. Specify 0 to set the capacity to the size of the file on disk.
Access
[ByVal] Optional. MemoryMappedFileAccess. One of the enumeration values that specifies the type of access allowed to the memory-mapped file.

Default: MemoryMappedFileAccess . ReadWrite

Return Values

MemoryMappedFile - A memory-mapped file that has the specified characteristics.

Remarks

The Mode parameter pertains to the source file on disk.

If Capacity is larger than the size of the file on disk, the file on disk is increased to match the specified capacity even if no data is written to the memory-mapped file. To prevent this from occurring, specify 0 (zero) for the default capacity, which will internally set capacity to the size of the file on disk.

Exceptions

Exception | Condition
ArgumentException | MapName is an empty string. -or- Access is not an allowed value. -or- Path specifies an empty file. -or- Access is specified as ReadOnly and Capacity is greater than the size of the file indicated by Path. -or- Mode is Append.
ArgumentOutOfRangeException | Capacity is less than zero. -or- Capacity is less than the file size (but not zero). -or- Capacity is zero, and the size of the file on disk is also zero. -or- Access is not a defined MemoryMappedFileAccess value. -or- The size of the file indicated by Path is greater than Capacity.

See Also

Project CorLib Overview

Class MemoryMappedFileStatic Overview


MemoryMappedFileStatic: CreateFromFileStream

CreateFromFileStream

Creates a memory-mapped file that has the specified name, capacity, access type, and disposal requirement from a file on disk.

 Public Function CreateFromFileStream(
      ByVal FileStream As FileStream,
      ByRef MapName As String,
      ByVal Capacity As Currency,
      ByVal Access As MemoryMappedFileAccess,
      ByVal LeaveOpen As Boolean ) As MemoryMappedFile

Parameters

FileStream
[ByVal] FileStream. The FileStream to the file to map.
MapName
[ByRef] String. A name to assign to the memory-mapped file. Specify vbNullString to leave mapping unnamed.
Capacity
[ByVal] Currency. The maximum size, in bytes, to allocate to the memory-mapped file. Specify 0 to set the capacity to the size of the file on disk.
Access
[ByVal] MemoryMappedFileAccess. One of the enumeration values that specifies the type of access allowed to the memory-mapped file.

This parameter cant be set to WriteOnly.

LeaveOpen
[ByVal] Boolean. True to not dispose fileStream after the MemoryMappedFile is closed; False to dispose FileStream.

Return Values

MemoryMappedFile - A memory-mapped file that has the specified characteristics.

Remarks

If Capacity is larger than the size of the file on disk, the file on disk is increased to match the specified capacity even if no data is written to the memory-mapped file. To prevent this from occurring, specify 0 (zero) for the default capacity, which will internally set Capacity to the size of the file on disk.

Exceptions

Exception | Condition
ArgumentException | MapName is an empty string. -or- Capacity and the length of the file are zero. -or- Access is set to the WriteOnly enumeration value, which is not allowed. -or- Access is set to the ReadOnly enumeration value and Capacity is larger than file size.
ArgumentNullException | FileStream is Nothing.
ArgumentOutOfRangeException | Capacity is less than zero. -or- Capacity is less than the file size. -or- Access is not a valid MemoryMappedFileAccess enumeration value.
ObjectDisposedException | FileStream was closed.
IOException | MapName already exists.

See Also

Project CorLib Overview

Class MemoryMappedFileStatic Overview


MemoryMappedFileStatic: CreateNew

CreateNew

Creates a memory-mapped file that has the specified capacity and access type in system memory.

 Public Function CreateNew(
      ByRef MapName As String,
      ByVal Capacity As Currency,
      Optional ByVal Access As MemoryMappedFileAccess = MemoryMappedFileAccess. ReadWrite ) As MemoryMappedFile

Parameters

MapName
[ByRef] String. A name to assign to the memory-mapped file.
Capacity
[ByVal] Currency. The maximum size, in bytes, to allocate to the memory-mapped file.
Access
[ByVal] Optional. MemoryMappedFileAccess. One of the enumeration values that specifies the type of access allowed to the memory-mapped file. The default is ReadWrite.

Default: MemoryMappedFileAccess . ReadWrite

Return Values

MemoryMappedFile - A memory-mapped file that has the specified characteristics.

Remarks

Use this method to create a memory-mapped file that is not persisted (that is, not associated with a file on disk), which you can use to share data between processes.

Exceptions

Exception | Condition
ArgumentException | MapName is an empty string. -or- Access is set to write-only with the WriteOnly enumeration value.
 | Capacity is less than or equal to zero. -or- Access is not a valid MemoryMappedFileAccess enumeration value.

See Also

Project CorLib Overview

Class MemoryMappedFileStatic Overview


MemoryMappedFileStatic: CreateOrOpen

CreateOrOpen

Creates or opens a memory-mapped file that has the specified capacity and access type in system memory.

 Public Function CreateOrOpen(
      ByRef MapName As String,
      ByVal Capacity As Currency,
      Optional ByVal Access As MemoryMappedFileAccess = MemoryMappedFileAccess. ReadWrite ) As MemoryMappedFile

Parameters

MapName
[ByRef] String. A name to assign to the memory-mapped file.
Capacity
[ByVal] Currency. The maximum size, in bytes, to allocate to the memory-mapped file.
Access
[ByVal] Optional. MemoryMappedFileAccess. One of the enumeration values that specifies the type of access allowed to the memory-mapped file. The default is ReadWrite.

Default: MemoryMappedFileAccess . ReadWrite

Return Values

MemoryMappedFile - A memory-mapped file that has the specified characteristics.

Remarks

Use this method to create or open a memory-mapped file that is not persisted (that is, not associated with a file on disk), which you can use to share data between processes.

Exceptions

Exception | Condition
ArgumentException | MapName is an empty string.
ArgumentNullException | MapName is vbNullString.
ArgumentOutOfRangeException | Capacity is greater than the size of the logical address space. -or- Capacity is less than or equal to zero. -or- Access is not a valid MemoryMappedFileAccess enumeration value.

See Also

Project CorLib Overview

Class MemoryMappedFileStatic Overview


MemoryMappedFileStatic: OpenExisting

OpenExisting

Opens an existing memory-mapped file that has the specified name in system memory.

 Public Function OpenExisting(
      ByRef MapName As String,
      Optional ByVal DesiredAccessRights As MemoryMappedFileRights = MemoryMappedFileRights. ReadWrite ) As MemoryMappedFile

Parameters

MapName
[ByRef] String. The name of the memory-mapped file to open.
DesiredAccessRights
[ByVal] Optional. MemoryMappedFileRights. One of the enumeration values that specifies the access rights to apply to the memory-mapped file.

Default: MemoryMappedFileRights . ReadWrite

Return Values

MemoryMappedFile - A memory-mapped file that has the specified name.

Remarks

The memory-mapped file can be either a persisted memory-mapped file (associated with a file on disk) or non persisted.

Exceptions

Exception | Condition
ArgumentException | MapName is an empty string.
ArgumentNullException | MapName is vbNullString.
ArgumentOutOfRangeException | DesiredAccessRights is not a valid MemoryMappedFileRights enumeration value.
FileNotFoundException | The file specified for MapName does not exist.

See Also

Project CorLib Overview

Class MemoryMappedFileStatic Overview


MemoryMappedViewAccessor

MemoryMappedViewAccessor

Represents a randomly accessed view of a memory-mapped file.

Implements:

IObject

Public:

Properties:

Name | Description
CanRead (get) | Determines whether the accessor is readable.
CanWrite (get) | Determines whether the accessory is writable.
Capacity (get) | Gets the capacity of the accessor.
PointerOffset (get) | Gets the number of bytes by which the starting position of this view is offset from the beginning of the memory-mapped file.

Methods:

Name | Description
Equals | Determines whether the specified value passed in is equal to the current object.
Flush | Clears all buffers for this view and causes any buffered data to be written to the underlying file.
GetHashCode | Serves as the default hash function.
Read | Reads a structure of the type passed in from the accessor into a provided reference.
ReadArray | Reads structures of the type passed in from the accessor into an array of the type passed in.
ReadBoolean | Reads a boolean value from the accessor.
ReadByte | Reads a byte value from the accessor.
ReadChar | Reads a character from the accessor.
ReadCurrency | Reads a 64-bit currency from the accessor.
ReadDate | Read a Date from the accessor.
ReadDecimal | Reads a decimal value from the accessor.
ReadDouble | Reads a double-precision floating-point value from the accessor.
ReadInt16 | Reads a 16-bit integer from the accessor.
ReadInt32 | Reads a 32-bit integer from the accessor.
ReadInt64 | Reads a 64-bit integer from the accessor.
ReadSingle | Reads a single-precision floating-point value from the accessor.
ToString | Returns a string that represents the current object.
WriteArray | Writes structures of the type from an array passed into the accessor.
WriteValue | Writes the value to the accessor.

Remarks

Use the CreateViewAccessor method of a MemoryMappedFile object to get this view.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: CanRead (get)

CanRead

Determines whether the accessor is readable.

 Public Property Get CanRead ( ) As Boolean

Return Values

Boolean - True if the accessor is readable; otherwise, False.

Read Only.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: CanWrite (get)

CanWrite

Determines whether the accessory is writable.

 Public Property Get CanWrite ( ) As Boolean

Return Values

Boolean - True if the accessor is writable; otherwise, False.

Read Only.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: Capacity (get)

Capacity

Gets the capacity of the accessor.

 Public Property Get Capacity ( ) As Long

Return Values

Long - The capacity of the accessor.

Read Only.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: Equals

Equals

Determines whether the specified value passed in is equal to the current object.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare to the current object.

Return Values

Boolean - True if the specified value is equal to the current object; otherwise, False.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview

IObject


MemoryMappedViewAccessor: Flush

Flush

Clears all buffers for this view and causes any buffered data to be written to the underlying file.

 Public Sub Flush ( )

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: GetHashCode

GetHashCode

Serves as the default hash function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A hash code for the current object.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview

IObject


MemoryMappedViewAccessor: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: PointerOffset (get)

PointerOffset

Gets the number of bytes by which the starting position of this view is offset from the beginning of the memory-mapped file.

 Public Property Get PointerOffset ( ) As Currency

Return Values

Currency - The number of bytes between the starting position of this view and the beginning of the memory-mapped file.

Read Only.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: Read

Read

Reads a structure of the type passed in from the accessor into a provided reference.

 Public Sub Read(
      ByVal Position As Long,
      ByRef Structure As Variant )

Parameters

Position
[ByVal] Long. The number of bytes into the accessor at which to begin reading.
Structure
[ByRef] Variant. The structure to contain the read data.

Exceptions

Exception | Condition
ArgumentException | There are not enough bytes after Position to read a value. -or- Structure is not a user-defined or primitive type.
ArgumentOutOfRangeException | Position is less than zero or greater than the capacity of the accessor.
NotSupportedException | The accessor does not support reading.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: ReadArray

ReadArray

Reads structures of the type passed in from the accessor into an array of the type passed in.

 Public Function ReadArray(
      ByVal Position As Long,
      ByRef Arr As Variant,
      ByVal Offset As Long,
      ByVal Count As Long ) As Long

Parameters

Position
[ByVal] Long. The number of bytes in the accessor at which to begin reading.
Arr
[ByRef] Variant. The array to contain the structures read from the accessor.
Offset
[ByVal] Long. The index in array in which to place the first copied structure.
Count
[ByVal] Long. The number of structures of the type passed in to read from the accessor.

Return Values

Long - The number of structures read into Arr. This value can be less than Count if there are fewer structures available, or zero if the end of the accessor is reached.

Exceptions

Exception | Condition
ArgumentException | Arr is not large enough to contain Count of structures (starting from Position).
ArgumentNullException | Arr is null
ArgumentOutOfRangeException | Position is less than zero or greater than the capacity of the accessor.
NotSupportedException | The accessor does not support reading.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: ReadBoolean

ReadBoolean

Reads a boolean value from the accessor.

 Public Function ReadBoolean(
      ByVal Position As Long ) As Boolean

Parameters

Position
[ByVal] Long. The number of bytes into the accessor at which to begin reading.

Return Values

Boolean - The value that was read.

Exceptions

Exception | Condition
ArgumentException | There are not enough bytes after Position to read a value.
ArgumentOutOfRangeException | Position is less than zero or greater than the capacity of the accessor.
NotSupportedException | The accessor does not support reading.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: ReadByte

ReadByte

Reads a byte value from the accessor.

 Public Function ReadByte(
      ByVal Position As Long ) As Byte

Parameters

Position
[ByVal] Long. The number of bytes into the accessor at which to begin reading.

Return Values

Byte - The value that was read.

Remarks

Exception | Condition
ArgumentException | There are not enough bytes after Position to read a value.
ArgumentOutOfRangeException | Position is less than zero or greater than the capacity of the accessor.
NotSupportedException | The accessor does not support reading.

Exceptions

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: ReadChar

ReadChar

Reads a character from the accessor.

 Public Function ReadChar(
      ByVal Position As Long ) As Integer

Parameters

Position
[ByVal] Long. The number of bytes into the accessor at which to begin reading.

Return Values

Integer - The value that was read.

Remarks

The ReadChar method does not attempt to apply any encoding. It will simply read two consecutive bytes as a character.

This method will return the same value as MemoryMappedViewAccessor.ReadInt16.

Exceptions

Exception | Condition
ArgumentException | There are not enough bytes after Position to read a value.
ArgumentOutOfRangeException | Position is less than zero or greater than the capacity of the accessor.
NotSupportedException | The accessor does not support reading.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: ReadCurrency

ReadCurrency

Reads a 64-bit currency from the accessor.

 Public Function ReadCurrency(
      ByVal Position As Long ) As Currency

Parameters

Position
[ByVal] Long. The number of bytes into the accessor at which to begin reading.

Return Values

Currency - The value that was read.

Remarks

The ReadCurrency method reads 64-bits but does not scale the value to create a Currency without a fractional part. For example if the 64-bits read is equal to 1 then the returned currency value would be 0.0001.

Exceptions

Exception | Condition
ArgumentException | There are not enough bytes after Position to read a value.
ArgumentOutOfRangeException | Position is less than zero or greater than the capacity of the accessor.
NotSupportedException | The accessor does not support reading.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: ReadDate

ReadDate

Read a Date from the accessor.

 Public Function ReadDate(
      ByVal Position As Long ) As Date

Parameters

Position
[ByVal] Long. The number of bytes into the accessor at which to begin reading.

Return Values

Date - The value to be read.

Remarks

The ReadDate method reads 64-bits as Ticks to represent the Date. This means that there is a possible invalid date value read. This would cause an OverflowException to be thrown.

Exceptions

Exception | Condition
ArgumentException | There are not enough bytes after Position to read a value.
ArgumentOutOfRangeException | Position is less than zero or greater than the capacity of the accessor.
OverflowException | A value was read that cannot be represented as a valid OLE Automation Date.
NotSupportedException | The accessor does not support reading.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: ReadDecimal

ReadDecimal

Reads a decimal value from the accessor.

 Public Function ReadDecimal(
      ByVal Position As Long ) As Variant

Parameters

Position
[ByVal] Long. The number of bytes into the accessor at which to begin reading.

Return Values

Variant - The value that was read.

Exceptions

Exception | Condition
ArgumentException | There are not enough bytes after Position to read a value.
ArgumentOutOfRangeException | Position is less than zero or greater than the capacity of the accessor.
NotSupportedException | The accessor does not support reading.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: ReadDouble

ReadDouble

Reads a double-precision floating-point value from the accessor.

 Public Function ReadDouble(
      ByVal Position As Long ) As Double

Parameters

Position
[ByVal] Long. The number of bytes into the accessor at which to begin reading.

Return Values

Double - The value that was read.

Exceptions

Exception | Condition
ArgumentException | There are not enough bytes after Position to read a value.
ArgumentOutOfRangeException | Position is less than zero or greater than the capacity of the accessor.
NotSupportedException | The accessor does not support reading.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: ReadInt16

ReadInt16

Reads a 16-bit integer from the accessor.

 Public Function ReadInt16(
      ByVal Position As Long ) As Integer

Parameters

Position
[ByVal] Long. The number of bytes into the accessor at which to begin reading.

Return Values

Integer - The value that was read.

Exceptions

Exception | Condition
ArgumentException | There are not enough bytes after Position to read a value.
ArgumentOutOfRangeException | Position is less than zero or greater than the capacity of the accessor.
NotSupportedException | The accessor does not support reading.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: ReadInt32

ReadInt32

Reads a 32-bit integer from the accessor.

 Public Function ReadInt32(
      ByVal Position As Long ) As Long

Parameters

Position
[ByVal] Long. The number of bytes into the accessor at which to begin reading.

Return Values

Long - The value that was read.

Exceptions

Exception | Condition
ArgumentException | There are not enough bytes after Position to read a value.
ArgumentOutOfRangeException | Position is less than zero or greater than the capacity of the accessor.
NotSupportedException | The accessor does not support reading.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: ReadInt64

ReadInt64

Reads a 64-bit integer from the accessor.

 Public Function ReadInt64(
      ByVal Position As Long ) As Int64

Parameters

Position
[ByVal] Long. The number of bytes into the accessor at which to begin reading.

Return Values

Int64 - The value that was read.

Exceptions

Exception | Condition
ArgumentException | There are not enough bytes after Position to read a value.
ArgumentOutOfRangeException | Position is less than zero or greater than the capacity of the accessor.
NotSupportedException | The accessor does not support reading.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: ReadSingle

ReadSingle

Reads a single-precision floating-point value from the accessor.

 Public Function ReadSingle(
      ByVal Position As Long ) As Single

Parameters

Position
[ByVal] Long. The number of bytes into the accessor at which to begin reading.

Return Values

Single - The value that was read.

Exceptions

Exception | Condition
ArgumentException | There are not enough bytes after Position to read a value.
ArgumentOutOfRangeException | Position is less than zero or greater than the capacity of the accessor.
NotSupportedException | The accessor does not support reading.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: ToString

ToString

Returns a string that represents the current object.

 Public Function ToString ( ) As String

Return Values

String - A string the represents the current object.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview

IObject


MemoryMappedViewAccessor: WriteArray

WriteArray

Writes structures of the type from an array passed into the accessor.

 Public Sub WriteArray(
      ByVal Position As Long,
      ByRef Arr As Variant,
      ByVal Offset As Long,
      ByVal Count As Long )

Parameters

Position
[ByVal] Long. The number of bytes into the accessor at which to begin writing.
Arr
[ByRef] Variant. The array to write into the accessor.
Offset
[ByVal] Long. The index in Arr to start writing from.
Count
[ByVal] Long. The number of structures in Arr to write.

Exceptions

Exception | Condition
ArgumentException | There are not enough bytes in the accessor after Position to write the number of structures specified by Count.
ArgumentOutOfRangeException | Position is less than zero or greater than the capacity of the accessor. -or- Offset is less than the lower-bound of Arr. -or- Count is less than zero.
NotSupportedException | The accessor does not support writing.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewAccessor: WriteValue

WriteValue

Writes the value to the accessor.

 Public Sub WriteValue(
      ByVal Position As Long,
      ByRef Value As Variant )

Parameters

Position
[ByVal] Long. The number of bytes into the accessor at which to begin writing.
Value
[ByRef] Variant. The value to write.

Exceptions

Exception | Condition
ArgumentException | There are not enough bytes after Position to write a value.
ArgumentOutOfRangeException | Position is less than zero or greater than the capacity of the accessor.
NotSupportedException | The accessor does not support writing.

See Also

Project CorLib Overview

Class MemoryMappedViewAccessor Overview


MemoryMappedViewStream

MemoryMappedViewStream

Represents a view of a memory-mapped file as a sequentially accessed stream.

Implements:

IObject
Stream

Public:

Properties:

Name | Description
CanRead (get) | Gets a value indicating whether a stream supports reading.
CanSeek (get) | Gets a value indicating whether a stream supports seeking.
CanTimeout (get) | Gets a value that determines whether the current stream can time out.
CanWrite (get) | Gets a value indicating whether a stream supports writing.
Capacity (get) | Gets the stream length (size) or the total amount of memory assigned to a stream (capacity).
Length (get) | Gets the length of the data in a stream.
Position (get) | Gets the current position in a stream.
Position (let) | Sets the current position in a stream.
ReadTimeout (get) | Gets a value, in miliseconds, that determines how long the stream will attempt to read before timing out.
ReadTimeout (let) | Sets a value, in miliseconds, that determines how long the stream will attempt to read before timing out.
WriteTimeout (get) | Gets a value, in miliseconds, that determines how long the stream will attempt to write before timing out.
WriteTimeout (let) | Sets a value, in miliseconds, that determines how long the stream will attempt to write before timing out.

Methods:

Name | Description
BeginRead | Begins an asynchronous read operation.
BeginWrite | Begins an asynchronous write operation. (Consider using WriteAsync instead; see the Remarks section.)
CloseStream | Closes the current stream and releases any resources (such as file handles) associated with the current stream.
CopyTo | Reads the bytes from the current stream and writes them to another stream.
EndRead | Waits for the pending asynchronous read to complete.
EndWrite | Ends an asynchronous write operation.
Equals | Determines whether the specified value passed in is equal to the current object.
Flush | Clears all buffers for this stream and causes any buffered data to be written to the underlying file.
GetHashCode | Serves as the default hash function.
ReadBlock | Reads the specified number of bytes into the specified array.
ReadByte | Reads a byte from a stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
SeekPosition | Sets the current position of the current stream to the given value.
SetLength | Sets the length of the current stream.
ToString | Returns a string that represents the current object.
WriteBlock | Writes a block of bytes to the current stream using data from a buffer.
WriteByte | Writes a byte to the current position in the file stream.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: BeginRead

BeginRead

Begins an asynchronous read operation.

 Public Function BeginRead(
      Buffer ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long,
      Optional ByVal Callback As AsyncCallback,
      Optional State As Variant ) As IAsyncResult

Parameters

Buffer
[ByRef] Byte. The buffer to read the data into.
Offset
[ByVal] Long. The byte offset in buffer at which to begin writing data read from the stream.
Count
[ByVal] Long. The maximum number of bytes to read.
Callback
[ByVal] Optional. AsyncCallback. An optional asynchronous callback, to be called when the read is complete.
State
[ByRef] Optional. Variant. A user-provided object that distinguishes this particular asynchronous read request from other requests.

Return Values

IAsyncResult - An IAsyncResult that represents the asynchronous read, which could still be pending.

Remarks

The default implementation of BeginRead on a stream calls the ReadBlock method synchronously.

Exceptions

Exception | Condition
ArgumentException | One or more of the arguments is invalid.
ObjectDisposedException | Methods were called after the stream was closed.
NotSupportedException | The current Stream implementation does not support the read operation.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: BeginWrite

BeginWrite

Begins an asynchronous write operation. (Consider using WriteAsync instead; see the Remarks section.)

 Public Function BeginWrite(
      Buffer ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long,
      Optional ByVal Callback As AsyncCallback,
      Optional State As Variant ) As IAsyncResult

Parameters

Buffer
[ByRef] Byte. The buffer to write data from.
Offset
[ByVal] Long. The byte offset in Buffer from which to begin writing.
Count
[ByVal] Long. The maximum number of bytes to write.
Callback
[ByVal] Optional. AsyncCallback. An optional asynchronous callback, to be called when the write is complete.
State
[ByRef] Optional. Variant. A user-provided object that distinguishes this particular asynchronous write request from other requests.

Return Values

IAsyncResult - An IAsyncResult that represents the asynchronous write, which could still be pending.

Remarks

The default implementation of BeginWrite on a stream calls the Write method synchronously.

Exceptions

Exception | Condition
ArgumentException | Attempted an asynchronous write past the end of the stream, or a disk error occurs.
ObjectDisposedException | Methods were called after the stream was closed.
NotSupportedException | The current Stream implementation does not support the write operation.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: CanRead (get)

CanRead

Gets a value indicating whether a stream supports reading.

 Public Property Get CanRead ( ) As Boolean

Return Values

Boolean - False if the object was created by a constructor with an Access parameter that did not include reading the stream and if the stream is closed; otherwise, True.

Remarks

This property indicates whether the current stream object supports reading.

Read Only.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: CanSeek (get)

CanSeek

Gets a value indicating whether a stream supports seeking.

 Public Property Get CanSeek ( ) As Boolean

Return Values

Boolean - False if the stream is closed; otherwise, True.

Read Only.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: CanTimeout (get)

CanTimeout

Gets a value that determines whether the current stream can time out.

 Public Property Get CanTimeout ( ) As Boolean

Return Values

Boolean - A value that determines whether the current stream can time out.

Remarks

The CanTimeout property always returns False.

Read Only.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: CanWrite (get)

CanWrite

Gets a value indicating whether a stream supports writing.

 Public Property Get CanWrite ( ) As Boolean

Return Values

Boolean - False if the object was created by a constructor with an Access parameter value that supports writing or was created by a constructor that had no parameters, or if the stream is closed; otherwise, True.

Remarks

This property indicates whether the current stream object supports writing.

Read Only.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: Capacity (get)

Capacity

Gets the stream length (size) or the total amount of memory assigned to a stream (capacity).

 Public Property Get Capacity ( ) As Long

Return Values

Long - The size or capacity of the stream.

Remarks

This property returns the Capacity value provided to the constructor. If no Capacity value was specified when the stream was initialized, this property returns the stream length.

Read Only.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: CloseStream

CloseStream

Closes the current stream and releases any resources (such as file handles) associated with the current stream.

 Public Sub CloseStream ( )

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: CopyTo

CopyTo

Reads the bytes from the current stream and writes them to another stream.

 Public Sub CopyTo(
      ByVal Destination As Stream,
      Optional ByVal BufferSize As Long = 81920 )

Parameters

Destination
[ByVal] Stream. The stream to which the contents of the current stream will be copied.
BufferSize
[ByVal] Optional. Long. The size of the buffer. This value must be greater than zero. The default size is 81920.

Default: 81920

Remarks

Copying begins at the current position in the current stream, and does not reset the position of the destination stream after the copy operation is complete.

Exceptions

Exception | Condition
ArgumentNullException | Destination is Nothing.
NotSupportedException | The current stream does not support reading. -or- Destination does not support writing.
ObjectDisposedException | Either the current stream or Destination were closed before the CopyTo method was called.
IOException | An I/O error occurred.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: EndRead

EndRead

Waits for the pending asynchronous read to complete.

 Public Function EndRead(
      ByVal AsyncResult As IAsyncResult ) As Long

Parameters

AsyncResult
[ByVal] IAsyncResult. The reference to the pending asynchronous request to finish.

Return Values

Long - The number of bytes read from the stream, between zero (0) and the number of bytes you requested. Streams return zero (0) only at the end of the stream, otherwise, they should block until at least one byte is available.

Remarks

Call EndRead to determine how many bytes were read from the stream.

EndRead can be called once on every IAsyncResult from BeginRead.

This method blocks until the I/O operation has completed.

Exceptions

Exception | Condition
ArgumentNullException | AsyncResult is Nothing.
ArgumentException | A handle to the pending read operation is not available. - or - The pending operation does not support reading.
InvalidOperationException | AsyncResult did not originate from a BeginRead method on the current stream.
IOException | The stream is closed or an internal error has occurred.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: EndWrite

EndWrite

Ends an asynchronous write operation.

 Public Sub EndWrite(
      ByVal AsyncResult As IAsyncResult )

Parameters

AsyncResult
[ByVal] IAsyncResult. A reference to the outstanding asynchronous I/O request.

Remarks

EndWrite must be called exactly once on every IAsyncResult from BeginWrite.

Exceptions

Exception | Condition
ArgumentNullException | AsyncResult is Nothing.
InvalidOperationException | AsyncResult did not originate from a BeginWrite method on the current stream.
IOException | The stream is closed or an internal error has occurred./td>

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: Equals

Equals

Determines whether the specified value passed in is equal to the current object.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare to the current object.

Return Values

Boolean - True if the specified value is equal to the current object; otherwise, False.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview

IObject


MemoryMappedViewStream: Flush

Flush

Clears all buffers for this stream and causes any buffered data to be written to the underlying file.

 Public Sub Flush ( )

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: GetHashCode

GetHashCode

Serves as the default hash function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A hash code for the current object.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview

IObject


MemoryMappedViewStream: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: Length (get)

Length

Gets the length of the data in a stream.

 Public Property Get Length ( ) As Long

Return Values

Long - If unchanged since the stream was initialized, this property returns the length value provided to the constructor. If changes to the stream have occurred, this property reflects any changes to the length of the data.

Read Only.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: Position (get)

Position

Gets the current position in a stream.

 Public Property Get Position ( ) As Currency

Return Values

Currency - The current position in the stream.

Read/Write.

Exceptions

Exception | Condition
ObjectDisposedException | The stream is closed.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: Position (let)

Position

Sets the current position in a stream.

 Public Property Let Position(
      ByVal Value As Currency )

Parameters

Value
[ByVal] Currency. The current position in the stream.

Read/Write.

Exceptions

Exception | Condition
ObjectDisposedException | The stream is closed.
ArgumentOutOfRangeException | The position is set to a negative value.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: ReadBlock

ReadBlock

Reads the specified number of bytes into the specified array.

 Public Function ReadBlock(
      Buffer ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long ) As Long

Parameters

Buffer
[ByRef] Byte. The array to read the bytes into.
Offset
[ByVal] Long. The starting index in Buffer to begin reading to.
Count
[ByVal] Long. The number of bytes to read from the stream.

Return Values

Long - The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.

Remarks

The offset parameter gives the offset of the byte in the array parameter (the buffer index) at which to begin reading, and the count parameter gives the maximum number of bytes to be read from this stream. The returned value is the actual number of bytes read, or zero if the end of the stream is reached.

Exceptions

Exception | Condition
ObjectDisposedException | The stream is closed.
NotSupportedException | The CanRead property is set to False.
ArgumentNullException | The Buffer parameter is set to null.
ArgumentOutOfRangeException | The Offset parameter is less than lower bound of Buffer. - or - The Count parameter is less than zero.
ArgumentException | The Offset parameter plus the Count parameter is greater than the upper bound of the buffer array.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: ReadByte

ReadByte

Reads a byte from a stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.

 Public Function ReadByte ( ) As Long

Return Values

Long - The unsigned byte cast to an Int32 object, or -1 if at the end of the stream.

Remarks

Use this method to return integer values from the stream.

Exceptions

Exception | Condition
ObjectDisposedException | The stream is closed.
NotSupportedException | The underlying memory does not support reading.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: ReadTimeout (get)

ReadTimeout

Gets a value, in miliseconds, that determines how long the stream will attempt to read before timing out.

 Public Property Get ReadTimeout ( ) As Long

Return Values

Long - A value, in miliseconds, that determines how long the stream will attempt to read before timing out.

Read/Write.

Exceptions

Exception | Condition
InvalidOperationException | The ReadTimeout method always throws an InvalidOperationException.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: ReadTimeout (let)

ReadTimeout

Sets a value, in miliseconds, that determines how long the stream will attempt to read before timing out.

 Public Property Let ReadTimeout(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. A value, in miliseconds, that determines how long the stream will attempt to read before timing out.

Read/Write.

Exceptions

Exception | Condition
InvalidOperationException | The ReadTimeout method always throws an InvalidOperationException.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: SeekPosition

SeekPosition

Sets the current position of the current stream to the given value.

 Public Function SeekPosition(
      ByVal Offset As Currency,
      ByVal Origin As SeekOrigin ) As Currency

Parameters

Offset
[ByVal] Currency. The point relative to Origin to begin seeking from.
Origin
[ByVal] SeekOrigin. Specifies the beginning, the end, or the current position as a reference point for origin, using a value of type SeekOrigin.

Return Values

Currency - The new position in the stream.

Exceptions

Exception | Condition
IOException | An attempt was made to seek before the beginning of the stream.
ArgumentOutOfRangeException | The Offset value is larger than the maximum size of the stream.
ArgumentException | Loc is invalid.
ObjectDisposedException | The stream is closed.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: SetLength

SetLength

Sets the length of the current stream.

 Public Sub SetLength(
      ByVal Value As Currency )

Parameters

Value
[ByVal] Currency. The desired length of the current stream in bytes.

Remarks

This method is internal only, because a stream that represents a view is not considered to have a length.

Exceptions

Exception | Condition
NotSupportedException | The method is not supported.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: Stream

Stream

 Implements Stream

Return Values

Stream -

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: ToString

ToString

Returns a string that represents the current object.

 Public Function ToString ( ) As String

Return Values

String - A string the represents the current object.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview

IObject


MemoryMappedViewStream: WriteBlock

WriteBlock

Writes a block of bytes to the current stream using data from a buffer.

 Public Sub WriteBlock(
      Buffer ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long )

Parameters

Buffer
[ByRef] Byte. The byte array from which to copy bytes to the current stream.
Offset
[ByVal] Long. The offset in the buffer at which to begin copying bytes to the current stream.
Count
[ByVal] Long. The number of bytes to write to the current stream.

Remarks

Writing occurs at the current position in the stream.

Exceptions

Exception | Condition
ObjectDisposedException | The stream is closed.
NotSupportedException | The underlying memory does not support writing. - or - An attempt is made to write to the stream and the CanWrite property is False. - or - The Count value is greater than the capacity of the stream. - or - The position is at the end of the stream capacity.
IOException | An I/O error occurs.
ArgumentOutOfRangeException | The Offset parameter is less than the lower bound of the buffer array. - or - The Count parameter is less than zero.
ArgumentException | The Offset parameter plus the Count parameter is greater than the upper bound of the buffer array.
ArgumentNullException | The Buffer parameter is null.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: WriteByte

WriteByte

Writes a byte to the current position in the file stream.

 Public Sub WriteByte(
      ByVal Value As Byte )

Parameters

Value
[ByVal] Byte. A byte value written to the stream.

Exceptions

Exception | Condition
ObjectDisposedException | The stream is closed.
NotSupportedException | The underlying memory does not support writing. - or - An attempt is made to write to the stream and the CanWrite property is False. - or - The current position is at the end of the capacity of the stream.
IOException | The supplied Value causes the stream exceed its maximum capacity.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: WriteTimeout (get)

WriteTimeout

Gets a value, in miliseconds, that determines how long the stream will attempt to write before timing out.

 Public Property Get WriteTimeout ( ) As Long

Return Values

Long - A value, in miliseconds, that determines how long the stream will attempt to write before timing out.

Read/Write.

Exceptions

Exception | Condition
InvalidOperationException | The WriteTimeout method always throws an InvalidOperationException.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryMappedViewStream: WriteTimeout (let)

WriteTimeout

Sets a value, in miliseconds, that determines how long the stream will attempt to write before timing out.

 Public Property Let WriteTimeout(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. A value, in miliseconds, that determines how long the stream will attempt to write before timing out.

Read/Write.

Exceptions

Exception | Condition
InvalidOperationException | The WriteTimeout method always throws an InvalidOperationException.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview


MemoryStream

MemoryStream

Provides an in-memory stream of data that can be read/written and modified using Stream methods.

Implements:

IObject
Stream

Public:

Types:

Name | Description
BufferMode | The method a specified byte array should be referenced.

Properties:

Name | Description
CanRead (get) | Gets value indicating whether the current stream supports reading.
CanSeek (get) | Gets value indicating whether the current stream supports seeking.
CanTimeout (get) | Gets if the MemoryStream object supports timeout events.
CanWrite (get) | Gets value indicating whether the current stream supports writing.
Capacity (get) | Gets the number of bytes allocated for this stream.
Capacity (let) | Sets the number of bytes allocated for this stream.
Length (get) | Gets the length of the stream in bytes.
Position (get) | Returns the current position within the stream.
Position (let) | Sets the current position within the stream.
ReadTimeout (get) | Gets the timeout duration for a read operation.
ReadTimeout (let) | Sets the timeout duration for a read operation.
WriteTimeout (get) | Gets the timeout duration of a write operation.
WriteTimeout (let) | Sets the timeout duration for a write operation.

Methods:

Name | Description
BeginRead | Begins an asynchronous buffer read. For a MemoryStream, calling an asynchronous buffer read is identical to calling ReadBlock.
BeginWrite | Begins an asynchronous buffer write. For a MemoryStream, having an asynchronous buffer write is of no use.
CloseStream | Closes the MemoryStream and releases any resources allocated.
CopyTo | Reads the bytes from the current stream and writes them to another stream.
EndRead | Signifies the end of an asynchronous read from the stream.
EndWrite | Signifies the end of an asynchronous write to the stream.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
Flush | This has no purpose in a MemoryStream
GetHashCode | Returns a pseudo-unique number identifying this instance.
ReadBlock | Reads a specifiec number of bytes from the stream.
ReadByte | Reads a single byte from the stream.
SeekPosition | Sets the position within the current stream to the specified value.
SetLength | Sets the current length of the stream.
ToArray | Writes the stream contents to a byte array, regardless of the Position property.
ToString | Returns a string representation of this object instance.
WriteBlock | Writes an array of bytes to the underlying stream.
WriteByte | Writes a single byte to the underlying stream.
WriteTo | Writes the entire contents of this memory stream to another stream.

Remarks

The MemoryStream uses an array of bytes to back the data in memory. When the object is first created, no array is allocated until the first time the data must be accessed. The default capacity of the array is 4096 bytes. The capacity will grow by doubling the size of the current capacity. If The capacity needs to be larger, consider setting the Capacity directly to prevent the array from having to be resized as new data is written to the stream.

If the MemoryStream is created using a supplied Byte array, then no internal array will be allocated. The MemoryStream will access the supplied Byte array as if it were created by the MemoryStream object. As the underlying array is modified, the changes can be seen by directly accessing the array. Also, by modifying the array directly, the underlying stream will reflect the new data.

The Currency type is used for consistency across all stream objects. Internally, the MemoryStream only supports 2 ^ 31 bytes. Other streams may support more.

Caution

If a Byte array is being supplied to the MemoryStream and Mode is ShareMode, then the array must out-live the MemoryStream object. It is the responsibility of the user to destroy the array after the stream has been destroyed. The MemoryStream object maintains a reference to the same array in memory, but does not deallocate the array when finished. While the object is alive, the array is locked to prevent it from being ReDimed or Erased. Closing the stream will release the lock and reference to the array, at which point the user has full control of the array.

Examples

The following code example shows how to read and write data using memory as a backing store.

Public Sub Main()
    Dim FirstString()   As Byte
    Dim SecondString()  As Byte
    Dim ByteArray()     As Byte
    Dim CharArray()     As Integer
    Dim UniEncoding     As New UnicodeEncoding
    Dim MemStream       As New MemoryStream
    Dim Count As Long
    Dim i As Long

    FirstString = UniEncoding.GetBytes("Invalid file path characters are:")
    SecondString = UniEncoding.GetBytes(Path.GetInvalidPathChars)

    MemStream.WriteBlock FirstString, 0, CorArray.Length(FirstString)

    For i = LBound(SecondString) To UBound(SecondString)
        MemStream.WriteByte SecondString(i)
    Next

    Debug.Print CorString.Format(t("Capacity = {0}, Length = {1}, Position = {2}\n"), MemStream.Capacity, MemStream.Length, MemStream.Position)

    MemStream.SeekPosition 0, SeekOrigin.FromBeginning

    ReDim ByteArray(0 To MemStream.Length - 1)
    Count = MemStream.ReadBlock(ByteArray, 0, 20)

    Do While Count < MemStream.Length
        ByteArray(Count) = MemStream.ReadByte
        Count = Count + 1
    Loop

    ReDim CharArray(0 To UniEncoding.GetCharCount(ByteArray, 0, Count) - 1)
    UniEncoding.GetDecoder.GetChars ByteArray, 0, Count, CharArray, 0

    Debug.Print NewString(CharArray)
End Sub

' The example code produces the following output.
'
'    Capacity = 256, Length = 138, Position = 138
'
'    Invalid file path characters are:"<>| 
'
'    

See Also

Project CorLib Overview

Class MemoryStream Overview

Constructors

Stream


MemoryStream: BeginRead

BeginRead

Begins an asynchronous buffer read. For a MemoryStream, calling an asynchronous buffer read is identical to calling ReadBlock.

 Public Function BeginRead(
      ByRef Buffer ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long,
      Optional ByVal Callback As AsyncCallback,
      Optional ByRef State As Variant ) As IAsyncResult

Parameters

Buffer
[ByRef] Byte. The destination array to copy the bytes into.
Offset
[ByVal] Long. The index in Buffer to begin copying to.
Count
[ByVal] Long. The maximum number of bytes to copy.
Callback
[ByVal] Optional. AsyncCallback. A listening object to be notified that the read is finished.
State
[ByRef] Optional. Variant. User data that can be carried within the IAsyncResult object returned.

Return Values

IAsyncResult - An IAsyncResult object used to identify the corrisponding Endread and report information about the buffer read.

Remarks

Since the stream is directly stored and accessed in memory, there is no waiting for reads to occur. The BeginRead method works identical to the ReadBlock method in terms of immediately reading stream data into the Buffer.

When defining the Count for the number of maximum bytes to be read, if the stream does not have enough bytes, the read will copy less bytes than Count.

If an exception has occurred during the read, it will not be thrown until the EndRead is executed.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: BeginWrite

BeginWrite

Begins an asynchronous buffer write. For a MemoryStream, having an asynchronous buffer write is of no use.

 Public Function BeginWrite(
      ByRef Buffer ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long,
      Optional ByVal Callback As AsyncCallback,
      Optional ByRef State As Variant ) As IAsyncResult

Parameters

Buffer
[ByRef] Byte. The source array to copy the bytes from into the stream.
Offset
[ByVal] Long. The starting index in the source Buffer to begin copying from.
Count
[ByVal] Long. The maximum number of bytes to be copied into the stream.
Callback
[ByVal] Optional. AsyncCallback. A user supplied object to be notified of the finish of the writing.
State
[ByRef] Optional. Variant. User data that can be carried within the IAsyncResult object return.

Return Values

IAsyncResult - An IAsyncResult object used to identify the corrisponding EndBread and report information about the buffer read.

Remarks

Since the stream is directly stored and accessed in memory, there is no waiting for reads to occur. The BeginWrite method works identical to the WriteBlock method in terms of reading immediately writing stream data to the stream.

When defining the Count for the number of maximum bytes to be written, if the Buffer does not have enough bytes, an exception will be thrown in the EndWrite method.

If an exception has occurred during the read, it will not be thrown until the EndRead is executed.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: BufferMode

BufferMode

The method a specified byte array should be referenced.

 Public Enum BufferMode

Values

ShareMode
The MemoryStream points to the original array. This prevents a copy of the array from occurring. Thid mode requires the specified array to out-live the MemoryStream object instance.
CopyMode
A new array will be allocated with the contents of the specified array leaving the original array intact.
AcquireMode
An internal array will point to the original array and set the original array variable to null. This effectively steals the specified array.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: CanRead (get)

CanRead

Gets value indicating whether the current stream supports reading.

 Public Property Get CanRead ( ) As Boolean

Return Values

Boolean - True if the stream supports reading; otherwise, False.

Remarks

If the stream is closed, this property return False.

Read Only.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: CanSeek (get)

CanSeek

Gets value indicating whether the current stream supports seeking.

 Public Property Get CanSeek ( ) As Boolean

Return Values

Boolean - True if the stream supports seeking; otherwise, False.

Remarks

If the stream is closed, this property return False.

Read Only.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: CanTimeout (get)

CanTimeout

Gets if the MemoryStream object supports timeout events.

 Public Property Get CanTimeout ( ) As Boolean

Return Values

Boolean - Always returns False.

Read Only.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: CanWrite (get)

CanWrite

Gets value indicating whether the current stream supports writing.

 Public Property Get CanWrite ( ) As Boolean

Return Values

Boolean - True if the stream supports writing; otherwise, False.

Remarks

If the MemoryStream object was created with the Writable parameter specified as True or the object was created with no parameters, then the stream supports writing.

If the stream is closed, this property return False.

Read Only.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: Capacity (get)

Capacity

Gets the number of bytes allocated for this stream.

 Public Property Get Capacity ( ) As Long

Return Values

Long - The length of the usable portion of the buffer for the stream.

Remarks

Capacity is the buffer length for system-provided byte arrays. Capacity cannot be set to a value less than the current length of the stream.

Read/Write.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | A capacity is set that is negative or less than the current length of the stream.
ObjectDisposedException | The current stream is closed.
NotSupportedException | Let is invoked on a stream whose capacity cannot be modified.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: Capacity (let)

Capacity

Sets the number of bytes allocated for this stream.

 Public Property Let Capacity(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The length of the usable portion of the buffer for the stream.

Remarks

Capacity is the buffer length for system-provided byte arrays. Capacity cannot be set to a value less than the current length of the stream.

Read/Write.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | A capacity is set that is negative or less than the current length of the stream.
ObjectDisposedException | The current stream is closed.
NotSupportedException | Let is invoked on a stream whose capacity cannot be modified.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: CloseStream

CloseStream

Closes the MemoryStream and releases any resources allocated.

 Public Sub CloseStream ( )

Remarks

If a user-supplied array is being used, it will be released at this point. The user then may modify the array as normal.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: CopyTo

CopyTo

Reads the bytes from the current stream and writes them to another stream.

 Public Sub CopyTo(
      ByVal Destination As Stream,
      Optional ByVal BufferSize As Long = 81920 )

Parameters

Destination
[ByVal] Stream. The stream to which the contents of the current stream will be copied.
BufferSize
[ByVal] Optional. Long. The size of the buffer. This value must be greater than zero. The default size is 81920.

Default: 81920

Remarks

Copying begins at the current position in the current stream, and does not reset the position of the destination stream after the copy operation is complete.

Exceptions

Exception | Condition
ArgumentNullException | Destination is Nothing.
NotSupportedException | The current stream does not support reading. -or- Destination does not support writing.
ObjectDisposedException | Either the current stream or Destination were closed before the CopyTo method was called.
IOException | An I/O error occurred.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: EndRead

EndRead

Signifies the end of an asynchronous read from the stream.

 Public Function EndRead(
      ByVal AsyncResult As IAsyncResult ) As Long

Parameters

AsyncResult
[ByVal] IAsyncResult. The IAsyncResult object returned from the BeginRead function.

Return Values

Long - The number of bytes read from the stream in to Buffer in the BeginRead method.

Remarks

This method is generally called anytime after BeginRead for a MemoryStream. Since the MemoryStream uses memory for the data store, there is no need to wait for the data to arrive. The BeginRead/EndRead calls are redundant and should not be used with the MemoryStream. Instead use the ReadBlock Method.

If any exceptions were caused during the reading then they will be thrown during the call to EndRead.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: EndWrite

EndWrite

Signifies the end of an asynchronous write to the stream.

 Public Sub EndWrite(
      ByVal AsyncResult As IAsyncResult )

Parameters

AsyncResult
[ByVal] IAsyncResult. The IAsyncResult returned from the BeginWrite function.

Remarks

This method is generally called anytime after BeginWrite for a MemoryStream. Since the MemoryStream uses memory for the data store, there is no need to wait for the data to be written. The BeginWrite/EndWrite calls are redundant and should not be used with the MemoryStream. Instead use the WriteBlock Method.

If any exceptions were caused during the reading then they will be thrown during the call to EndRead.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: Flush

Flush

This has no purpose in a MemoryStream

 Public Sub Flush ( )

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: Length (get)

Length

Gets the length of the stream in bytes.

 Public Property Get Length ( ) As Currency

Return Values

Currency - The length of the stream in bytes.

Remarks

The length of the stream differs from the capacity in that the capacity is the amount of allocated memory used to store the stream, and the length is the number of bytes used from within the allocated memory.

Read Only.

Exceptions

Exception | Condition
ObjectDisposedException | The stream is closed.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: Position (get)

Position

Returns the current position within the stream.

 Public Property Get Position ( ) As Currency

Return Values

Currency - The byte index within the stream.

Remarks

The position is the index at which the next read or write will occur. Position is alway zero based, even if a user-supplied array is not.

Read/Write.

Exceptions

Exception | Condition
ObjectDisposedException | The stream is closed.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: Position (let)

Position

Sets the current position within the stream.

 Public Property Let Position(
      ByVal Value As Currency )

Parameters

Value
[ByVal] Currency. The current position within the stream.

Remarks

The position is the index at which the next read or write will occur. Position is always zero based, even if a user-supplied array is not.

Read/Write.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | The position is set to a negative value or a value greater than 32bit integer max value.
ObjectDisposedException | The stream is closed.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: ReadBlock

ReadBlock

Reads a specifiec number of bytes from the stream.

 Public Function ReadBlock(
      ByRef Buffer ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long ) As Long

Parameters

Buffer
[ByRef] Byte. The destination to store the bytes being read from the stream.
Offset
[ByVal] Long. The startind index in Buffer to begin storing the bytes read from the stream.
Count
[ByVal] Long. The maximum number of bytes to be read from the stream.

Return Values

Long - The total number of bytes read from the stream.

Remarks

If Offset plus Count exceeds the end of Buffer then an exception will be thrown. If the current position in the stream is closer to the end than Count bytes, then only the remaining bytes will be read.

The stream must be open to read from it, otherwise an exception will be thrown.

After reading from the stream, the current position will advance the number of byte as returend.

Exceptions

Exception | Condition
ArgumentNullException | Buffer is uninitialized.
ArgumentException | Offset subtracted from the Buffer length is less than Count.
ArgumentOutOfRangeException | Offset or Count is negative.
ObjectDisposedException | The current stream instance is closed.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: ReadByte

ReadByte

Reads a single byte from the stream.

 Public Function ReadByte ( ) As Long

Return Values

Long - The byte cast to a Long, or -1 if the end of the stream has been reached.

Remarks

If the read operation is successful, the current position within the stream is advanced by one byte. If an exception occurs, the current position within the stream is unchanged.

Exceptions

Exception | Condition
ObjectDisposedException | The current stream instance is closed.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: ReadTimeout (get)

ReadTimeout

Gets the timeout duration for a read operation.

 Public Property Get ReadTimeout ( ) As Long

Return Values

Long - The timeout duration in milliseconds.

Remarks

This always throws an InvalidOperationException.

Read/Write.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: ReadTimeout (let)

ReadTimeout

Sets the timeout duration for a read operation.

 Public Property Let ReadTimeout(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new duration in milliseconds

Remarks

This always throws an InvalidOperationException.

Read/Write.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: SeekPosition

SeekPosition

Sets the position within the current stream to the specified value.

 Public Function SeekPosition(
      ByVal Offset As Currency,
      ByVal Loc As SeekOrigin ) As Currency

Parameters

Offset
[ByVal] Currency. The new position within the stream. This is relative to the Loc parameter, and can be positive or negative.
Loc
[ByVal] SeekOrigin. A value of type SeekOrigin, which acts as the seek reference point.

Return Values

Currency - The new position within the stream, calculated by combining the initial reference point and the offset.

Remarks

Seeking to any location beyond the length of the stream is supported.

Do not use the SeekPosition method to determine the new position in the stream if the MemoryStream was initialized with a non-zero offset. If you do, SeekPosition will return an inaccurate value. Instead, use the Position property to get the new position of the stream.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Offset is greater than max 32-bit value.
ArgumentException | There is an invalid SeekOrigin.
ObjectDisposedException | The current stream instance is closed.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: SetLength

SetLength

Sets the current length of the stream.

 Public Sub SetLength(
      ByVal Value As Currency )

Parameters

Value
[ByVal] Currency. The size of the stream in bytes.

Remarks

The shortening the length of the stream will truncate the excess data. If increasing the length, then the new exposed data will be set to zero.

If a user-supplied byte array is being used, this function has limited capabilites. The size of the stream can be changed to withing the origin size of the user-supplied byte array. If a length greater than the original array size is set, then an exception is thrown.

Exceptions

Exception | Condition
NotSupportedException | The current stream is not resizable and Value is larger than the current capacity. -or- The current stream does not support writing.
ArgumentOutOfRangeException | value is negative or is greater than the maximum length of the MemoryStream, where the maximum length is( MaxValue - origin), and origin is the index into the underlying buffer at which the stream starts.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: Stream

Stream

 Implements Stream

Return Values

Stream -

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: ToArray

ToArray

Writes the stream contents to a byte array, regardless of the Position property.

 Public Function ToArray ( ) As Byte ( )

Return Values

Byte() - A new byte array.

Remarks

This method omits unused bytes in MemoryStream from the array.

This method returns a copy of the contents of the MemoryStream as a byte array. If the current instance was constructed on a provided byte array, a copy of the section of the array to which this instance has access is returned. See the MemoryStream constructor NewMemoryStream for details.
Note
The method works when the MemoryStream is closed.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: WriteBlock

WriteBlock

Writes an array of bytes to the underlying stream.

 Public Sub WriteBlock(
      ByRef Buffer ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long )

Parameters

Buffer
[ByRef] Byte. The bytes to be written to the stream.
Offset
[ByVal] Long. The starting index in Buffer to begin writing from.
Count
[ByVal] Long. The maximum number of bytes to be written to the stream.

Remarks

The Offset parameter gives the offset of the first byte in Buffer to write from, and the Count parameter gives the number of bytes to write. If the write operation is successful, the current position within the stream is advanced by the number of bytes written. If an exception occurs, the current position within the stream is unchanged.

Except for a MemoryStream constructed with a Byte() parameter, write operations at the end of a MemoryStream expand the MemoryStream.

Exceptions

Exception | Condition
ArgumentNullException | Buffer is uninitialized.
NotSupportedException | The stream does not support writing. For additional information see CanWriter. -or- The current position is closer than Count bytes to the end of the stream, and the capacity cannot be modified.
ArgumentException | Offset subtracted from the Buffer length is less than Count.
ArgumentOutOfRangeException | Offset or Count is negative.
ObjectDisposedException | The current stream instance is closed.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: WriteByte

WriteByte

Writes a single byte to the underlying stream.

 Public Sub WriteByte(
      ByVal Value As Byte )

Parameters

Value
[ByVal] Byte. The byte to be written to the stream.

Remarks

Except for a MemoryStream constructed with a Byte() parameter, write operations at the end of a MemoryStream expand the MemoryStream.

Exceptions

Exception | Condition
NotSupportedException | The stream does not support writing. For additional information see CanWriter. -or- The current position is at the end of the stream, and the capacity cannot be modified.
ObjectDisposedException | The current stream instance is closed.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: WriteTimeout (get)

WriteTimeout

Gets the timeout duration of a write operation.

 Public Property Get WriteTimeout ( ) As Long

Return Values

Long - The timeout duration in milliseconds.

Remarks

This always throws an InvalidOperationException.

Read/Write.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: WriteTimeout (let)

WriteTimeout

Sets the timeout duration for a write operation.

 Public Property Let WriteTimeout(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new timeout duration in milliseconds.

Remarks

This always throws an InvalidOperationException.

Read/Write.

See Also

Project CorLib Overview

Class MemoryStream Overview


MemoryStream: WriteTo

WriteTo

Writes the entire contents of this memory stream to another stream.

 Public Sub WriteTo(
      ByVal Stream As Stream )

Parameters

Stream
[ByVal] Stream. The stream to write this memory stream to.

Exceptions

Exception | Condition
ArgumentNullException | Stream is Nothing.
ObjectDisposedException | The current or target stream is closed.

See Also

Project CorLib Overview

Class MemoryStream Overview


NotSupportedException

NotSupportedException

The exception that is thrown when an invoked method is not supported.

Implements:

Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

Remarks

Generally this exception will be thrown on objects that are set to not allow certain actions to be performed at the moment. An example would be receiving a read-only object of an ArrayList and then attempting to add an item to the list.

See Also

Project CorLib Overview

Class NotSupportedException Overview

Constructors

ExceptionMethods

Exception


NotSupportedException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class NotSupportedException Overview


NotSupportedException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class NotSupportedException Overview


NotSupportedException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class NotSupportedException Overview


NotSupportedException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class NotSupportedException Overview


NotSupportedException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception will then be returned to the caller.

When an InnerException of Nothing is reached, then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class NotSupportedException Overview


NotSupportedException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class NotSupportedException Overview


NotSupportedException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class NotSupportedException Overview


NotSupportedException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class NotSupportedException Overview


NotSupportedException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class NotSupportedException Overview

Exception


NotSupportedException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class NotSupportedException Overview


NotSupportedException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class NotSupportedException Overview


NotSupportedException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewSystemException.

Read Only.

See Also

Project CorLib Overview

Class NotSupportedException Overview


NotSupportedException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class NotSupportedException Overview


NotSupportedException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class NotSupportedException Overview


NotSupportedException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class NotSupportedException Overview


NotSupportedException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class NotSupportedException Overview


NumberFormatInfo

NumberFormatInfo

Provides numeric formatting information.

Implements:

ICloneable
IFormatProvider
IObject

Public:

Types:

Name | Description
CurrencyNegativePatterns | Output patterns for negative currency values. The $ is the currency symbol, then - is the negative symbol and n is the number.
CurrencyPositivePatterns | Output patterns for positive currency values. The $ is the currency symbol and n is the number.
NumberNegativePatterns | Output patterns for negative numbers.
PercentNegativePatterns | Output patterns for negative percentage values. The - is the negative symbol, # is the number and the % is the percentage symbol.
PercentPositivePatterns | Output patterns for positive percentage values. The # is the number and the % is the percentage symbol.

Properties:

Name | Description
CurrencyDecimalDigits (get) | Returns the default number of digits after the decimal separator.
CurrencyDecimalDigits (let) | Sets the default number of digits to be shown after the decimal separator.
CurrencyDecimalSeparator (get) | Returns the decimal separator used in formatting numbers into currency.
CurrencyDecimalSeparator (let) | Sets the decimal separator used in formatting numbers into currency.
CurrencyGroupSeparator (get) | Returns the string to be use as a group separator.
CurrencyGroupSeparator (let) | Sets the group separator to be used when separating digits.
CurrencyGroupSizes (get) | Returns an array of longs which represent a comma separator group size.
CurrencyGroupSizes (let) | Sets an array of longs which represent a set of group sizes before being comma separated.
CurrencyNegativePattern (get) | The numeric pattern to be used when formatting negative values.
CurrencyNegativePattern (let) | Sets the numeric pattern to be used when formatting negative values.
CurrencyPositivePattern (get) | Returns the formatting pattern to be used for positive currency values.
CurrencyPositivePattern (let) | Sets the formatting pattern to be used for positive currency values.
CurrencySymbol (get) | Returns the currency symbol.
CurrencySymbol (let) | Sets the currency symbol to be used.
IsReadOnly (get) | Returns if this instance is read-only.
NaNSymbol (get) | Returns the string representation for Not-A-Number.
NaNSymbol (let) | Sets the string representation for Not-A-Number.
NegativeInfinitySymbol (get) | Returns a string representation of negative infinty.
NegativeInfinitySymbol (let) | Sets the negative infinity representation.
NegativeSign (get) | Returns the negative symbol for negative numbers.
NegativeSign (let) | Sets the negative symbol to be used for negative numbers.
NumberDecimalDigits (get) | The default number of digits to be appended after the decimal point if one is used.
NumberDecimalDigits (let) | Sets the default number of digits to be appended after the decimal point.
NumberDecimalSeparator (get) | Returns the character used as a decimal point.
NumberDecimalSeparator (let) | Sets the character to be used as the decimal point.
NumberGroupSeparator (get) | Returns the separator character for groups of numbers.
NumberGroupSeparator (let) | Sets the separator charactor for a group of numbers.
NumberGroupSizes (get) | Returns the current group sizes array for formatted numbers.
NumberGroupSizes (let) | Sets the group sizes for formatted numbers.
NumberNegativePattern (get) | Returns the pattern to be used when formatting negative numbers.
NumberNegativePattern (let) | Sets the pattern to be used when formatting negative numbers.
PercentDecimalDigits (get) | Returns the number of digits to be displayed after the decimal point for percent formatted numbers.
PercentDecimalDigits (let) | Sets the number of digits after the decimal point for percent formatted numbers.
PercentDecimalSeparator (get) | Returns the decimal symbol for percent formatted numbers.
PercentDecimalSeparator (let) | Sets the decimal symbol for percent formatted numbers.
PercentGroupSeparator (get) | Returns the group separator for a percent formatted number.
PercentGroupSeparator (let) | Sets the group separator for a percent formatted number.
PercentGroupSizes (get) | Returns the current group sizes array for percent formatted numbers.
PercentGroupSizes (let) | Sets the group sizes for percent formatted numbers.
PercentNegativePattern (get) | Returns the selected negative pattern used in percent number formatting.
PercentNegativePattern (let) | Sets the negative pattern to be used in formatting negative percent numbers.
PercentPositivePattern (get) | Returns the pattern to be used in formatting positive percent numbers.
PercentPositivePattern (let) | Sets the pattern to be used in formatting positive percent numbers.
PercentSymbol (get) | Returns the percent symbol used in percent formatted numbers.
PercentSymbol (let) | Set the percent symbol used in percent formatted numbers.
PerMilleSymbol (get) | Returns the permille representation.
PerMilleSymbol (let) | Sets the permille representation.
PositiveInfinitySymbol (get) | Returns a string representation of positive infinity.
PositiveInfinitySymbol (let) | Sets the positive infinity representation.
PositiveSign (get) | Returns the current positive symbol.
PositiveSign (let) | Sets the positive symbol.

Methods:

Name | Description
Clone | Returns a clone of this instance.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetFormat | Returns a format provider of the requested type.
GetHashCode | Returns a pseudo-unique number identifying this instance.
ToString | Returns a string representation of this object instance.

Remarks

This table is from the Microsoft Dot NET 1.1 MSDN.
Format Character | Description and Associated Properties
c, C | Currency format. CurrencyNegativePattern, CurrencyPositivePattern, CurrencySymbol, CurrencyGroupSizes, CurrencyGroupSeparator, CurrencyDecimalDigits, CurrencyDecimalSeparator.
d, D | Decimal format.
e, E | Scientific (exponential) format.
f, F | Fixed-point format.
g, G | General format.
n, N | Number format. NumberNegativePattern, NumberGroupSizes, NumberGroupSeparator, NumberDecimalDigits, NumberDecimalSeparator.
x, X | Hexadecimal format.

Examples

This example shows how to format a value as a currency using the default formatting setting and a custom setting.

Private Sub Main()
    Dim Provider As New NumberFormatInfo

    ' Display the value using the default currency formatting.
    Debug.Print Object.ToString(123, "c", Provider)

    ' Set a custom currency format.
    Provider.CurrencySymbol = "$$"
    Provider.CurrencyDecimalDigits = 4
    Provider.CurrencyPositivePattern = [$ n]

    ' Display the value using the custom currency formatting.
    Debug.Print Object.ToString(123, "c", Provider)
End Sub

' This code produces the following output.
'
' ¤123.00
' $$ 123.0000

See Also

Project CorLib Overview

Class NumberFormatInfo Overview

NumberFormatInfoStatic

IFormatProvider

ICloneable


NumberFormatInfo: Clone

Clone

Returns a clone of this instance.

 Public Function Clone ( ) As NumberFormatInfo

Return Values

NumberFormatInfo - A clone of the original instance.

Remarks

A clone of a read-only instance does not become read-only.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: CurrencyDecimalDigits (get)

CurrencyDecimalDigits

Returns the default number of digits after the decimal separator.

 Public Property Get CurrencyDecimalDigits ( ) As Long

Return Values

Long - The default number of digits after the decimal separator.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: CurrencyDecimalDigits (let)

CurrencyDecimalDigits

Sets the default number of digits to be shown after the decimal separator.

 Public Property Let CurrencyDecimalDigits(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The default number of digits to be shown after the decimal separator.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: CurrencyDecimalSeparator (get)

CurrencyDecimalSeparator

Returns the decimal separator used in formatting numbers into currency.

 Public Property Get CurrencyDecimalSeparator ( ) As String

Return Values

String - The decimal separator character.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: CurrencyDecimalSeparator (let)

CurrencyDecimalSeparator

Sets the decimal separator used in formatting numbers into currency.

 Public Property Let CurrencyDecimalSeparator(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The decimal separator to be used in formatting.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: CurrencyGroupSeparator (get)

CurrencyGroupSeparator

Returns the string to be use as a group separator.

 Public Property Get CurrencyGroupSeparator ( ) As String

Return Values

String - The group separator string.

Remarks

Generally a comma is the group separator. However, in some parts of the world, a comma is not used.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: CurrencyGroupSeparator (let)

CurrencyGroupSeparator

Sets the group separator to be used when separating digits.

 Public Property Let CurrencyGroupSeparator(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The separator to be used when separating digits.

Remarks

Generally a comma is the group separator. However, in some parts of the world, a comma is not used.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: CurrencyGroupSizes (get)

CurrencyGroupSizes

Returns an array of longs which represent a comma separator group size.

 Public Property Get CurrencyGroupSizes ( ) As Long ( )

Return Values

Long() - An array of longs.

Remarks

Each element represents the number of digits that will be grouped together before a comma separator is inserted. Each element is used once to specify the group size, then the next element is used for the next group of digits, until the last group size. The last group size is used for the remainder of digits to be formatted.

If a 0 is specified for a group size, it can only be the last size in the array. A 0 as the last group size will prevent the remaining digits from being separated.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: CurrencyGroupSizes (let)

CurrencyGroupSizes

Sets an array of longs which represent a set of group sizes before being comma separated.

 Public Property Let CurrencyGroupSizes(
      ByRef Value ( ) As Long )

Parameters

Value
[ByRef] Long. An array of longs that are the group sizes.

Remarks

Each element represents the number of digits that will be grouped together before a comma separator is inserted. Each element is used once to specify the group size, then the next element is used for the next group of digits, until the last group size. The last group size is used for the remainder of digits to be formatted.

If a 0 is specified for a group size, it can only be the last size in the array. A 0 as the last group size will prevent the remaining digits from being separated.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: CurrencyNegativePattern (get)

CurrencyNegativePattern

The numeric pattern to be used when formatting negative values.

 Public Property Get CurrencyNegativePattern ( ) As CurrencyNegativePatterns

Return Values

CurrencyNegativePatterns - The negative pattern used.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: CurrencyNegativePattern (let)

CurrencyNegativePattern

Sets the numeric pattern to be used when formatting negative values.

 Public Property Let CurrencyNegativePattern(
      ByVal Value As CurrencyNegativePatterns )

Parameters

Value
[ByVal] CurrencyNegativePatterns. The pattern to be used when formatting.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: CurrencyNegativePatterns

CurrencyNegativePatterns

Output patterns for negative currency values. The $ is the currency symbol, then - is the negative symbol and n is the number.

 Public Enum CurrencyNegativePatterns

Values

[($n)] = 0
[-$n] = 1
[$-n] = 2
[$n-] = 3
[(n$)] = 4
[-n$] = 5
[n-$] = 6
[n$-] = 7
[-n $] = 8
[-$ n] = 9
[n $-] = 10
[$ n-] = 11
[$ -n] = 12
[n- $] = 13
[($ n)] = 14
[(n $)] = 15

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: CurrencyPositivePattern (get)

CurrencyPositivePattern

Returns the formatting pattern to be used for positive currency values.

 Public Property Get CurrencyPositivePattern ( ) As CurrencyPositivePatterns

Return Values

CurrencyPositivePatterns - The formatting pattern for positive currency values.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: CurrencyPositivePattern (let)

CurrencyPositivePattern

Sets the formatting pattern to be used for positive currency values.

 Public Property Let CurrencyPositivePattern(
      ByVal Value As CurrencyPositivePatterns )

Parameters

Value
[ByVal] CurrencyPositivePatterns. The formatting pattern to be used with positive currency values.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: CurrencyPositivePatterns

CurrencyPositivePatterns

Output patterns for positive currency values. The $ is the currency symbol and n is the number.

 Public Enum CurrencyPositivePatterns

Values

[$n] = 0
[n$] = 1
[$ n] = 2
[n $] = 3

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: CurrencySymbol (get)

CurrencySymbol

Returns the currency symbol.

 Public Property Get CurrencySymbol ( ) As String

Return Values

String - The currency symbol.

Remarks

In the US the symbol is the dollar sign $', in other parts of the world, other symbols are used.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: CurrencySymbol (let)

CurrencySymbol

Sets the currency symbol to be used.

 Public Property Let CurrencySymbol(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The currency symbol to be used when formatting currency.

Remarks

In the US the symbol is the dollar sign $', in other parts of the world, other symbols are used.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: GetFormat

GetFormat

Returns a format provider of the requested type.

 Public Function GetFormat(
      ByRef FormatType As String ) As Object

Parameters

FormatType
[ByRef] String. The name of the format provider.

Return Values

Object - The requested format provider, or Nothing if no format provider was found.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: IFormatProvider

IFormatProvider

 Implements IFormatProvider

Return Values

IFormatProvider -

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: IsReadOnly (get)

IsReadOnly

Returns if this instance is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - Value indicating if this instance is read-only.

Read Only.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: NaNSymbol (get)

NaNSymbol

Returns the string representation for Not-A-Number.

 Public Property Get NaNSymbol ( ) As String

Return Values

String - The string representation.

Remarks

Not-A-Number is achieved by dividing zero by zero. The default NaN symbol is "NaN".

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: NaNSymbol (let)

NaNSymbol

Sets the string representation for Not-A-Number.

 Public Property Let NaNSymbol(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new string NaN representation.

Remarks

Not-A-Number is achieved by dividing zero by zero. The default NaN symbol is "NaN".

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: NegativeInfinitySymbol (get)

NegativeInfinitySymbol

Returns a string representation of negative infinty.

 Public Property Get NegativeInfinitySymbol ( ) As String

Return Values

String - Negative infinity string.

Remarks

Negative infinity is achieved by dividing a negative number by zero. The default is "-Infinity".

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: NegativeInfinitySymbol (let)

NegativeInfinitySymbol

Sets the negative infinity representation.

 Public Property Let NegativeInfinitySymbol(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new string that represents negative infinity.

Remarks

Negative infinity is achieved by dividing a negative number by zero. The default is "-Infinity".

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: NegativeSign (get)

NegativeSign

Returns the negative symbol for negative numbers.

 Public Property Get NegativeSign ( ) As String

Return Values

String - The current negative symbol.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: NegativeSign (let)

NegativeSign

Sets the negative symbol to be used for negative numbers.

 Public Property Let NegativeSign(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new negative symbol.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: NumberDecimalDigits (get)

NumberDecimalDigits

The default number of digits to be appended after the decimal point if one is used.

 Public Property Get NumberDecimalDigits ( ) As Long

Return Values

Long - The number of digits to be appended after the decimal point if one is used.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: NumberDecimalDigits (let)

NumberDecimalDigits

Sets the default number of digits to be appended after the decimal point.

 Public Property Let NumberDecimalDigits(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The number of digits to be appended after the decimal point.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: NumberDecimalSeparator (get)

NumberDecimalSeparator

Returns the character used as a decimal point.

 Public Property Get NumberDecimalSeparator ( ) As String

Return Values

String - The decimal point character.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: NumberDecimalSeparator (let)

NumberDecimalSeparator

Sets the character to be used as the decimal point.

 Public Property Let NumberDecimalSeparator(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new character to be used as the decimal point.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: NumberGroupSeparator (get)

NumberGroupSeparator

Returns the separator character for groups of numbers.

 Public Property Get NumberGroupSeparator ( ) As String

Return Values

String - The character that is used as a separator between groups of numbers. This is typically a comma.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: NumberGroupSeparator (let)

NumberGroupSeparator

Sets the separator charactor for a group of numbers.

 Public Property Let NumberGroupSeparator(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The character to be used when separating groups of numbers. This is typically a comma.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: NumberGroupSizes (get)

NumberGroupSizes

Returns the current group sizes array for formatted numbers.

 Public Property Get NumberGroupSizes ( ) As Long ( )

Return Values

Long() - An array containing grouping sizes for a formatted number.

Remarks

A group size is the number of digits that are to be grouped together before being separated by the group separator symbol. Generally the group sizes is an array of one element having a value of 3.

The sizes can be changed to different sizes, such as {3,2,1}. This particular set of group sizes would cause a number 1234567890 to be formatted as 1,2,3,4,5,67,890. Once the last group size has been reached, it is repeatedly used in grouping the remaining digits.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: NumberGroupSizes (let)

NumberGroupSizes

Sets the group sizes for formatted numbers.

 Public Property Let NumberGroupSizes(
      ByRef Value ( ) As Long )

Parameters

Value
[ByRef] Long. A vbLong array containing the grouping sizes.

Remarks

A group size is the number of digits that are to be grouped together before being separated by the group separator symbol. Generally the group sizes is an array of one element having a value of 3.

The sizes can be changed to different sizes, such as {3,2,1}. This particular set of group sizes would cause a number 1234567890 to be formatted as 1,2,3,4,5,67,890. Once the last group size has been reached, it is repeatedly used in grouping the remaining digits.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: NumberNegativePattern (get)

NumberNegativePattern

Returns the pattern to be used when formatting negative numbers.

 Public Property Get NumberNegativePattern ( ) As NumberNegativePatterns

Return Values

NumberNegativePatterns - The pattern to be used.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: NumberNegativePattern (let)

NumberNegativePattern

Sets the pattern to be used when formatting negative numbers.

 Public Property Let NumberNegativePattern(
      ByVal Value As NumberNegativePatterns )

Parameters

Value
[ByVal] NumberNegativePatterns. The new pattern to be used.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: NumberNegativePatterns

NumberNegativePatterns

Output patterns for negative numbers.

 Public Enum NumberNegativePatterns

Values

[(n)] = 0
Negative value inside perenthesis. Negative symbol is not included.
[-n] = 1
Negative symbol before the value.
[- n] = 2
Negative symbol before the value, separated by a space.
[n-] = 3
Negative symbol after the value.
[n -] = 4
Negative symbol after the value, separated by a space.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PercentDecimalDigits (get)

PercentDecimalDigits

Returns the number of digits to be displayed after the decimal point for percent formatted numbers.

 Public Property Get PercentDecimalDigits ( ) As Long

Return Values

Long - The number of digits to display after the decimal point.

Remarks

This is used when a specifier of "p" is used with no associated digits (ie "p5").

If the number is less than the precision of the value, then the value is rounded to fit within the number of digits specified. If omitted the value is rounded to the number of digits returned by this property.

If the specified number of digits is larger than the precision of value, then the formatted value will be padded with zeros.

The default number of digits is 2.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PercentDecimalDigits (let)

PercentDecimalDigits

Sets the number of digits after the decimal point for percent formatted numbers.

 Public Property Let PercentDecimalDigits(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The number of digits to display after the decimal point.

Remarks

This is used when a specifier of "p" is used with no associated digits (ie "p5").

If the number is less than the precision of the value, then the value is rounded to fit within the number of digits specified. If omitted the value is rounded to the number of digits returned by this property.

If the specified number of digits is larger than the precision of value, then the formatted value will be padded with zeros.

The default number of digits is 2.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PercentDecimalSeparator (get)

PercentDecimalSeparator

Returns the decimal symbol for percent formatted numbers.

 Public Property Get PercentDecimalSeparator ( ) As String

Return Values

String - The symbol for decimal separation.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PercentDecimalSeparator (let)

PercentDecimalSeparator

Sets the decimal symbol for percent formatted numbers.

 Public Property Let PercentDecimalSeparator(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new decimal symbol.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PercentGroupSeparator (get)

PercentGroupSeparator

Returns the group separator for a percent formatted number.

 Public Property Get PercentGroupSeparator ( ) As String

Return Values

String - The group separator symbol.

Remarks

Generally a group separator is a comman ,'. However, different cultures may use different symbols.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PercentGroupSeparator (let)

PercentGroupSeparator

Sets the group separator for a percent formatted number.

 Public Property Let PercentGroupSeparator(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The symbol used as a group separator defined by the group sizes.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PercentGroupSizes (get)

PercentGroupSizes

Returns the current group sizes array for percent formatted numbers.

 Public Property Get PercentGroupSizes ( ) As Long ( )

Return Values

Long() - An array containing grouping sizes for a percent formatted number.

Remarks

A group size is the number of digits that are to be grouped together before being separated by the group separator symbol. Generally the group sizes is an array of one element having a value of 3.

The sizes can be changed to different sizes, such as {3,2,1}. This particular set of group sizes would cause a number 1234567890 to be formatted as 1,2,3,4,5,67,890. Once the last group size has been reached, it is repeatedly used in grouping the remaining digits.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PercentGroupSizes (let)

PercentGroupSizes

Sets the group sizes for percent formatted numbers.

 Public Property Let PercentGroupSizes(
      ByRef Value ( ) As Long )

Parameters

Value
[ByRef] Long. A vbLong array containing the grouping sizes.

Remarks

A group size is the number of digits that are to be groupsed together before being separated by the group separator symbol. Generally the group sizes is an array of one element having a value of 3.

The sizes can be changed to different sizes, such as {3,2,1}. This particular set of group sizes would cause a number 1234567890 to be formatted as 1,2,3,4,5,67,890. Once the last group size has been reached, it is repeatedly used in grouping the remaining digits.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PercentNegativePattern (get)

PercentNegativePattern

Returns the selected negative pattern used in percent number formatting.

 Public Property Get PercentNegativePattern ( ) As PercentNegativePatterns

Return Values

PercentNegativePatterns - Then negative number pattern to be used in formating negative numbers.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PercentNegativePattern (let)

PercentNegativePattern

Sets the negative pattern to be used in formatting negative percent numbers.

 Public Property Let PercentNegativePattern(
      ByVal Value As PercentNegativePatterns )

Parameters

Value
[ByVal] PercentNegativePatterns. The pattern to be used.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PercentNegativePatterns

PercentNegativePatterns

Output patterns for negative percentage values. The - is the negative symbol, # is the number and the % is the percentage symbol.

 Public Enum PercentNegativePatterns

Values

[-n %] = 0
[-n%] = 1
[-%n] = 2
[%-n] = 3
[%n-] = 4
[n-%] = 5
[n%-] = 6
[-% n] = 7
[n %-] = 8
[% n-] = 9
[% -n] = 10
[n- %] = 11

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PercentPositivePattern (get)

PercentPositivePattern

Returns the pattern to be used in formatting positive percent numbers.

 Public Property Get PercentPositivePattern ( ) As PercentPositivePatterns

Return Values

PercentPositivePatterns - The pattern used in formatting positive percent numbers.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PercentPositivePattern (let)

PercentPositivePattern

Sets the pattern to be used in formatting positive percent numbers.

 Public Property Let PercentPositivePattern(
      ByVal Value As PercentPositivePatterns )

Parameters

Value
[ByVal] PercentPositivePatterns. The pattern to be used.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PercentPositivePatterns

PercentPositivePatterns

Output patterns for positive percentage values. The # is the number and the % is the percentage symbol.

 Public Enum PercentPositivePatterns

Values

[n %] = 0
[n%] = 1
[%n] = 2
[% n] = 3

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PercentSymbol (get)

PercentSymbol

Returns the percent symbol used in percent formatted numbers.

 Public Property Get PercentSymbol ( ) As String

Return Values

String - The percent symbole, usually %'.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PercentSymbol (let)

PercentSymbol

Set the percent symbol used in percent formatted numbers.

 Public Property Let PercentSymbol(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The symbol to be used in percent formatted numbers.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PerMilleSymbol (get)

PerMilleSymbol

Returns the permille representation.

 Public Property Get PerMilleSymbol ( ) As String

Return Values

String - Permille string representation.

Remarks

From MathWorld
The use of permille (a.k.a. parts per thousand) is a way of expressing ratios in terms of whole numbers. Given a ratio or fraction, it is converted to a permil-age by multiplying by 1000 and appending a "‰" (Unicode &H2030). For example, if an investment grows from a number P=13.00 to a number A=22.50, then A is 22.50/13.00=1.7308 times as much as P, or 1730.8‰.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PerMilleSymbol (let)

PerMilleSymbol

Sets the permille representation.

 Public Property Let PerMilleSymbol(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new permille string representation.

Remarks

From From MathWorld
The use of permille (a.k.a. parts per thousand) is a way of expressing ratios in terms of whole numbers. Given a ratio or fraction, it is converted to a permil-age by multiplying by 1000 and appending a "‰" (Unicode &H2030). For example, if an investment grows from a number P=13.00 to a number A=22.50, then A is 22.50/13.00=1.7308 times as much as P, or 1730.8‰.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PositiveInfinitySymbol (get)

PositiveInfinitySymbol

Returns a string representation of positive infinity.

 Public Property Get PositiveInfinitySymbol ( ) As String

Return Values

String - Positive infinity string.

Remarks

Positive infinity is achieved by dividing a positive number by zero. The default is "Infinity".

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PositiveInfinitySymbol (let)

PositiveInfinitySymbol

Sets the positive infinity representation.

 Public Property Let PositiveInfinitySymbol(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new string representation of positive infinity.

Remarks

Positive infinity is achieved by dividing a positive number by zero. The default is "Infinity".

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PositiveSign (get)

PositiveSign

Returns the current positive symbol.

 Public Property Get PositiveSign ( ) As String

Return Values

String - The current positive symbol.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: PositiveSign (let)

PositiveSign

Sets the positive symbol.

 Public Property Let PositiveSign(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new positive symbol.

Read/Write.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfo: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class NumberFormatInfo Overview


NumberFormatInfoStatic

NumberFormatInfoStatic

Provides methods to retrieve the various types of NumberFormatInfo objects.

Public:

Types:

Name | Description
NumberStyles | Determines the styles permitted in numeric string arguments that are passed to the Parse and TryParse methods of the integral and floating-point numeric types.

Properties:

Name | Description
CurrentInfo (get) | Returns the NumberFormatInfo object of the threads current culture.
InvariantInfo (get) | Returns the NumberFormatInfo object of the variant culture type. This is the same no matter what culture is current.

Methods:

Name | Description
GetInstance | Returns the NumberFormatInfo object from a specific provider.
ReadOnly | Returns a read-only version of the NumberFormatInfo object.

Remarks

This class cannot be directly instantiated. To access these methods use the variable name directly.

 Dim Info As NumberFormatInfo
 Set Info = NumberFormatInfo.CurrentInfo

See Also

Project CorLib Overview

Class NumberFormatInfoStatic Overview

NumberFormatInfo


NumberFormatInfoStatic: CurrentInfo (get)

CurrentInfo

Returns the NumberFormatInfo object of the threads current culture.

 Public Property Get CurrentInfo ( ) As NumberFormatInfo

Return Values

NumberFormatInfo -

Read Only.

See Also

Project CorLib Overview

Class NumberFormatInfoStatic Overview


NumberFormatInfoStatic: GetInstance

GetInstance

Returns the NumberFormatInfo object from a specific provider.

 Public Function GetInstance(
      ByVal FormatProvider As IFormatProvider ) As NumberFormatInfo

Parameters

FormatProvider
[ByVal] IFormatProvider. The provider of the NumberFormatInfo object.

Return Values

NumberFormatInfo - A NumberFormatInfo object from the provider.

Remarks

If the provider does not provide a NumberFormatInfo object, then the NumberFormatInfo object for the current culture is returned.

See Also

Project CorLib Overview

Class NumberFormatInfoStatic Overview


NumberFormatInfoStatic: InvariantInfo (get)

InvariantInfo

Returns the NumberFormatInfo object of the variant culture type. This is the same no matter what culture is current.

 Public Property Get InvariantInfo ( ) As NumberFormatInfo

Return Values

NumberFormatInfo -

Read Only.

See Also

Project CorLib Overview

Class NumberFormatInfoStatic Overview


NumberFormatInfoStatic: NumberStyles

NumberStyles

Determines the styles permitted in numeric string arguments that are passed to the Parse and TryParse methods of the integral and floating-point numeric types.

 Public Enum NumberStyles

Values

None = 0
Indicates that no style elements, such as leading or trailing white space, thousands separators, or a decimal separator, can be present in the parsed string. The string to be parsed must consist of integral decimal digits only.
AllowLeadingWhite = 1
Indicates that leading white-space characters can be present in the parsed string. Valid white-space characters have the Unicode values U+0009, U+000A, U+000B, U+000C, U+000D, and U+0020. Note that this is a subset of the characters for which the Char.IsWhiteSpace method returns true.
AllowTrailingWhite = 2
Indicates that trailing white-space characters can be present in the parsed string. Valid white-space characters have the Unicode values U+0009, U+000A, U+000B, U+000C, U+000D, and U+0020. Note that this is a subset of the characters for which the Char.IsWhiteSpace method returns true.
AllowLeadingSign = 4
Indicates that the numeric string can have a leading sign. Valid leading sign characters are determined by the NumberFormatInfo.PositiveSign and NumberFormatInfo.NegativeSign properties.
[Integer] = 7
Indicates that the AllowLeadingWhite, AllowTrailingWhite, and AllowLeadingSign styles are used. This is a composite number style.
AllowTrailingSign = 8
Indicates that the numeric string can have a trailing sign. Valid trailing sign characters are determined by the NumberFormatInfo.PositiveSign and NumberFormatInfo.NegativeSign properties.
AllowParentheses = 16
Indicates that the numeric string can have one pair of parentheses enclosing the number. The parentheses indicate that the string to be parsed represents a negative number.
AllowDecimalPoint = 32
Indicates that the numeric string can have a decimal point. If the NumberStyles value includes the AllowCurrencySymbol flag and the parsed string includes a currency symbol, the decimal separator character is determined by the NumberFormatInfo.CurrencyDecimalSeparator property. Otherwise, the decimal separator character is determined by the NumberFormatInfo.NumberDecimalSeparator property.
AllowThousands = 64
Indicates that the numeric string can have group separators, such as symbols that separate hundreds from thousands. If the NumberStyles value includes the AllowCurrencySymbol flag and the string to be parsed includes a currency symbol, the valid group separator character is determined by the NumberFormatInfo.CurrencyGroupSeparator property, and the number of digits in each group is determined by the NumberFormatInfo.CurrencyGroupSizes property. Otherwise, the valid group separator character is determined by the NumberFormatInfo.NumberGroupSeparator property, and the number of digits in each group is determined by the NumberFormatInfo.NumberGroupSizes property.
Number = 111
Indicates that the AllowLeadingWhite, AllowTrailingWhite, AllowLeadingSign, AllowTrailingSign, AllowDecimalPoint, and AllowThousands styles are used. This is a composite number style.
AllowExponent = 128
Indicates that the numeric string can be in exponential notation. The AllowExponent flag allows the parsed string to contain an exponent that begins with the "E" or "e" character and that is followed by an optional positive or negative sign and an integer. In other words, it successfully parses strings in the form nnnExx, nnnE+xx, and nnnE-xx. It does not allow a decimal separator or sign in the significand or mantissa; to allow these elements in the string to be parsed, use the AllowDecimalPoint and AllowLeadingSign flags, or use a composite style that includes these individual flags.
Float = 167
Indicates that the AllowLeadingWhite, AllowTrailingWhite, AllowLeadingSign, AllowDecimalPoint, and AllowExponent styles are used. This is a composite number style.
AllowCurrencySymbol = 256
Indicates that the numeric string can contain a currency symbol. Valid currency symbols are determined by the NumberFormatInfo.CurrencySymbol property.
[Currency] = 383
Indicates that all styles except AllowExponent and AllowHexSpecifier are used. This is a composite number style.
[Any] = 511
Indicates that all styles except AllowHexSpecifier are used. This is a composite number style.
AllowHexSpecifier = 512
Indicates that the numeric string represents a hexadecimal value. Valid hexadecimal values include the numeric digits 0-9 and the hexadecimal digits A-F and a-f. Strings that are parsed using this style cannot be prefixed with "0x" or "&h". A string that is parsed with the AllowHexSpecifier style will always be interpreted as a hexadecimal value. The only flags that can be combined with AllowHexSpecifier are AllowLeadingWhite and AllowTrailingWhite. The NumberStyles enumeration includes a composite style, HexNumber, that consists of these three flags.
HexNumber = 515
Indicates that the AllowLeadingWhite, AllowTrailingWhite, and AllowHexSpecifier styles are used. This is a composite number style.

See Also

Project CorLib Overview

Class NumberFormatInfoStatic Overview


NumberFormatInfoStatic: ReadOnly

ReadOnly

Returns a read-only version of the NumberFormatInfo object.

 Public Function ReadOnly(
      ByVal Info As NumberFormatInfo ) As NumberFormatInfo

Parameters

Info
[ByVal] NumberFormatInfo. The NumberFormatInfo object to create a read-only version of.

Return Values

NumberFormatInfo - A read-only version of the NumberFormatInfo object.

See Also

Project CorLib Overview

Class NumberFormatInfoStatic Overview


ObjectBase

ObjectBase

This class represent a proxy as a base class for those classes that implement IObject. It is intended to give default behavior for the three main methods of the Object class in .NET. The base class is accessed using the MyBase global static property.

This class is not intended to be used by code other than in the methods of the IObject interface implementations.

Public:

Methods:

Name | Description
Equals | Default object comparison. Simply checks for reference to same instance.
GetHashCode | Returns a hashcode for the specified object instance.
ToString | Returns a string representation of the object instance with optional project name.

Remarks

The implementer of the IObject interface can use this method as the default behavior, or create custom behavior using their own logic.

Examples

This example shows the typical implementation of the IObject interface using the MyBase methods for default behavior.

Option Explicit
Implements IObject

Public Function Equals(ByRef Value As Variant) As Boolean
    Equals = MyBase.Equals(Me, Value)
End Function

Public Function GetHashCode() As Long
    GetHashCode = MyBase.GetHashCode(Me)
End Function

Public Function ToString() As String
    ToString = MyBase.ToString(Me, App)
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IObject
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IObject_Equals(Value As Variant) As Boolean
    IObject_Equals = Equals(Value)
End Function

Private Function IObject_GetHashCode() As Long
    IObject_GetHashCode = GetHashCode
End Function

Private Function IObject_ToString() As String
    IObject_ToString = ToString
End Function

See Also

Project CorLib Overview

Class ObjectBase Overview


ObjectBase: Equals

Equals

Default object comparison. Simply checks for reference to same instance.

 Public Function Equals(
      ByVal ObjA As IObject,
      ByRef ObjB As Variant ) As Boolean

Parameters

ObjA
[ByVal] IObject. The subclass requesting the call.
ObjB
[ByRef] Variant. The value to be equating the subclass to.

Return Values

Boolean - True if both values point to the same object instance; False otherwise.

Remarks

The implementer of the IObject interface can use this method as the default behavior, or create custom behavior using their own logic.

Examples

This example shows the typical implementation of the IObject interface using the MyBase methods for default behavior.

Option Explicit
Implements IObject

Public Function Equals(ByRef Value As Variant) As Boolean
    Equals = MyBase.Equals(Me, Value)
End Function

Public Function GetHashCode() As Long
    GetHashCode = MyBase.GetHashCode(Me)
End Function

Public Function ToString() As String
    ToString = MyBase.ToString(Me, App)
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IObject
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IObject_Equals(Value As Variant) As Boolean
    IObject_Equals = Equals(Value)
End Function

Private Function IObject_GetHashCode() As Long
    IObject_GetHashCode = GetHashCode
End Function

Private Function IObject_ToString() As String
    IObject_ToString = ToString
End Function

See Also

Project CorLib Overview

Class ObjectBase Overview


ObjectBase: GetHashCode

GetHashCode

Returns a hashcode for the specified object instance.

 Public Function GetHashCode(
      ByVal Obj As IObject ) As Long

Parameters

Obj
[ByVal] IObject. The object to generate the hashcode for.

Return Values

Long - Returns a Long as the representation of the hashcode.

Remarks

The implementer of the IObject interface can use this method as the default behavior, or create custom behavior using their own logic.

Examples

This example shows the typical implementation of the IObject interface using the MyBase methods for default behavior.

Option Explicit
Implements IObject

Public Function Equals(ByRef Value As Variant) As Boolean
    Equals = MyBase.Equals(Me, Value)
End Function

Public Function GetHashCode() As Long
    GetHashCode = MyBase.GetHashCode(Me)
End Function

Public Function ToString() As String
    ToString = MyBase.ToString(Me, App)
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IObject
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IObject_Equals(Value As Variant) As Boolean
    IObject_Equals = Equals(Value)
End Function

Private Function IObject_GetHashCode() As Long
    IObject_GetHashCode = GetHashCode
End Function

Private Function IObject_ToString() As String
    IObject_ToString = ToString
End Function

See Also

Project CorLib Overview

Class ObjectBase Overview


ObjectBase: ToString

ToString

Returns a string representation of the object instance with optional project name.

 Public Function ToString(
      ByVal Obj As IObject,
      Optional ByVal AppObject As Object ) As String

Parameters

Obj
[ByVal] IObject. The object to return a string representation of.
AppObject
[ByVal] Optional. Object. The classes App object used to determine the project name.

Return Values

String - Returns a combination of the object type name and project name.

Remarks

The implementer of the IObject interface can use this method as the default behavior, or create custom behavior using their own logic.

Examples

This example shows the typical implementation of the IObject interface using the MyBase methods for default behavior.

Option Explicit
Implements IObject

Public Function Equals(ByRef Value As Variant) As Boolean
    Equals = MyBase.Equals(Me, Value)
End Function

Public Function GetHashCode() As Long
    GetHashCode = MyBase.GetHashCode(Me)
End Function

Public Function ToString() As String
    ToString = MyBase.ToString(Me, App)
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IObject
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IObject_Equals(Value As Variant) As Boolean
    IObject_Equals = Equals(Value)
End Function

Private Function IObject_GetHashCode() As Long
    IObject_GetHashCode = GetHashCode
End Function

Private Function IObject_ToString() As String
    IObject_ToString = ToString
End Function

See Also

Project CorLib Overview

Class ObjectBase Overview


ObjectDisposedException

ObjectDisposedException

This exception is thrown when an operation is attempted on a disposed object.

Implements:

Exception
InvalidOperationException
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
ObjectName (get) | Gets the name of the object that has been disposed of, or an empty string if no object name was passed into the constructor.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

See Also

Project CorLib Overview

Class ObjectDisposedException Overview

Constructors

ExceptionMethods

Exception


ObjectDisposedException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class ObjectDisposedException Overview


ObjectDisposedException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class ObjectDisposedException Overview


ObjectDisposedException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class ObjectDisposedException Overview


ObjectDisposedException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class ObjectDisposedException Overview


ObjectDisposedException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class ObjectDisposedException Overview


ObjectDisposedException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class ObjectDisposedException Overview


ObjectDisposedException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class ObjectDisposedException Overview


ObjectDisposedException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class ObjectDisposedException Overview


ObjectDisposedException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class ObjectDisposedException Overview

Exception


ObjectDisposedException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class ObjectDisposedException Overview


ObjectDisposedException: InvalidOperationException

InvalidOperationException

 Implements InvalidOperationException

Return Values

InvalidOperationException -

See Also

Project CorLib Overview

Class ObjectDisposedException Overview


ObjectDisposedException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class ObjectDisposedException Overview


ObjectDisposedException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewSystemException.

Read Only.

See Also

Project CorLib Overview

Class ObjectDisposedException Overview


ObjectDisposedException: ObjectName (get)

ObjectName

Gets the name of the object that has been disposed of, or an empty string if no object name was passed into the constructor.

 Public Property Get ObjectName ( ) As String

Return Values

String - Returns a string representation of the object that has been disposed.

Read Only.

See Also

Project CorLib Overview

Class ObjectDisposedException Overview

Constructors


ObjectDisposedException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class ObjectDisposedException Overview


ObjectDisposedException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class ObjectDisposedException Overview


ObjectDisposedException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class ObjectDisposedException Overview


ObjectDisposedException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class ObjectDisposedException Overview


ObjectStatic

ObjectStatic

Provides default implementations of the IObject interface.

Public:

Methods:

Name | Description
Equals | Checks the equality of the two values.
GetHashCode | Generates a hashcode for a specified value.
ToString | Returns a default string representation of an object.

See Also

Project CorLib Overview

Class ObjectStatic Overview


ObjectStatic: Equals

Equals

Checks the equality of the two values.

 Public Function Equals(
      ByRef ObjA As Variant,
      ByRef ObjB As Variant ) As Boolean

Parameters

ObjA
[ByRef] Variant. The first value to compare with.
ObjB
[ByRef] Variant. The second value to compare.

Return Values

Boolean - True if the value and the object are the same instance; False otherwise.

Remarks

The two values must be of the same type to successfully be compared. For example a vbLong value of 1 will not be considered equal to a vbInteger value of 1.

If objects are passed in, an attempt to access the IObject interface is made to allow objects perform their own equality check. If the object does not implement the IObject interface, object references are compared.

Examples

This example compare various values using the Equals method.

Public Sub Main()
    Dim List1 As ArrayList
    Dim List2 As ArrayList

    ' Show how numeric values compare differently.
    PrintEquality 1, 1
    PrintEquality CLng(1), CInt(1)
    PrintEquality "1", 1

    ' Set lists to two different instances.
    Set List1 = New ArrayList
    Set List2 = New ArrayList

    PrintEquality List1, List2

    ' Set lists to same instance.
    Set List2 = List1

    PrintEquality List1, List2
    PrintEquality Nothing, Nothing
End Sub

Private Sub PrintEquality(ByRef a As Variant, ByRef b As Variant)
    Dim Relationship As String

    Relationship = IIf(Object.Equals(a, b), "=", "<>")

    Debug.Print CorString.Format("{0} '{1}' {2} {3} '{4}'", TypeName(a), a, Relationship, TypeName(b), b)
End Sub

' This example code produces the following output.
'
'    Integer '1' = Integer '1'
'    Long '1' <> Integer '1'
'    String '1' <> Integer '1'
'    ArrayList 'CorLib.ArrayList' <> ArrayList 'CorLib.ArrayList'
'    ArrayList 'CorLib.ArrayList' = ArrayList 'CorLib.ArrayList'
'    Nothing '' = Nothing ''

See Also

Project CorLib Overview

Class ObjectStatic Overview


ObjectStatic: GetHashCode

GetHashCode

Generates a hashcode for a specified value.

 Public Function GetHashCode(
      ByRef Value As Variant ) As Long

Parameters

Value
[ByRef] Variant. The value to generate the hashcode for.

Return Values

Long - A 32-bit integer hashcode value.

Remarks

A hash code is a numeric value that is used to identify an object during equality testing. It can also serve as an index for an object in a collection.

The GetHashCode method is suitable for use in hashing algorithms and data structures such as a hash table.

The default implementation of the GetHashCode method does not guarantee unique return values for different values. Furthermore, VBCorLib does not guarantee the default implementation of the GetHashCode method, and the value it returns will be the same between different versions of VBCorLib. Consequently, the default implementation of this method must not be used as a unique object identifier for hashing purposes.

See Also

Project CorLib Overview

Class ObjectStatic Overview


ObjectStatic: ToString

ToString

Returns a default string representation of an object.

 Public Function ToString(
      ByRef Value As Variant,
      Optional ByRef Format As String,
      Optional ByVal Provider As IFormatProvider ) As String

Parameters

Value
[ByRef] Variant. The value to create a string representation of.
Format
[ByRef] Optional. String. Will be applied if the value implements IFormattable.
Provider
[ByVal] Optional. IFormatProvider. Will be applied if the value implements IFormattable.

Return Values

String - A string representation of the value.

Examples

The following example uses ToString to display numeric values formatting.

Public Sub Main()
    Debug.Print "Print values with default formatting."
    Debug.Print Object.ToString(CorDateTime.Now)
    Debug.Print Object.ToString(1234)
    Debug.Print Object.ToString(1234.3254)

    Debug.Print t("\nPrint values with formatting.")
    Debug.Print Object.ToString(1234, "g2")
    Debug.Print Object.ToString(1234, "f2")
    Debug.Print Object.ToString(1234, "n2")
    Debug.Print Object.ToString(1234.3254, "n2")
    Debug.Print Object.ToString(1234, "c2")
    Debug.Print Object.ToString(1234.3254, "c2")

    Dim Provider As New NumberFormatInfo
    Provider.CurrencySymbol = "!"

    Debug.Print t("\nPrint values with custom provider.")
    Debug.Print Object.ToString(1234, "c2", Provider)
    Debug.Print Object.ToString(1234.3254, "c2", Provider)

    Dim FrProvider As IFormatProvider
    Set FrProvider = NewCultureInfo("FR-fr")

    Debug.Print t("\nPrint values with French provider.")
    Debug.Print Object.ToString(CorDateTime.Now, Provider:=FrProvider)
    Debug.Print Object.ToString(1234, "c2", FrProvider)
    Debug.Print Object.ToString(1234.3254, "c2", FrProvider)
End Sub

' This example code produces the following output.
'
'    Print values with default formatting.
'    4/21/2020 9:02:45 AM
'    1234
'    1234.3254
'
'    Print values with formatting.
'    1.2e+03
'    1234.00
'    1,234.00
'    1,234.33
'    $1,234.00
'    $1,234.33
'
'    Print values with custom provider.
'    !1,234.00
'    !1,234.33
'
'    Print values with French provider.
'    21/04/2020 09:02:45
'    1 234,00 €
'    1 234,33 €

See Also

Project CorLib Overview

Class ObjectStatic Overview

IFormattable

IFormatProvider


OperatingSystem

OperatingSystem

Provides information about the currently running operating system.

Implements:

ICloneable
IObject

Public:

Types:

Name | Description
PlatformID | The identification for the specific Windows platforms.

Properties:

Name | Description
Platform (get) | Returns the operating system type currently running on this machine.
ServicePack (get) | Returns the service pack for the current operating system.
Version (get) | Returns the version of the current operating system.
VersionString (get) | Gets the concatenated string representation of the platform identifier, version, and service pack that are currently installed on the operating system.

Methods:

Name | Description
Clone | Returns a clone of the OperatingSystem object.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
ToString | Returns a string representation of the current operating system.

See Also

Project CorLib Overview

Class OperatingSystem Overview

Constructors

ICloneable


OperatingSystem: Clone

Clone

Returns a clone of the OperatingSystem object.

 Public Function Clone ( ) As OperatingSystem

Return Values

OperatingSystem - The clone of the OperatingSystem object.

See Also

Project CorLib Overview

Class OperatingSystem Overview


OperatingSystem: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class OperatingSystem Overview


OperatingSystem: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class OperatingSystem Overview


OperatingSystem: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class OperatingSystem Overview


OperatingSystem: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class OperatingSystem Overview


OperatingSystem: Platform (get)

Platform

Returns the operating system type currently running on this machine.

 Public Property Get Platform ( ) As PlatformID

Return Values

PlatformID - The current operating system running.

Read Only.

See Also

Project CorLib Overview

Class OperatingSystem Overview


OperatingSystem: PlatformID

PlatformID

The identification for the specific Windows platforms.

 Public Enum PlatformID

Values

Win32S
Identification for legacy Windows systems that are 16bit, but allowed to access 32bit functionality.
Win32Windows
Identification for Windows 95, 98, ME platforms.
Win32NT
Identification for Windows NT4.0, 2000, XP, Server 2003, and future NT platforms.
WinCE
Identification for Windows CE which runs on handheld PDAs.

See Also

Project CorLib Overview

Class OperatingSystem Overview


OperatingSystem: ServicePack (get)

ServicePack

Returns the service pack for the current operating system.

 Public Property Get ServicePack ( ) As String

Return Values

String -

Remarks

An empty string is always returned on Windows 95, 98, and ME.

Read Only.

See Also

Project CorLib Overview

Class OperatingSystem Overview


OperatingSystem: ToString

ToString

Returns a string representation of the current operating system.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class OperatingSystem Overview


OperatingSystem: Version (get)

Version

Returns the version of the current operating system.

 Public Property Get Version ( ) As Version

Return Values

Version - The operating system version.

Read Only.

See Also

Project CorLib Overview

Class OperatingSystem Overview


OperatingSystem: VersionString (get)

VersionString

Gets the concatenated string representation of the platform identifier, version, and service pack that are currently installed on the operating system.

 Public Property Get VersionString ( ) As String

Return Values

String - The string representation of the values returned by the Platform, Version, and ServicePack properties.

Read Only.

See Also

Project CorLib Overview

Class OperatingSystem Overview


OutOfMemoryException

OutOfMemoryException

This the exception thrown when a memory error occurs.

Implements:

Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

See Also

Project CorLib Overview

Class OutOfMemoryException Overview

Constructors

ExceptionMethods

Exception


OutOfMemoryException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class OutOfMemoryException Overview


OutOfMemoryException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class OutOfMemoryException Overview


OutOfMemoryException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class OutOfMemoryException Overview


OutOfMemoryException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class OutOfMemoryException Overview


OutOfMemoryException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class OutOfMemoryException Overview


OutOfMemoryException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class OutOfMemoryException Overview


OutOfMemoryException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class OutOfMemoryException Overview


OutOfMemoryException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class OutOfMemoryException Overview


OutOfMemoryException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class OutOfMemoryException Overview

Exception


OutOfMemoryException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class OutOfMemoryException Overview


OutOfMemoryException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class OutOfMemoryException Overview


OutOfMemoryException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewSystemException.

Read Only.

See Also

Project CorLib Overview

Class OutOfMemoryException Overview


OutOfMemoryException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class OutOfMemoryException Overview


OutOfMemoryException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class OutOfMemoryException Overview


OutOfMemoryException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class OutOfMemoryException Overview


OutOfMemoryException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class OutOfMemoryException Overview


OverflowException

OverflowException

This exception is thrown when a mathimatical operation causes a value outside the valid range of values for the destination object.

Implements:

ArithmeticException
Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

See Also

Project CorLib Overview

Class OverflowException Overview

Constructors

ExceptionMethods

Exception


OverflowException: ArithmeticException

ArithmeticException

 Implements ArithmeticException

Return Values

ArithmeticException -

See Also

Project CorLib Overview

Class OverflowException Overview


OverflowException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class OverflowException Overview


OverflowException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class OverflowException Overview


OverflowException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class OverflowException Overview


OverflowException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class OverflowException Overview


OverflowException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class OverflowException Overview


OverflowException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class OverflowException Overview


OverflowException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class OverflowException Overview


OverflowException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class OverflowException Overview


OverflowException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class OverflowException Overview

Exception


OverflowException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class OverflowException Overview


OverflowException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class OverflowException Overview


OverflowException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewSystemException.

Read Only.

See Also

Project CorLib Overview

Class OverflowException Overview


OverflowException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class OverflowException Overview


OverflowException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class OverflowException Overview


OverflowException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class OverflowException Overview


OverflowException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class OverflowException Overview


Path

Path

Performs operations on String instances that contain file or directory path information.

Public:

Properties:

Name | Description
AltDirectorySeparator (get) | Returns the string for the alternative directory separator character.
AltDirectorySeparatorChar (get) | Returns the character code for the alternative directory separator character.
DirectorySeparator (get) | Returns the directory separator string for Windows.
DirectorySeparatorChar (get) | Returns the directory separator character for Windows.
PathSeparator (get) | The string used to seperate strings in an environment variable.
PathSeparatorChar (get) | The character code used to separate strings in an environment variable.
VolumeSeparator (get) | Returns the string version of the volume separator.
VolumeSeparatorChar (get) | The character code used to separate volume labels from path information.

Methods:

Name | Description
ChangeExtension | Changes the extension of a path string.
Combine | Combines two or more strings into a path.
CombineArray | Combines an array of strings into a path.
GetDirectoryName | Returns the directory information for the specified path string.
GetExtension | Returns the extension of the specified path string.
GetFileName | Returns the file name and extension of the specified path string.
GetFileNameWithoutExtension | Returns the filename portion of a path without the filename extension.
GetFullPath | Returns the absolute path for the specified path string.
GetInvalidFileNameChars | Gets an array containing the characters that are not allowed in file names.
GetInvalidPathChars | Gets an array containing the characters that are not allowed in path names.
GetPathRoot | Returns the root directory information of the specified path.
GetTempFileName | Creates a uniquely named, zero-byte temporary file on disk and returns the full path of that file.
GetTempPath | Returns the path to the temporary folder for the current user.
HasExtension | Determines whether a path includes a file name extension.
IsPathRooted | Gets a value indicating whether the specified path string contains a root.

Remarks

A path can contain absolute or relative location information. Absolute paths fully specify a location: the file or directory can be uniquely identified regardless of the current location. Relative paths specify a partial location: the current location is used as the starting point when locating a file specified with a relative path. To determine the current directory, call Directory.GetCurrentDirectory.

Most members of the Path class do not interact with the file system and do not verify the existence of the file specified by a path string. Path class members that modify a path string, such as ChangeExtension, have no effect on names of files in the file system. Path members do, however, validate the contents of a specified path string, and throw an ArgumentException if the string contains characters that are not valid in path strings, as defined in InvalidPathChars.

The members of the Path class enable you to quickly and easily perform common operations such as determining whether a file name extension is part of a path, and combining two strings into one path name.

Note
In members that accept a path as an input string, that path must be well-formed or an exception is raised. For example, if a path is fully qualified but begins with a space, the path is not trimmed in methods of the class. Therefore, the path is malformed and an exception is raised. Similarly, a path or a combination of paths cannot be fully qualified twice. For example, "c:\temp c:\windows" also raises an exception in most cases. Ensure that your paths are well-formed when using methods that accept a path string.

In members that accept a path, the path can refer to a file or just a directory. The specified path can also refer to a relative path or a Universal Naming Convention (UNC) path for a server and share name. For example, all the following are acceptable paths:

  • "c:\MyDir\MyFile.txt"
  • "c:\MyDir"
  • "MyDir\MySubDir"
  • "\\MyServer\MyShare"

Because all these operations are performed on strings, it is impossible to verify that the results are valid in all scenarios. For example, the GetExtension method parses a string that you pass to it and returns the extension from that string. However, this does not mean that a file with that extension exists on the disk.

Examples

The following code example demonstrates some of the main members of the Path class.

Public Sub Main()
    Const Path1 As String = "c:\temp\MyTest.txt"
    Const Path2 As String = "c:\temp\MyTest"
    Const Path3 As String = "temp"

    If Path.HasExtension(Path1) Then
        Debug.Print CorString.Format("{0} has an extension.", Path1)
    End If

    If Not Path.HasExtension(Path2) Then
        Debug.Print CorString.Format("{0} has no extension.", Path2)
    End If

    If Not Path.IsPathRooted(Path3) Then
        Debug.Print CorString.Format("The string {0} contains no root information.", Path3)
    End If

    Debug.Print CorString.Format("The full path of {0} is {1}.", Path3, Path.GetFullPath(Path3))
    Debug.Print CorString.Format("{0} is the location of temporary files.", Path.GetTempPath)
    Debug.Print CorString.Format("{0} is a file available for use.", Path.GetTempFileName)
End Sub

' This example code produces output similar to the following.
'
'    c:\temp\MyTest.txt has an extension.
'    c:\temp\MyTest has no extension.
'    The string temp contains no root information.
'    The full path of temp is C:\Program Files (x86)\Microsoft Visual Studio\VB98\temp.
'    C:\Users\kelly\AppData\Local\Temp\ is the location of temporary files.
'    C:\Users\kelly\AppData\Local\Temp\tmp6B81.tmp is a file available for use.

See Also

Project CorLib Overview

Class Path Overview


Path: AltDirectorySeparator (get)

AltDirectorySeparator

Returns the string for the alternative directory separator character.

 Public Property Get AltDirectorySeparator ( ) As String

Return Values

String - The string of the alternative directory separator "/".

Remarks

The alternate string is usually found on systems such as Unix.

Read Only.

See Also

Project CorLib Overview

Class Path Overview

AltDirectorySeparatorChar

DirectorySeparator

DirectorySeparatorChar

PathSeparator

PathSeparatorChar

VolumeSeparator

VolumeSeparatorChar


Path: AltDirectorySeparatorChar (get)

AltDirectorySeparatorChar

Returns the character code for the alternative directory separator character.

 Public Property Get AltDirectorySeparatorChar ( ) As Integer

Return Values

Integer - The character code of the alternative directory separator (47).

Remarks

The alternate character is usually found on systems such as Unix.

Read Only.

See Also

Project CorLib Overview

Class Path Overview

AltDirectorySeparator

DirectorySeparator

DirectorySeparatorChar

PathSeparator

PathSeparatorChar

VolumeSeparator

VolumeSeparatorChar


Path: ChangeExtension

ChangeExtension

Changes the extension of a path string.

 Public Function ChangeExtension(
      ByRef Path As String,
      ByRef Extension As String ) As String

Parameters

Path
[ByRef] String. The path information to modify. The path cannot contain any of the characters defined in GetInvalidPathChars.
Extension
[ByRef] String. The new extension (with or without a leading period). Specify vbNullString to remove an existing extension from Path.

Return Values

String - The modified path information.

If Path has length zero, vbNullString is returned. If Extension is vbNullString, the returned string contains the specified path with its extension removed. If Path has no extension, and Extension is not vbNullString, the returned string contains Extension appended to the end of Path.

Remarks

If neither Path nor Extension contains a period (.), ChangeExtension adds the period.

The Extension parameter can contain multiple periods and any valid path characters, and can be any length. If Extension is vbNullString, the returned string contains the contents of Path with the last period and all characters following it removed.

If Extension is an empty string, the returned path string contains the contents of Path with any characters following the last period removed.

If Path does not have an extension and Extension is not vbNullString, the returned string contains Path followed by Extension.

If Extension is not vbNullString and does not contain a leading period, the period is added.

If Path contains a multiple extension separated by multiple periods, the returned string contains the contents of Path with the last period and all characters following it replaced by Extension. For example, if Path is "\Dir1\examples\pathtests.csx.txt" and Extension is "cs", the modified path is "\Dir1\examples\pathtests.csx.cs".

Exceptions

Exception | Condition
ArgumentException | Path contains one or more of the invalid characters defined in GetInvalidPathChars.

Examples

The following code example demonstrates a use of the ChangeExtension method.

Public Sub Main()
    Const GoodFileName As String = "c:\MyDir\MyFile.Com.Extension"
    Const BadFileName As String = "c:\MyDir\"

    Dim Result As String

    Result = Path.ChangeExtension(GoodFileName, ".old")
    Debug.Print CorString.Format("ChangeExtension({0}, '.old') return '{1}'", GoodFileName, Result)

    Result = Path.ChangeExtension(GoodFileName, "")
    Debug.Print CorString.Format("ChangeExtension({0}, '') return '{1}')", GoodFileName, Result)

    Result = Path.ChangeExtension(BadFileName, ".old")
    Debug.Print CorString.Format("ChangeExtension({0}, '.old') returns '{1}'", BadFileName, Result)
End Sub

' This example code produces the following output.
'
'    ChangeExtension(c:\MyDir\MyFile.Com.Extension, '.old') return 'c:\MyDir\MyFile.Com.old'
'    ChangeExtension(c:\MyDir\MyFile.Com.Extension, '') return 'c:\MyDir\MyFile.Com.')
'    ChangeExtension(c:\MyDir\, '.old') returns 'c:\MyDir\.old'

See Also

Project CorLib Overview

Class Path Overview

GetInvalidPathChars


Path: Combine

Combine

Combines two or more strings into a path.

 Public Function Combine(
      ByRef Path1 As String,
      ByRef Path2 As String,
      ParamArray Paths ( ) As Variant ) As String

Parameters

Path1
[ByRef] String. The first path to combine.
Path2
[ByRef] String. The second path to combine.
Paths
[ByRef] Variant. Zero or more additional paths to be combined.

Return Values

String - The combined paths.

Remarks

Path1 should be an absolute path (for example, "d:\archives" or "\\archives\public"). If Path2 or a string in Paths is also an absolute path, the combine operation discards all previously combined paths and resets to that absolute path.

Zero-length strings are omitted from the combined path.

If Path1 is not a drive reference (that is, "C:" or "D:") and does not end with a valid separator character as defined in DirectorySeparatorChar, AltDirectorySeparatorChar, or VolumeSeparatorChar, DirectorySeparatorChar is appended to Path1 before concatenation.

If Path2 does not include a root (for example, if Path2 does not start with a separator character or a drive specification), the result is a concatenation of the two paths, with an intervening separator character. If Path2 includes a root, Path2 is returned.

The parameters are not parsed if they have white space. Therefore, if Path2 includes white space (for example, " c:\ "), the Combine method appends Path2 to Path1 instead of returning only Path2.

Not all invalid characters for directory and file names are interpreted as unacceptable by the Combine method, because you can use these characters for search wildcard characters. For example, while Path.Combine("c:\", "*.txt") might be invalid if you were to create a file from it, it is valid as a search string. It is therefore successfully interpreted by the Combine method.

Exceptions

Exception | Condition
ArgumentException | Path1, Path2, or a string element in Paths contains one or more of the invalid characters defined in GetInvalidPathChars.

Examples

The following code example demonstrates using the Combine method.

Public Sub Main()
    Const Path1 As String = "c:\Temp"
    Const Path2 As String = "SubDir\File.txt"
    Const Path3 As String = "c:\Temp.txt"
    Const Path4 As String = "c:^*&)(_=#'\^&#2.*(.txt"
    Const Path5 As String = ""
    Const Path6 As String = vbNullString

    CombinePaths Path1, Path2
    CombinePaths Path1, Path3
    CombinePaths Path3, Path2
    CombinePaths Path4, Path2
    CombinePaths Path5, Path2
    CombinePaths Path6, Path2
End Sub

Private Sub CombinePaths(ByVal P1 As String, ByVal P2 As String)
    Dim Combination As String

    Combination = Path.Combine(P1, P2)

    Debug.Print CorString.Format("When you combine '{0}' and '{1}', the result is: {2}'{3}'", P1, P2, vbCrLf, Combination)
    Debug.Print
    Exit Sub
End Sub

' This example code produces the following output.
'
'    When you combine 'c:\Temp' and 'SubDir\File.txt', the result is:
'    'c:\Temp\SubDir\File.txt'
'
'    When you combine 'c:\Temp' and 'c:\Temp.txt', the result is:
'    'c:\Temp.txt'
'
'    When you combine 'c:\Temp.txt' and 'SubDir\File.txt', the result is:
'    'c:\Temp.txt\SubDir\File.txt'
'
'    When you combine 'c:^*&)(_=#'\^&#2.*(.txt' and 'SubDir\File.txt', the result is:
'    'c:^*&)(_=#'\^&#2.*(.txt\SubDir\File.txt'
'
'    When you combine '' and 'SubDir\File.txt', the result is:
'    'SubDir\File.txt'
'
'    When you combine '' and 'SubDir\File.txt', the result is:
'    'SubDir\File.txt'

See Also

Project CorLib Overview

Class Path Overview

CombineArray


Path: CombineArray

CombineArray

Combines an array of strings into a path.

 Public Function CombineArray(
      ByRef Paths ( ) As String ) As String

Parameters

Paths
[ByRef] String. An array of parts of the path.

Return Values

String - The combined paths.

Remarks

Paths should be an array of the parts of the path to combine. If the one of the subsequent paths is an absolute path, then the combine operation resets starting with that absolute path, discarding all previous combined paths.

Zero-length strings are omitted from the combined path.

The parameters are not parsed if they have white space.

Not all invalid characters for directory and file names are interpreted as unacceptable by the Combine method, because you can use these characters for search wildcard characters. For example, while Path.Combine("c:\", "*.txt") might be invalid if you were to create a file from it, it is valid as a search string. It is therefore successfully interpreted by the Combine method.

Exceptions

Exception | Condition
ArgumentException | One of the strings in the array contains one or more of the invalid characters defined in GetInvalidPathChars.

Examples

The following example combines an array of strings into a path.

Public Sub Main()
    Dim Paths() As String
    Dim FullPath As String

    Paths = NewStrings("d:\archives", "2001", "media", "images")
    FullPath = Path.CombineArray(Paths)

    Debug.Print FullPath
End Sub

' This example code produces the following output.
'
'    d:\archives\2001\media\images

See Also

Project CorLib Overview

Class Path Overview

Combine


Path: DirectorySeparator (get)

DirectorySeparator

Returns the directory separator string for Windows.

 Public Property Get DirectorySeparator ( ) As String

Return Values

String - The directory separator string for windows "\".

Read Only.

See Also

Project CorLib Overview

Class Path Overview

DirectorySeparatorChar

AltDirectorySeparator

AltDirectorySeparatorChar

PathSeparator

PathSeparatorChar

VolumeSeparator

VolumeSeparatorChar


Path: DirectorySeparatorChar (get)

DirectorySeparatorChar

Returns the directory separator character for Windows.

 Public Property Get DirectorySeparatorChar ( ) As Integer

Return Values

Integer - The directory separator character for Windows (92).

Read Only.

See Also

Project CorLib Overview

Class Path Overview

DirectorySeparator

AltDirectorySeparator

AltDirectorySeparatorChar

PathSeparator

PathSeparatorChar

VolumeSeparator

VolumeSeparatorChar


Path: GetDirectoryName

GetDirectoryName

Returns the directory information for the specified path string.

 Public Function GetDirectoryName(
      ByRef Path As String ) As String

Parameters

Path
[ByRef] String. The path of a file or directory.

Return Values

String - Directory information for Path, or empty string if Path denotes a root directory. Returns empty string if Path does not contain directory information.

Remarks

In most cases, the string returned by this method consists of all characters in the path up to but not including the last DirectorySeparatorChar or AltDirectorySeparatorChar. If the path consists of a root directory, such as "c:\", empty string is returned. Note that this method does not support paths using "file:". Because the returned path does not include the DirectorySeparatorChar or AltDirectorySeparatorChar, passing the returned path back into the GetDirectoryName method will result in the truncation of one folder level per subsequent call on the result string. For example, passing the path "C:\Directory\SubDirectory\test.txt" into the GetDirectoryName method will return "C:\Directory\SubDirectory". Passing that string, "C:\Directory\SubDirectory", into GetDirectoryName will result in "C:\Directory".
Exception | Condition
ArgumentException | The Path parameter contains invalid characters, is empty, or contains only white spaces.

Examples

The following code example demonstrates using the GetDirectoryName method.

Public Sub Main()
    Dim FilePath As String
    Dim DirectoryName As String
    Dim i As Long

    FilePath = "C:\MyDir\MySubDir\MyFile.txt"

    Do While Len(FilePath) > 0
        DirectoryName = Path.GetDirectoryName(FilePath)
        Debug.Print CorString.Format("GetDirectoryName('{0}') returns '{1}'", FilePath, DirectoryName)
        FilePath = DirectoryName

        If i = 1 Then
            FilePath = DirectoryName & "\" ' this will preserve the previous path
        End If

        i = i + 1
    Loop
End Sub

' This example code produces the following output.
'
'    GetDirectoryName('C:\MyDir\MySubDir\MyFile.txt') returns 'C:\MyDir\MySubDir'
'    GetDirectoryName('C:\MyDir\MySubDir') returns 'C:\MyDir'
'    GetDirectoryName('C:\MyDir\') returns 'C:\MyDir'
'    GetDirectoryName('C:\MyDir') returns 'C:\'
'    GetDirectoryName('C:\') returns ''

See Also

Project CorLib Overview

Class Path Overview


Path: GetExtension

GetExtension

Returns the extension of the specified path string.

 Public Function GetExtension(
      ByRef Path As String ) As String

Parameters

Path
[ByRef] String. The path string from which to get the extension.

Return Values

String - The extension of the specified path (including the period "."), or an empty string. If Path is empty, GetExtension returns an empty string. If Path does not have extension information, GetExtension returns an empty string.

Remarks

The extension of Path is obtained by searching path for a period (.), starting with the last character in Path and continuing toward the start of Path. If a period is found before a DirectorySeparatorChar or AltDirectorySeparatorChar character, the returned string contains the period and the characters after it; otherwise, empty string is returned.

Exceptions

Exception | Condition
ArgumentException | Path contains one or more of the invalid characters defined in GetInvalidPathChars.

Examples

The following code example demonstrates using the GetExtension method.

Public Sub Main()
    Const FileName As String = "C:\MyDir.Old\MyFile.Ext"
    Const PathName As String = "C:\MyDir.Old\"

    Dim Extension As String

    Extension = Path.GetExtension(FileName)
    Debug.Print CorString.Format("GetExtension('{0}') return '{1}'", FileName, Extension)

    Extension = Path.GetExtension(PathName)
    Debug.Print CorString.Format("GetExtension('{0}') return '{1}'", PathName, Extension)
End Sub

' This example code produces the following output.
'
'    GetExtension('C:\MyDir.Old\MyFile.Ext') returns '.Ext'
'    GetExtension('C:\MyDir.Old\') returns ''

See Also

Project CorLib Overview

Class Path Overview


Path: GetFileName

GetFileName

Returns the file name and extension of the specified path string.

 Public Function GetFileName(
      ByRef Path As String ) As String

Parameters

Path
[ByRef] String. The path string from which to obtain the file name and extension.

Return Values

String - The characters after the last directory character in Path. If the last character of Path is a directory or volume separator character, this method returns an empty string. If Path is empty, this method returns an empty string.

Remarks

The returned value is an empty string if the file path is an empty string.

The separator characters used to determine the start of the file name are DirectorySeparatorChar and AltDirectorySeparatorChar.

Exceptions

Exception | Condition
ArgumentException | Path contains one or more of the invalid characters defined in GetInvalidPathChars.

Examples

The following code example demonstrates the behavior of the GetFileName method.

Public Sub Main()
    Const FileName As String = "C:\MyDir\MyFile.Ext"
    Const PathName As String = "C:\MyDir\"

    Dim Result As String

    Result = Path.GetFileName(FileName)
    Debug.Print CorString.Format("GetFileName('{0}') returns '{1}'", FileName, Result)

    Result = Path.GetFileName(PathName)
    Debug.Print CorString.Format("GetFileName('{0}') returns '{1}'", PathName, Result)
End Sub

' This example code produces the following output.
'
'    GetFileName('C:\MyDir\MyFile.Ext') returns 'MyFile.Ext'
'    GetFileName('C:\MyDir\') returns ''

See Also

Project CorLib Overview

Class Path Overview


Path: GetFileNameWithoutExtension

GetFileNameWithoutExtension

Returns the filename portion of a path without the filename extension.

 Public Function GetFileNameWithoutExtension(
      ByRef Path As String ) As String

Parameters

Path
[ByRef] String. The path to parse the filename from.

Return Values

String - A filename without the extension present.

Remarks

This function does not verify that the path or file exists.

Exceptions

Exception | Condition
ArgumentException | Path contains one or more of the invalid characters defined in GetInvalidPathChars.

Examples

The following code example demonstrates a use of the GetFileNameWithoutExtension method.

Public Sub Main()
    Const FileName As String = "C:\MyDir\MyFile.Ext"
    Const PathName As String = "C:\MyDir\"

    Dim Result As String

    Result = Path.GetFileNameWithoutExtension(FileName)
    Debug.Print CorString.Format("GetFileNameWithoutExtension('{0}') returns '{1}'", FileName, Result)

    Result = Path.GetFileNameWithoutExtension(PathName)
    Debug.Print CorString.Format("GetFileNameWithoutExtension('{0}') returns '{1}'", PathName, Result)
End Sub

' This example code produces the following output.
'
'    GetFileNameWithoutExtension('C:\MyDir\MyFile.Ext') returns 'MyFile'
'    GetFileNameWithoutExtension('C:\MyDir\') returns ''

See Also

Project CorLib Overview

Class Path Overview


Path: GetFullPath

GetFullPath

Returns the absolute path for the specified path string.

 Public Function GetFullPath(
      ByRef Path As String ) As String

Parameters

Path
[ByRef] String. The file or directory for which to obtain absolute path information.

Return Values

String - The fully qualified location of path, such as "C:\MyFile.txt".

Remarks

The absolute path includes all information required to locate a file or directory on a system.

The file or directory specified by Path is not required to exist. For example, if c:\temp\newdir is the current directory, calling GetFullPath on a file name such as test.txt returns c:\temp\newdir\test.txt. The file need not exist.

However, if Path does exist, the caller must have permission to obtain path information for path. Note that unlike most members of the Path class, this method accesses the file system.

This method uses current directory and current volume information to fully qualify Path. If you specify a file name only in Path, GetFullPath returns the fully qualified path of the current directory.

If you pass in a short file name, it is expanded to a long file name.

If a path contains no significant characters it is invalid unless it contains one or more "." characters followed by any number of spaces, then it will be parsed as either "." or "..".

Exceptions

Exception | Condition
ArgumentException | Path is a zero-length string, contains only white space, or contains one or more of the invalid characters defined in GetInvalidPathChars. -or- The system could not retrieve the absolute path.
NotSupportedException | Path contains a colon (":") that is not part of a volume identifier (for example, "c:\").

Examples

The following code example demonstrates the GetFullPath method.

Public Sub Main()
    Const FileName As String = "MyFile.Ext"
    Const Path1 As String = "MyDir"
    Const Path2 As String = "\MyDir"

    Dim FullPath As String

    FullPath = Path.GetFullPath(Path1)
    Debug.Print CorString.Format("GetFullPath('{0}') returns '{1}'", Path1, FullPath)

    FullPath = Path.GetFullPath(FileName)
    Debug.Print CorString.Format("GetFullPath('{0}') returns '{1}'", FileName, FullPath)

    FullPath = Path.GetFullPath(Path2)
    Debug.Print CorString.Format("GetFullPath('{0}') returns '{1}'", Path2, FullPath)
End Sub

' Output is based on your current directory, except
' in the last case, where it is based on the root drive.
'
'    GetFullPath('MyDir') returns 'C:\Program Files (x86)\Microsoft Visual Studio\VB98\MyDir'
'    GetFullPath('MyFile.Ext') returns 'C:\Program Files (x86)\Microsoft Visual Studio\VB98\MyFile.Ext'
'    GetFullPath('\MyDir') returns 'C:\MyDir'

See Also

Project CorLib Overview

Class Path Overview


Path: GetInvalidFileNameChars

GetInvalidFileNameChars

Gets an array containing the characters that are not allowed in file names.

 Public Function GetInvalidFileNameChars ( ) As Integer ( )

Return Values

Integer() - An array containing the characters that are not allowed in file names.

Examples

The following code example demonstrates the GetInvalidFileNameChars method and the GetInvalidPathChars method to retrieve invalid characters.

Public Sub Main()
    Dim InvalidPathChars() As Integer
    Dim InvalidFileChars() As Integer

    InvalidPathChars = Path.GetInvalidPathChars

    Debug.Print "The following characters are invalid in a path:"
    ShowChars InvalidPathChars
    Debug.Print

    InvalidFileChars = Path.GetInvalidFileNameChars

    Debug.Print "The following characters are invalid in a filename."
    ShowChars InvalidFileChars
End Sub

Private Sub ShowChars(ByRef Chars() As Integer)
    Dim Ch As Variant

    Debug.Print "Char Hex Value"

    For Each Ch In Chars
        If Char.IsWhiteSpace(Ch) Then
            Debug.Print CorString.Format(",   {0:X4}", Ch)
        Else
            Debug.Print CorString.Format("{0:$},   {0:X4}", Ch)
        End If
    Next
End Sub

' Note: Some characters may not be displayable.
'
' This example code produces the following output.
'
'    The following characters are invalid in a path:
'    Char Hex Value
'    ",   0022
'    <,   003C
'    >,   003E
'    |,   007C
'    ...
'
'    The following characters are invalid in a filename.
'    Char Hex Value
'    ",   0022
'    <,   003C
'    >,   003E
'    |,   007C
'    ...

See Also

Project CorLib Overview

Class Path Overview


Path: GetInvalidPathChars

GetInvalidPathChars

Gets an array containing the characters that are not allowed in path names.

 Public Function GetInvalidPathChars ( ) As Integer ( )

Return Values

Integer() - An array containing the characters that are not allowed in path names.

Examples

The following code example demonstrates the GetInvalidFileNameChars method and the GetInvalidPathChars method to retrieve invalid characters.

Public Sub Main()
    Dim InvalidPathChars() As Integer
    Dim InvalidFileChars() As Integer

    InvalidPathChars = Path.GetInvalidPathChars

    Debug.Print "The following characters are invalid in a path:"
    ShowChars InvalidPathChars
    Debug.Print

    InvalidFileChars = Path.GetInvalidFileNameChars

    Debug.Print "The following characters are invalid in a filename."
    ShowChars InvalidFileChars
End Sub

Private Sub ShowChars(ByRef Chars() As Integer)
    Dim Ch As Variant

    Debug.Print "Char Hex Value"

    For Each Ch In Chars
        If Char.IsWhiteSpace(Ch) Then
            Debug.Print CorString.Format(",   {0:X4}", Ch)
        Else
            Debug.Print CorString.Format("{0:$},   {0:X4}", Ch)
        End If
    Next
End Sub

' Note: Some characters may not be displayable.
'
' This example code produces the following output.
'
'    The following characters are invalid in a path:
'    Char Hex Value
'    ",   0022
'    <,   003C
'    >,   003E
'    |,   007C
'    ...
'
'    The following characters are invalid in a filename.
'    Char Hex Value
'    ",   0022
'    <,   003C
'    >,   003E
'    |,   007C
'    ...

See Also

Project CorLib Overview

Class Path Overview


Path: GetPathRoot

GetPathRoot

Returns the root directory information of the specified path.

 Public Function GetPathRoot(
      ByRef Path As String ) As String

Parameters

Path
[ByRef] String. The path from which to obtain root directory information.

Return Values

String - The root directory of Path, such as "C:\", or an empty string if Path does not contain root directory information.

Remarks

This method does not verify that the path or file name exists.

Possible patterns for the string returned by this method are as follows:

  • An empty string (path specified a relative path on the current drive or volume).
  • "/" (path specified an absolute path on the current drive).
  • "X:" (path specified a relative path on a drive, where X represents a drive or volume letter).
  • "X:/" (path specified an absolute path on a given drive).
  • "\\ComputerName\SharedFolder" (a UNC path).

Exceptions

Exception | Condition
ArgumentException | Path contains one or more of the invalid characters defined in GetInvalidPathChars. -or- Path is an empty string.

Examples

The following code example demonstrates a use of the GetPathRoot method.

Public Sub Main()
    Const FileName As String = "MyFile.Ext"
    Const PathName As String = "\MyDir\"
    Const FullPath As String = "C:\MyDir\MyFile.Ext"

    Dim PathNameRoot As String

    PathNameRoot = Path.GetPathRoot(PathName)
    Debug.Print CorString.Format("GetPathRoot('{0}') returns '{1}'", PathName, PathNameRoot)

    PathNameRoot = Path.GetPathRoot(FileName)
    Debug.Print CorString.Format("GetPathRoot('{0}') returns '{1}'", FileName, PathNameRoot)

    PathNameRoot = Path.GetPathRoot(FullPath)
    Debug.Print CorString.Format("GetPathRoot('{0}') returns '{1}'", FullPath, PathNameRoot)
End Sub

' This example code produces output similar to the following:
'
'    GetPathRoot('\MyDir\') returns '\'
'    GetPathRoot('MyFile.Ext') returns ''
'    GetPathRoot('C:\MyDir\MyFile.Ext') returns 'C:\'

See Also

Project CorLib Overview

Class Path Overview


Path: GetTempFileName

GetTempFileName

Creates a uniquely named, zero-byte temporary file on disk and returns the full path of that file.

 Public Function GetTempFileName ( ) As String

Return Values

String - The full path of the temporary file.

Remark

This method creates a temporary file with a .TMP file extension.

The GetTempFileName method will raise an IOException if it is used to create more than 65535 files without deleting previous temporary files.

The GetTempFileName method will raise an IOException if no unique temporary file name is available. To resolve this error, delete all unneeded temporary files.

Exceptions

Exception | Condition
IOException | An I/O error occurs, such as no unique temporary file name is available. -or- This method was unable to create a temporary file.

See Also

Project CorLib Overview

Class Path Overview


Path: GetTempPath

GetTempPath

Returns the path to the temporary folder for the current user.

 Public Function GetTempPath ( ) As String

Return Values

String - The path to the temporary folder, ending with a backslash.

Remarks

This method checks for the existence of environment variables in the following order and uses the first path found:

  1. The path specified by the TMP environment variable.
  2. The path specified by the TEMP environment variable.
  3. The path specified by the USERPROFILE environment variable.
  4. The Windows directory.

See Also

Project CorLib Overview

Class Path Overview


Path: HasExtension

HasExtension

Determines whether a path includes a file name extension.

 Public Function HasExtension(
      ByRef Path As String ) As Boolean

Parameters

Path
[ByRef] String. The path to search for an extension.

Return Values

Boolean - True if the characters that follow the last directory separator (\ or /) or volume separator (:) in the path include a period (.) followed by one or more characters; otherwise, False.

Remarks

Starting from the end of Path, this method searches for a period (.) followed by at least one character. If this pattern is found before a DirectorySeparatorChar, AltDirectorySeparatorChar, or VolumeSeparatorChar character is encountered, this method returns True.

Exceptions

Exception | Condition
ArgumentException | Path contains one or more of the invalid characters defined in GetInvalidPathChars.

Examples

The following code example demonstrates the use of the HasExtension method.

Public Sub Main()
    Const FileName1 As String = "MyFile.Ext"
    Const FileName2 As String = "MyDir\MyFile"
    Const AbsolutePath As String = "C:\MyDir.Ext\"

    Dim Result As Boolean

    Result = Path.HasExtension(FileName1)
    Debug.Print CorString.Format("HasExtension('{0}') returns {1}", FileName1, Result)

    Result = Path.HasExtension(FileName2)
    Debug.Print CorString.Format("HasExtension('{0}') returns {1}", FileName2, Result)

    Result = Path.HasExtension(AbsolutePath)
    Debug.Print CorString.Format("HasExtension('{0}') returns {1}", AbsolutePath, Result)
End Sub

' This example code produces the following output.
'
'    HasExtension('MyFile.Ext') returns True
'    HasExtension('MyDir\MyFile') returns False
'    HasExtension('C:\MyDir.Ext\') returns False

See Also

Project CorLib Overview

Class Path Overview

DirectorySeparatorChar

AltDirectorySeparatorChar

VolumeSeparatorChar


Path: IsPathRooted

IsPathRooted

Gets a value indicating whether the specified path string contains a root.

 Public Function IsPathRooted(
      ByRef Path As String ) As Boolean

Parameters

Path
[ByRef] String. The path to test.

Return Values

Boolean - True if Path contains a root; otherwise False.

Remarks

The IsPathRooted method returns True if the first character is a directory separator character such as "\", or if the path starts with a drive letter and colon (:). For example, it returns True for Path strings such as "\\MyDir\\MyFile.txt", "C:\\MyDir", or "C:MyDir". It returns False for Path strings such as "MyDir".

The method does not verify that the path or file name exists.

Exceptions

Exception | Condition
ArgumentException | Path contains one or more of the invalid characters defined in GetInvalidPathChars.

Examples

The following code example demonstrates how the IsPathRooted method can be used to test three strings.

Public Sub Main()
    Const FileName As String = "C:\MyDir\MyFile.Ext"
    Const UncPath As String = "\\MyPC\MyDir\MyFile"
    Const RelativePath As String = "MyDir\SubDir\"

    Dim Result As Boolean

    Result = Path.IsPathRooted(FileName)
    Debug.Print CorString.Format("IsPathRooted('{0}') returns {1}", FileName, Result)

    Result = Path.IsPathRooted(UncPath)
    Debug.Print CorString.Format("IsPathRooted('{0}') returns {1}", UncPath, Result)

    Result = Path.IsPathRooted(RelativePath)
    Debug.Print CorString.Format("IsPathRooted('{0}') returns {1}", RelativePath, Result)
End Sub

' This example code produces the following output.
'
'    IsPathRooted('C:\MyDir\MyFile.Ext') returns True
'    IsPathRooted('\\MyPC\MyDir\MyFile') returns True
'    IsPathRooted('MyDir\SubDir\') returns False

See Also

Project CorLib Overview

Class Path Overview

GetInvalidPathChars


Path: PathSeparator (get)

PathSeparator

The string used to seperate strings in an environment variable.

 Public Property Get PathSeparator ( ) As String

Return Values

String - The environment variable string separator ";".

Read Only.

See Also

Project CorLib Overview

Class Path Overview

DirectorySeparator

DirectorySeparatorChar

AltDirectorySeparator

AltDirectorySeparatorChar

PathSeparatorChar

VolumeSeparator

VolumeSeparatorChar


Path: PathSeparatorChar (get)

PathSeparatorChar

The character code used to separate strings in an environment variable.

 Public Property Get PathSeparatorChar ( ) As Integer

Return Values

Integer - The environment variable string separator character code (59).

Read Only.

See Also

Project CorLib Overview

Class Path Overview

DirectorySeparator

DirectorySeparatorChar

AltDirectorySeparator

AltDirectorySeparatorChar

PathSeparator

VolumeSeparator

VolumeSeparatorChar


Path: VolumeSeparator (get)

VolumeSeparator

Returns the string version of the volume separator.

 Public Property Get VolumeSeparator ( ) As String

Return Values

String - The string version of the volume separator ":".

Read Only.

See Also

Project CorLib Overview

Class Path Overview

DirectorySeparator

DirectorySeparatorChar

AltDirectorySeparator

AltDirectorySeparatorChar

PathSeparator

PathSeparatorChar

VolumeSeparatorChar


Path: VolumeSeparatorChar (get)

VolumeSeparatorChar

The character code used to separate volume labels from path information.

 Public Property Get VolumeSeparatorChar ( ) As Integer

Return Values

Integer - The character code for the volume separator (58).

Read Only.

See Also

Project CorLib Overview

Class Path Overview

DirectorySeparator

DirectorySeparatorChar

AltDirectorySeparator

AltDirectorySeparatorChar

PathSeparator

PathSeparatorChar

VolumeSeparator


PathTooLongException

PathTooLongException

An exception that is caused by a path being longer than Windows can handle.

Implements:

Exception
IObject
IOException
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

Remarks

The maximum length for a path in Windows is 260 characters.

See Also

Project CorLib Overview

Class PathTooLongException Overview

Constructors

ExceptionMethods

Exception


PathTooLongException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class PathTooLongException Overview


PathTooLongException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class PathTooLongException Overview


PathTooLongException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class PathTooLongException Overview


PathTooLongException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class PathTooLongException Overview


PathTooLongException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class PathTooLongException Overview


PathTooLongException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class PathTooLongException Overview


PathTooLongException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class PathTooLongException Overview


PathTooLongException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class PathTooLongException Overview


PathTooLongException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class PathTooLongException Overview

Exception


PathTooLongException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class PathTooLongException Overview


PathTooLongException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class PathTooLongException Overview


PathTooLongException: IOException

IOException

 Implements IOException

Return Values

IOException -

See Also

Project CorLib Overview

Class PathTooLongException Overview


PathTooLongException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewSystemException.

Read Only.

See Also

Project CorLib Overview

Class PathTooLongException Overview


PathTooLongException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class PathTooLongException Overview


PathTooLongException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class PathTooLongException Overview


PathTooLongException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class PathTooLongException Overview


PathTooLongException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class PathTooLongException Overview


PictureResourceGroup

PictureResourceGroup

This class represents a group of Icons or Cursors.

Implements:

IObject

Public:

Types:

Name | Description
PictureGroupTypes | The list of picture types supported.

Properties:

Name | Description
Count (get) | Returns the number of pictures in the group.
GroupType (get) | Returns the type of pictures in the group.

Methods:

Name | Description
Add | Adds a picture to the group.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

See Also

Project CorLib Overview

Class PictureResourceGroup Overview

PictureResourceGroupInfo


PictureResourceGroup: Add

Add

Adds a picture to the group.

 Public Sub Add(
      ByVal Resource As PictureResourceInfo )

Parameters

Resource
[ByVal] PictureResourceInfo. The picture to be added to the group.

Remarks

The picture resource value is not added to the resource. It is only used to obtain information about the picture. The actual picture resource needs to be added to the ResourceWriter independently.

See Also

Project CorLib Overview

Class PictureResourceGroup Overview


PictureResourceGroup: Count (get)

Count

Returns the number of pictures in the group.

 Public Property Get Count ( ) As Long

Return Values

Long - The number of pictures in the group.

Read Only.

See Also

Project CorLib Overview

Class PictureResourceGroup Overview


PictureResourceGroup: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compere equality with this instance.

Return Values

Boolean - Returns True if the value equals this instance, False otherwise.

See Also

Project CorLib Overview

Class PictureResourceGroup Overview


PictureResourceGroup: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a hashcode value.

See Also

Project CorLib Overview

Class PictureResourceGroup Overview


PictureResourceGroup: GroupType (get)

GroupType

Returns the type of pictures in the group.

 Public Property Get GroupType ( ) As PictureGroupTypes

Return Values

PictureGroupTypes - The type of pictures in the group.

Read Only.

See Also

Project CorLib Overview

Class PictureResourceGroup Overview


PictureResourceGroup: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class PictureResourceGroup Overview


PictureResourceGroup: PictureGroupTypes

PictureGroupTypes

The list of picture types supported.

 Public Enum PictureGroupTypes

Values

IconGroup = ResourceTypes . IconResource
Represents a group of icon pictures.
CursorGroup = ResourceTypes . CursorResource
Represents a group of cursor pictures.

See Also

Project CorLib Overview

Class PictureResourceGroup Overview


PictureResourceGroup: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - A string representation of this instance.

See Also

Project CorLib Overview

Class PictureResourceGroup Overview


PictureResourceInfo

PictureResourceInfo

Represents a picture resource that is part of a group of pictures.

Implements:

IObject

Public:

Properties:

Name | Description
BitCount (get) | Returns the number of bits used to represent the color range.
Colors (get) | Returns the number of colors used in the picture.
Height (get) | Returns the height of the picture.
Planes (get) | Returns the number of planes. This returns 1.
ResourceId (get) | The numeric identifier of the associated picture.
ResourceType (get) | Returns the type of group this resource belongs to.
Size (get) | Returns the number of bytes in this resource.
Width (get) | Returns the width of the picture.

Methods:

Name | Description
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

See Also

Project CorLib Overview

Class PictureResourceInfo Overview

ResPictureGroup


PictureResourceInfo: BitCount (get)

BitCount

Returns the number of bits used to represent the color range.

 Public Property Get BitCount ( ) As Long

Return Values

Long - The number of bits used to represent the color range.

Read Only.

See Also

Project CorLib Overview

Class PictureResourceInfo Overview


PictureResourceInfo: Colors (get)

Colors

Returns the number of colors used in the picture.

 Public Property Get Colors ( ) As Long

Return Values

Long - The number of colors used.

Read Only.

See Also

Project CorLib Overview

Class PictureResourceInfo Overview


PictureResourceInfo: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare to this instance.

Return Values

Boolean - Returns True if the value is equal to this instance, False otherwise.

See Also

Project CorLib Overview

Class PictureResourceInfo Overview


PictureResourceInfo: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A hashcode value.

See Also

Project CorLib Overview

Class PictureResourceInfo Overview


PictureResourceInfo: Height (get)

Height

Returns the height of the picture.

 Public Property Get Height ( ) As Long

Return Values

Long - The picture height in pixels.

Read Only.

See Also

Project CorLib Overview

Class PictureResourceInfo Overview


PictureResourceInfo: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class PictureResourceInfo Overview


PictureResourceInfo: Planes (get)

Planes

Returns the number of planes. This returns 1.

 Public Property Get Planes ( ) As Long

Return Values

Long - The number of planes.

Read Only.

See Also

Project CorLib Overview

Class PictureResourceInfo Overview


PictureResourceInfo: ResourceId (get)

ResourceId

The numeric identifier of the associated picture.

 Public Property Get ResourceId ( ) As Long

Return Values

Long - The numeric identifier.

Read Only.

See Also

Project CorLib Overview

Class PictureResourceInfo Overview


PictureResourceInfo: ResourceType (get)

ResourceType

Returns the type of group this resource belongs to.

 Public Property Get ResourceType ( ) As ResourceTypes

Return Values

ResourceTypes - The type of group this resource belong to.

Read Only.

See Also

Project CorLib Overview

Class PictureResourceInfo Overview


PictureResourceInfo: Size (get)

Size

Returns the number of bytes in this resource.

 Public Property Get Size ( ) As Long

Return Values

Long - The number of bytes in this resource.

Read Only.

See Also

Project CorLib Overview

Class PictureResourceInfo Overview


PictureResourceInfo: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - A string representation of this instance.

See Also

Project CorLib Overview

Class PictureResourceInfo Overview


PictureResourceInfo: Width (get)

Width

Returns the width of the picture.

 Public Property Get Width ( ) As Long

Return Values

Long - The picture width in pixels.

Read Only.

See Also

Project CorLib Overview

Class PictureResourceInfo Overview


PlatformNotSupportedException

PlatformNotSupportedException

This exception is thrown when an operation is to be performed, but the current operating system does not support the action.

Implements:

Exception
IObject
NotSupportedException
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

See Also

Project CorLib Overview

Class PlatformNotSupportedException Overview

Constructors

ExceptionMethods

Exception


PlatformNotSupportedException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class PlatformNotSupportedException Overview


PlatformNotSupportedException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class PlatformNotSupportedException Overview


PlatformNotSupportedException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class PlatformNotSupportedException Overview


PlatformNotSupportedException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class PlatformNotSupportedException Overview


PlatformNotSupportedException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class PlatformNotSupportedException Overview


PlatformNotSupportedException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class PlatformNotSupportedException Overview


PlatformNotSupportedException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class PlatformNotSupportedException Overview


PlatformNotSupportedException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class PlatformNotSupportedException Overview


PlatformNotSupportedException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class PlatformNotSupportedException Overview

Exception


PlatformNotSupportedException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class PlatformNotSupportedException Overview


PlatformNotSupportedException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class PlatformNotSupportedException Overview


PlatformNotSupportedException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewSystemException.

Read Only.

See Also

Project CorLib Overview

Class PlatformNotSupportedException Overview


PlatformNotSupportedException: NotSupportedException

NotSupportedException

 Implements NotSupportedException

Return Values

NotSupportedException -

See Also

Project CorLib Overview

Class PlatformNotSupportedException Overview


PlatformNotSupportedException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class PlatformNotSupportedException Overview


PlatformNotSupportedException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class PlatformNotSupportedException Overview


PlatformNotSupportedException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class PlatformNotSupportedException Overview


PlatformNotSupportedException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class PlatformNotSupportedException Overview


PublicFunctions

PublicFunctions

Provides some helper functions.

Public:

Methods:

Name | Description
CopyVariant | Provides a way to copy a variant value to another variant without the knowledge if Set needs to be used for objects.
GetCollectionVersion | Returns the collection version for a collection that implements IVersionable.
MoveVariant | Provides a way to move a variant datatype to another variant without the knowledge if Set needs to be used for objects.
t | Replaces escaped character sequences with a literal version.

See Also

Project CorLib Overview

Class PublicFunctions Overview


PublicFunctions: CInt64

CInt64

Converts a value to a 64-bit signed integer.

 Public Function CInt64(
      ByRef Value As Variant ) As Int64

Parameters

Value
[ByRef] Variant. The value to be converted

Return Values

Int64 - Returns a 64-bit signed integer.

See Also

Project CorLib Overview

Class PublicFunctions Overview

Build on Monday, March 23, 2020 by VBDOX
Copyright © 2000 - 2003 M.Stamenov


PublicFunctions: CopyVariant

CopyVariant

Provides a way to copy a variant value to another variant without the knowledge if Set needs to be used for objects.

 Public Sub CopyVariant(
      ByRef Destination As Variant,
      ByRef Source As Variant )

Parameters

Destination
[ByRef] Variant. The variant variable to receive a copy of the value.
Source
[ByRef] Variant. The variant variable to be copied.

Remarks

This works identical to the Win32 VariantCopyInd API function.

Any value in the destination variant will be released correctly before the source variants is copied into it.

See Also

Project CorLib Overview

Class PublicFunctions Overview


PublicFunctions: GetCollectionVersion

GetCollectionVersion

Returns the collection version for a collection that implements IVersionable.

 Public Function GetCollectionVersion(
      ByVal Obj As Object ) As Long

Parameters

Obj
[ByVal] Object. The collection to retrieve the version from.

Return Values

Long - The collection version.

Remark

The collection must maintain its own versioning.

This method does not throw an exception for unsupported values.

See Also

Project CorLib Overview

Class PublicFunctions Overview


PublicFunctions: MoveVariant

MoveVariant

Provides a way to move a variant datatype to another variant without the knowledge if Set needs to be used for objects.

 Public Sub MoveVariant(
      ByRef Destination As Variant,
      ByRef Source As Variant )

Parameters

Destination
[ByRef] Variant. The variable to move the variant value to.
Source
[ByRef] Variant. The variable to move the variant value from.

Remarks

This function moves the contents of the source variant to the destination variant. It does not make a copy. This lowers duplication overhead when a variant value needs to be transfered to another variant.

Any value in the destination variant will be released correctly before the source variants is moved into it.

See Also

Project CorLib Overview

Class PublicFunctions Overview


PublicFunctions: t

t

Replaces escaped character sequences with a literal version.

 Public Function t(
      ByRef Text As String ) As String

Parameters

Text
[ByRef] String. The string that contains the escaped characters to be replaced.

Return Values

String - A string with escaped character sequence replaced with literal characters.

Supported escaped characters

  • \t - Tab
  • \n - Linefeed
  • \r - Carriage Return
  • \a - Bell
  • \b - Back Character
  • \f - Form Feed
  • \v - Vertical Tab
  • \0 - Null Character
  • \uXXXX - Hex asc value
  • \xXXXX - Hex asc value
  • \\ - \

Examples

The following example replaces escaped characters in a string with their literal values.

 Debug.Print t("This\tis\r\na\ttest")

 'Outputs:
   This    is
   a   test

See Also

Project CorLib Overview

Class PublicFunctions Overview


Queue

Queue

Represents a first-in, first-out collection of values.

Implements:

ICloneable
ICollection
IEnumerable
IObject
IVersionable

Public:

Properties:

Name | Description
Count (get) | Gets the number of elements contained in the Queue.

Methods:

Name | Description
Clear | Removes all items from the Queue.
Clone | Creates a shallow copy of the Queue.
Contains | Determines whether an element is in the Queue.
CopyTo | Copies the Queue elements to an existing one-dimensional array, starting at the specified array index.
Dequeue | Removes and returns the item at the beginning of the Queue.
Enqueue | Adds an item to the tail of the Queue, expanding the queue as necessary.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetEnumerator | Returns an enumerator for the queue.
GetHashCode | Returns a pseudo-unique number identifying this instance.
Peek | Returns the item at the beginning of the Queue without removing it.
ToArray | Copies the Queue elements to a new array.
ToString | Returns a string representation of this object instance.
TrimToSize | Sets the capacity to the actual number of elements in the Queue.

Remarks

Queues are useful for storing messages in the order they were received for sequential processing. This class implements a queue as a circular array. Values stored in a Queue are inserted at one end and removed from the other.

The capacity of a Queue is the number of elements the Queue can hold. As elements are added to a Queue, the capacity is automatically increased as required through reallocation. The capacity can be decreased by calling TrimToSize.

Examples

The following example shows how to create and add values to a Queue and how to print out its values.

Public Sub Main()
    ' Creates and initializesa new Queue.
    Dim MyQ As New Queue
    MyQ.Enqueue "Hello"
    MyQ.Enqueue "World"
    MyQ.Enqueue "!"

    ' Displays the properties and values of the Queue.
    Debug.Print "MyQ"
    Debug.Print "    Count:    " & MyQ.Count
    Debug.Print "   Values:";
    PrintValues MyQ
End Sub

Private Sub PrintValues(ByVal MyCollection As IEnumerable)
    Dim Item As Variant

    For Each Item In MyCollection
        Debug.Print "    " & Item;
    Next

    Debug.Print
End Sub

' The example code produces the following output.
'
'    MyQ
'        Count:    3
'       Values:    Hello    World    !

See Also

Project CorLib Overview

Class Queue Overview


Queue: Clear

Clear

Removes all items from the Queue.

 Public Sub Clear ( )

Remarks

Count is set to zero, and references to other objects from elements of the collection are also released.

The capacity remains unchanged. To reset the capacity of the Queue, call TrimToSize. Trimming an empty Queue sets the capacity of the Queue to the default capacity.

Examples

The following example shows how to clear the values of the Queue.

Public Sub Main()
    Dim MyQ As New Queue

    MyQ.Enqueue "The"
    MyQ.Enqueue "quick"
    MyQ.Enqueue "brown"
    MyQ.Enqueue "fox"
    MyQ.Enqueue "jumped"

    ' Displays the count and values of the queue.
    Debug.Print "Initially,"
    Debug.Print "   Count    : " & MyQ.Count
    Debug.Print "   Values:";
    PrintValues MyQ

    ' Clears the queue.
    MyQ.Clear

    ' Displays the count and values of the queue.
    Debug.Print "After Clear,"
    Debug.Print "   Count    : " & MyQ.Count
    Debug.Print "   Values:";
    PrintValues MyQ
End Sub

Private Sub PrintValues(ByVal MyQ As Queue)
    Dim Item As Variant

    For Each Item In MyQ
        Debug.Print "    " & Item;
    Next

    Debug.Print
End Sub

' This example code produces the following output.
'
'    Initially,
'       Count    : 5
'       Values:    The    quick    brown    fox    jumped
'    After Clear,
'       Count    : 0
'       Values:

See Also

Project CorLib Overview

Class Queue Overview

TrimToSize


Queue: Clone

Clone

Creates a shallow copy of the Queue.

 Public Function Clone ( ) As Queue

Return Values

Queue - A shallow copy of the Queue.

Remarks

Returns a second queue with the same contents as the original.

A shallow copy of a collection copies only the elements of the collection, whether they are reference types or value types, but it does not copy the objects that the references refer to. The references in the new collection point to the same objects that the references in the original collection point to.

See Also

Project CorLib Overview

Class Queue Overview


Queue: Contains

Contains

Determines whether an element is in the Queue.

 Public Function Contains(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to locate in the Queue.

Return Values

Boolean - True if Value is found in the Queue; otherwise False.

Remarks

This method determines equality by calling Object.Equals.

This method performs a linear search; therefore, this method is an O(n) operation, where n is Count.

See Also

Project CorLib Overview

Class Queue Overview


Queue: CopyTo

CopyTo

Copies the Queue elements to an existing one-dimensional array, starting at the specified array index.

 Public Sub CopyTo(
      ByRef Arr As Variant,
      ByVal Index As Long )

Parameters

Arr
[ByRef] Variant. The one-dimensional array that is the destination of the elements copied from Queue.
Index
[ByVal] Long. The lowerbound-based index in Arr at which copying begins.

Remarks

The elements are copied to the array in the same order in which the enumerator iterates through the Queue.

This method is an O(n) operation, where n is Count.

Exceptions

Exception | Condition
ArgumentNullException | Arr is uninitialized.
ArgumentOutOfRangeException | Index is less than lower-bound.
ArgumentException | Arr is multidimensional. -or- The number of elements in the source Queue is greater than the available space from Index to the end of the destination Arr.
ArrayTypeMismatchException | The type of the source Queue cannot be cast automatically to the type of the destination Arr.

Examples

The following example shows how to copy a Queue into a one-dimensional array.

Public Sub Main()
    Dim MySourceQ As New Queue
    Dim MyTargetArray() As String
    Dim MyStandardArray() As Variant

    ' Initializes the source Queue.
    MySourceQ.Enqueue "three"
    MySourceQ.Enqueue "napping"
    MySourceQ.Enqueue "cats"
    MySourceQ.Enqueue "in"
    MySourceQ.Enqueue "the"
    MySourceQ.Enqueue "barn"

    MyTargetArray = NewStrings("The", "quick", "brown", "fox", "jumped", "over", "the", "lazy", "dog")
    ReDim Preserve MyTargetArray(0 To 14)

    ' Displays the values of the target array.
    Debug.Print "The target Array contains the following (before and after copying):"
    PrintValues MyTargetArray

    ' Copies the entire source queue to the target array, starting at index 6.
    MySourceQ.CopyTo MyTargetArray, 6

    ' Displays the values of the target array.
    PrintValues MyTargetArray

    ' Copies the entire source queue to a new standard array.
    MyStandardArray = MySourceQ.ToArray

    ' Displays the values of the new standard array.
    Debug.Print "The new standard array contains the following:"
    PrintValues MyStandardArray
End Sub

Private Sub PrintValues(ByRef MyArr As Variant)
    Dim Item As Variant

    For Each Item In MyArr
        Debug.Print " " & Item;
    Next

    Debug.Print
End Sub

' This example code produces the following output.
'
'    The target Array contains the following (before and after copying):
'     The quick brown fox jumped over the lazy dog
'     The quick brown fox jumped over three napping cats in the barn
'    The new standard array contains the following:
'     three napping cats in the barn

See Also

Project CorLib Overview

Class Queue Overview

ToArray


Queue: Count (get)

Count

Gets the number of elements contained in the Queue.

 Public Property Get Count ( ) As Long

Return Values

Long - The number of elements contained in the Queue.

Remarks

The capacity of a Queue is the number of elements that the Queue can store. Count is the number of elements that are actually in the Queue.

The capacity of a Queue is always greater than or equal to Count. If Count exceeds the capacity while adding elements, the capacity is automatically increased by reallocating the internal array before copying the old elements and adding the new elements.

The capacity can be decreased by calling TrimToSize.

Read Only.

See Also

Project CorLib Overview

Class Queue Overview


Queue: Dequeue

Dequeue

Removes and returns the item at the beginning of the Queue.

 Public Function Dequeue ( ) As Variant

Return Values

Variant - The object that is removed from the beginning of the Queue.

Remarks

This method is similar to the Peek method, but Peek does not modify the Queue.

Exceptions

Exception | Condition
InvalidOperationException | The Queue is empty.

Examples

The following example shows how to add elements to the Queue, remove elements from the Queue, or view the element at the beginning of the Queue.

Public Sub Main()
    Dim MyQ As New Queue

    MyQ.Enqueue "The"
    MyQ.Enqueue "quick"
    MyQ.Enqueue "brown"
    MyQ.Enqueue "fox"

    ' Display the Queue
    Debug.Print "Queue values:";
    PrintValues MyQ

    ' Removes an element from the queue.
    Debug.Print "(Dequeue)    " & MyQ.Dequeue

    ' Displays the queue.
    Debug.Print "Queue values:";
    PrintValues MyQ

    ' Removes another element from the queue.
    Debug.Print "(Dequeue)    " & MyQ.Dequeue

    ' Displays the queue.
    Debug.Print "Queue values:";
    PrintValues MyQ

    ' Views the first element in the queue but does not remove it.
    Debug.Print "(Peek)       " & MyQ.Peek

    ' Displays the queue.
    Debug.Print "Queue values:";
    PrintValues MyQ
End Sub

Private Sub PrintValues(ByVal MyCollection As IEnumerable)
    Dim Item As Variant

    For Each Item In MyCollection
        Debug.Print "    " & Item;
    Next

    Debug.Print
End Sub

' This example code produces the following output.
'
'    Queue values:    The    quick    brown    fox
'    (Dequeue)    The
'    Queue values:    quick    brown    fox
'    (Dequeue)    quick
'    Queue Values:    brown fox
'    (Peek)       brown
'    Queue Values:    brown fox

See Also

Project CorLib Overview

Class Queue Overview

Enqueue

Peek


Queue: Enqueue

Enqueue

Adds an item to the tail of the Queue, expanding the queue as necessary.

 Public Sub Enqueue(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. The item to be placed at the tail of the Queue.

Remarks

The capacity of a Queue is the number of elements the Queue can hold. As elements are added to a Queue, the capacity is automatically increased as required through reallocation. The capacity can be decreased by calling TrimToSize.

If Count is less than the capacity of the internal array, this method is an O(1) operation. If the internal array needs to be reallocated to accommodate the new element, this method becomes an O(n) operation, where n is Count.

Examples

The following example shows how to add elements to the Queue, remove elements from the Queue, or view the element at the beginning of the Queue.

Public Sub Main()
    Dim MyQ As New Queue

    MyQ.Enqueue "The"
    MyQ.Enqueue "quick"
    MyQ.Enqueue "brown"
    MyQ.Enqueue "fox"

    ' Display the Queue
    Debug.Print "Queue values:";
    PrintValues MyQ

    ' Removes an element from the queue.
    Debug.Print "(Dequeue)    " & MyQ.Dequeue

    ' Displays the queue.
    Debug.Print "Queue values:";
    PrintValues MyQ

    ' Removes another element from the queue.
    Debug.Print "(Dequeue)    " & MyQ.Dequeue

    ' Displays the queue.
    Debug.Print "Queue values:";
    PrintValues MyQ

    ' Views the first element in the queue but does not remove it.
    Debug.Print "(Peek)       " & MyQ.Peek

    ' Displays the queue.
    Debug.Print "Queue values:";
    PrintValues MyQ
End Sub

Private Sub PrintValues(ByVal MyCollection As IEnumerable)
    Dim Item As Variant

    For Each Item In MyCollection
        Debug.Print "    " & Item;
    Next

    Debug.Print
End Sub

' This example code produces the following output.
'
'    Queue values:    The    quick    brown    fox
'    (Dequeue)    The
'    Queue values:    quick    brown    fox
'    (Dequeue)    quick
'    Queue Values:    brown fox
'    (Peek)       brown
'    Queue Values:    brown fox

See Also

Project CorLib Overview

Class Queue Overview

Dequeue

Peek


Queue: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class Queue Overview


Queue: GetEnumerator

GetEnumerator

Returns an enumerator for the queue.

 Public Function GetEnumerator ( ) As IEnumerator

Return Values

IEnumerator - Enumerator to allow iterating over the queue.

See Also

Project CorLib Overview

Class Queue Overview


Queue: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class Queue Overview


Queue: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class Queue Overview


Queue: ICollection

ICollection

 Implements ICollection

Return Values

ICollection -

See Also

Project CorLib Overview

Class Queue Overview


Queue: IEnumerable

IEnumerable

 Implements IEnumerable

Return Values

IEnumerable -

See Also

Project CorLib Overview

Class Queue Overview


Queue: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class Queue Overview


Queue: IVersionable

IVersionable

 Implements IVersionable

Return Values

IVersionable -

See Also

Project CorLib Overview

Class Queue Overview


Queue: Peek

Peek

Returns the item at the beginning of the Queue without removing it.

 Public Function Peek ( ) As Variant

Return Values

Variant - The item at the beginning of the Queue.

Remarks

This method is similar to the Dequeue method, but Peek does not modify the Queue.

Exceptions

Exception | Condition
InvalidOperationException | The Queue is empty.

Examples

The following example shows how to add elements to the Queue, remove elements from the Queue, or view the element at the beginning of the Queue.

Public Sub Main()
    Dim MyQ As New Queue

    MyQ.Enqueue "The"
    MyQ.Enqueue "quick"
    MyQ.Enqueue "brown"
    MyQ.Enqueue "fox"

    ' Display the Queue
    Debug.Print "Queue values:";
    PrintValues MyQ

    ' Removes an element from the queue.
    Debug.Print "(Dequeue)    " & MyQ.Dequeue

    ' Displays the queue.
    Debug.Print "Queue values:";
    PrintValues MyQ

    ' Removes another element from the queue.
    Debug.Print "(Dequeue)    " & MyQ.Dequeue

    ' Displays the queue.
    Debug.Print "Queue values:";
    PrintValues MyQ

    ' Views the first element in the queue but does not remove it.
    Debug.Print "(Peek)       " & MyQ.Peek

    ' Displays the queue.
    Debug.Print "Queue values:";
    PrintValues MyQ
End Sub

Private Sub PrintValues(ByVal MyCollection As IEnumerable)
    Dim Item As Variant

    For Each Item In MyCollection
        Debug.Print "    " & Item;
    Next

    Debug.Print
End Sub

' This example code produces the following output.
'
'    Queue values:    The    quick    brown    fox
'    (Dequeue)    The
'    Queue values:    quick    brown    fox
'    (Dequeue)    quick
'    Queue Values:    brown fox
'    (Peek)       brown
'    Queue Values:    brown fox

See Also

Project CorLib Overview

Class Queue Overview

Enqueue

Dequeue


Queue: ToArray

ToArray

Copies the Queue elements to a new array.

 Public Function ToArray ( ) As Variant ( )

Return Values

Variant() - A new array containing elements copied from the Queue.

Remarks

The Queue is not modified. The order of the elements in the new array is the same as the order of the elements from the beginning of the Queue to its end.

This method is an O(n) operation, where n is Count.

Examples

The following example shows how to copy a Queue into a one-dimensional array.

Public Sub Main()
    Dim MySourceQ As New Queue
    Dim MyTargetArray() As String
    Dim MyStandardArray() As Variant

    ' Initializes the source Queue.
    MySourceQ.Enqueue "three"
    MySourceQ.Enqueue "napping"
    MySourceQ.Enqueue "cats"
    MySourceQ.Enqueue "in"
    MySourceQ.Enqueue "the"
    MySourceQ.Enqueue "barn"

    MyTargetArray = NewStrings("The", "quick", "brown", "fox", "jumped", "over", "the", "lazy", "dog")
    ReDim Preserve MyTargetArray(0 To 14)

    ' Displays the values of the target array.
    Debug.Print "The target Array contains the following (before and after copying):"
    PrintValues MyTargetArray

    ' Copies the entire source queue to the target array, starting at index 6.
    MySourceQ.CopyTo MyTargetArray, 6

    ' Displays the values of the target array.
    PrintValues MyTargetArray

    ' Copies the entire source queue to a new standard array.
    MyStandardArray = MySourceQ.ToArray

    ' Displays the values of the new standard array.
    Debug.Print "The new standard array contains the following:"
    PrintValues MyStandardArray
End Sub

Private Sub PrintValues(ByRef MyArr As Variant)
    Dim Item As Variant

    For Each Item In MyArr
        Debug.Print " " & Item;
    Next

    Debug.Print
End Sub

' This example code produces the following output.
'
'    The target Array contains the following (before and after copying):
'     The quick brown fox jumped over the lazy dog
'     The quick brown fox jumped over three napping cats in the barn
'    The new standard array contains the following:
'     three napping cats in the barn

See Also

Project CorLib Overview

Class Queue Overview

CopyTo


Queue: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class Queue Overview


Queue: TrimToSize

TrimToSize

Sets the capacity to the actual number of elements in the Queue.

 Public Sub TrimToSize ( )

Remarks

This method can be used to minimize a queues memory overhead if no new elements will be added to the queue.

To reset a Queue to its initial state, call the Clear method before calling TrimToSize. Trimming an empty Queue sets the capacity of the Queue to the default capacity.

This method is an O(n) operation, where n is Count.

See Also

Project CorLib Overview

Class Queue Overview

Clear

Count


Random

Random

Provides a sequence of pseudo-random generated numbers.

Implements:

IObject

Public:

Methods:

Name | Description
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
NextBytes | Fills an array of bytes with random numbers.
NextDouble | Returns a random number between 0.0 and 1.0.
NextLong | Returns the next generated number in the sequence.
NextRange | Returns the next generated number in the sequence within a specified range.
ToString | Returns a string representation of this object instance.

See Also

Project CorLib Overview

Class Random Overview

Constructors


Random: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class Random Overview


Random: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class Random Overview


Random: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class Random Overview


Random: NextBytes

NextBytes

Fills an array of bytes with random numbers.

 Public Sub NextBytes(
      ByRef Bytes ( ) As Byte )

Parameters

Bytes
[ByRef] Byte. The array to be filled.

See Also

Project CorLib Overview

Class Random Overview


Random: NextDouble

NextDouble

Returns a random number between 0.0 and 1.0.

 Public Function NextDouble ( ) As Double

Return Values

Double - The random number.

Remarks

The number will be equal to or greater than 0.0 and less than 1.0. The number will never equal 1.0.

See Also

Project CorLib Overview

Class Random Overview


Random: NextLong

NextLong

Returns the next generated number in the sequence.

 Public Function NextLong(
      Optional ByVal MaxValue As Long = &H7FFFFFFF ) As Long

Parameters

MaxValue
[ByVal] Optional. Long. The value that the generated number must be less than.

Default: &H7FFFFFFF

Return Values

Long - The next generated number in the sequence.

Remarks

The generated number will be equal or greater than zero and less than maxValue. The number will never equal maxValue.

See Also

Project CorLib Overview

Class Random Overview


Random: NextRange

NextRange

Returns the next generated number in the sequence within a specified range.

 Public Function NextRange(
      ByVal MinValue As Long,
      ByVal MaxValue As Long ) As Long

Parameters

MinValue
[ByVal] Long. The lowerbound of the number to be generated.
MaxValue
[ByVal] Long. The upperbound of the number to be generated. Must be equal to or greater than minValue.

Return Values

Long - A number generated within the specified range.

Remarks

The number generated will always be equal to or greater than minValue, and less than maxValue. The number will never equal maxValue.

See Also

Project CorLib Overview

Class Random Overview


Random: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class Random Overview


RandomNumberGenerator

RandomNumberGenerator

A common interface to be implemented by random number generators.

Public:

Methods:

Name | Description
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetBytes | Fills the array with random byte values.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function. An override might be necessary if the hashcode should be derived from a value contained within the class.
GetNonZeroBytes | Files the array with random byte values, ensuring no zeros are included.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides. A Person class may return the persons name instead.

See Also

Project CorLib Overview

Class RandomNumberGenerator Overview


RandomNumberGenerator: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to be tested for equality.

Return Values

Boolean -

See Also

Project CorLib Overview

Class RandomNumberGenerator Overview


RandomNumberGenerator: GetBytes

GetBytes

Fills the array with random byte values.

 Public Sub GetBytes(
      ByRef Data ( ) As Byte )

Parameters

Data
[ByRef] Byte. The array to fill with random data.

See Also

Project CorLib Overview

Class RandomNumberGenerator Overview


RandomNumberGenerator: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

An override might be necessary if the hashcode should be derived from a value contained within the class.

 Public Function GetHashCode ( ) As Long

Return Values

Long -

See Also

Project CorLib Overview

Class RandomNumberGenerator Overview


RandomNumberGenerator: GetNonZeroBytes

GetNonZeroBytes

Files the array with random byte values, ensuring no zeros are included.

 Public Sub GetNonZeroBytes(
      ByRef Data ( ) As Byte )

Parameters

Data
[ByRef] Byte. The array to fill with random data.

See Also

Project CorLib Overview

Class RandomNumberGenerator Overview


RandomNumberGenerator: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

A Person class may return the persons name instead.

 Public Function ToString ( ) As String

Return Values

String -

See Also

Project CorLib Overview

Class RandomNumberGenerator Overview


RandomNumberGeneratorStatic

RandomNumberGeneratorStatic

Provides static methods associated with the RandomNumberGenerator class.

Public:

Methods:

Name | Description
Create | Creates a new random number generator based on the name.

See Also

Project CorLib Overview

Class RandomNumberGeneratorStatic Overview


RandomNumberGeneratorStatic: Create

Create

Creates a new random number generator based on the name.

 Public Function Create(
      Optional ByRef RngName As String ) As RandomNumberGenerator

Parameters

RngName
[ByRef] Optional. String. The name of the implementation to create.

Return Values

RandomNumberGenerator - A new RandomNumberGenerator implementation.

Remarks

If the name is empty then RNGCryptoServiceProvider is returned.

See Also

Project CorLib Overview

Class RandomNumberGeneratorStatic Overview


RankException

RankException

The exception that is thrown when an array with the wrong number of dimensions is passed to a method.

Implements:

Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

See Also

Project CorLib Overview

Class RankException Overview

Constructors

ExceptionMethods

Exception


RankException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class RankException Overview


RankException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class RankException Overview


RankException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class RankException Overview


RankException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class RankException Overview


RankException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class RankException Overview


RankException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class RankException Overview


RankException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class RankException Overview


RankException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class RankException Overview


RankException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class RankException Overview

Exception


RankException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class RankException Overview


RankException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class RankException Overview


RankException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewSystemException.

Read Only.

See Also

Project CorLib Overview

Class RankException Overview


RankException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class RankException Overview


RankException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class RankException Overview


RankException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class RankException Overview


RankException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class RankException Overview


RC2

RC2

Represents a standard interface implemented by all RC2 crypto service providers.

Public:

Properties:

Name | Description
BlockSize (get) | Returns the block size, in bits, used by the cryptographic operation.
BlockSize (let) | Sets the block size, in bits, used by the cryptographic operation.
EffectiveKeySize (get) | Returns the effective key size.
EffectiveKeySize (let) | Sets the effective key size.
FeedbackSize (get) | Returns the feedback size, in bits, used by the cryptographic operation.
FeedbackSize (let) | Sets the feedback size, in bits, used by the cryptographic operation.
IV (get) | Returns the Initialization Vector used by the cryptographic operation.
IV (let) | Sets the Initialization Vector used by the cryptographic operation.
Key (get) | Returns the secret key used by the cryptographic operation.
Key (let) | Sets the secret key to be used by the cryptographic operation.
KeySize (get) | Returns the size of the key, in bits, used by the cryptographic operation.
KeySize (let) | Sets the size of the key, in bits.
LegalBlockSizes (get) | Returns a list of legal block sizes.
LegalKeySizes (get) | Returns a list of legal key sizes.
Mode (get) | Returns the mode the current algoritm is set to.
Mode (let) | Sets the mode the current algorithm is set to.
Padding (get) | Returns the padding to be used by the algorithm.
Padding (let) | Sets the padding to be used by the algorithm.

Methods:

Name | Description
Clear | Releases all resources.
CreateDecryptor | Creates a new decryptor using the RC2 algorithm.
CreateEncryptor | Creates a new encryptor using the RC2 algorithm.
Equals | Returns if this instance and the value are equal.
GenerateIV | Generates a new Initialization Vector array.
GenerateKey | Generates a new Key based on the key size.
GetHashCode | Returns a semi-unique value that represents this instance.
ToString | Returns a string representation of this instance.
ValidKeySize | Checks if the specific number of bits is a valid key size.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: BlockSize (get)

BlockSize

Returns the block size, in bits, used by the cryptographic operation.

 Public Property Get BlockSize ( ) As Long

Return Values

Long - The block size in bits.

Remarks

A block size is the basic unit size of data that can be encrypted or decrypted in a single operation. Data that is larger than a block size are processed by splitting the data into multiple blocks the same size as the block size then operating of the multiple blocks.

A list of legal block sizes can be obtained through the LegalBlockSizes property.

Read/Write.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: BlockSize (let)

BlockSize

Sets the block size, in bits, used by the cryptographic operation.

 Public Property Let BlockSize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The block size in bits.

Remarks

A block size is the basic unit size of data that can be encrypted or decrypted in a single operation. Data that is larger than a block size are processed by splitting the data into multiple blocks the same size as the block size then operating of the multiple blocks.

An invalid block size will cause a CryptographicException.

A list of legal block sizes can be obtained through the LegalBlockSizes property.

Read/Write.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: Clear

Clear

Releases all resources.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class RC2 Overview


RC2: CreateDecryptor

CreateDecryptor

Creates a new decryptor using the RC2 algorithm.

 Public Function CreateDecryptor(
      Optional ByRef RgbKey As Variant,
      Optional ByRef RgbIV As Variant ) As ICryptoTransform

Parameters

RgbKey
[ByRef] Optional. Variant. The secret key to be used to decrypt the ciphered text back into plain text.
RgbIV
[ByRef] Optional. Variant. The Initialization Vector to begin the feedback with.

Return Values

ICryptoTransform - A new ICryptoTransform used to decrypt ciphered text.

Remarks

Though both parameters are optional, if only one parameter is supplied, an exception will be thrown.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: CreateEncryptor

CreateEncryptor

Creates a new encryptor using the RC2 algorithm.

 Public Function CreateEncryptor(
      Optional ByRef RgbKey As Variant,
      Optional ByRef RgbIV As Variant ) As ICryptoTransform

Parameters

RgbKey
[ByRef] Optional. Variant. The secret key to be used to encrypt the plain text into ciphered text.
RgbIV
[ByRef] Optional. Variant. The Initialization Vector to begin the feedback with.

Return Values

ICryptoTransform - A new ICryptoTransform used to encrypt plain text.

Remarks

Though both parameters are optional, if only one parameter is supplied, an exception will be thrown.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: EffectiveKeySize (get)

EffectiveKeySize

Returns the effective key size.

 Public Property Get EffectiveKeySize ( ) As Long

Return Values

Long - The effective key size.

Remarks

The effective key size is the number of bits to actually be used from the key itself. This applies to Windows 2000.

Read/Write.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: EffectiveKeySize (let)

EffectiveKeySize

Sets the effective key size.

 Public Property Let EffectiveKeySize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The effective key size.

Remarks

The effective key size is the number of bits to actually be used from the key itself. This applies to Windows 2000.

Read/Write.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: Equals

Equals

Returns if this instance and the value are equal.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare for equality.

Return Values

Boolean - Returns if the value and this instance are equal.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: FeedbackSize (get)

FeedbackSize

Returns the feedback size, in bits, used by the cryptographic operation.

 Public Property Get FeedbackSize ( ) As Long

Return Values

Long - Returns the feedback size in bits.

Remarks

The feedback size determines the amount of data that is fed back to successive encryption or decryption operations. The feedback size cannot be greater than the block size.

Read/Write.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: FeedbackSize (let)

FeedbackSize

Sets the feedback size, in bits, used by the cryptographic operation.

 Public Property Let FeedbackSize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The feedback size in bits.

Remarks

The feedback size determines the amount of data that is fed back to successive encryption or decryption operations. The feedback size cannot be greater than the block size.

Read/Write.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: GenerateIV

GenerateIV

Generates a new Initialization Vector array.

 Public Sub GenerateIV ( )

See Also

Project CorLib Overview

Class RC2 Overview


RC2: GenerateKey

GenerateKey

Generates a new Key based on the key size.

 Public Sub GenerateKey ( )

See Also

Project CorLib Overview

Class RC2 Overview


RC2: GetHashCode

GetHashCode

Returns a semi-unique value that represents this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns the semi-unique value.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: IV (get)

IV

Returns the Initialization Vector used by the cryptographic operation.

 Public Property Get IV ( ) As Byte ( ) :

Return Values

Byte() - Returns an array of bytes representing an Initialization Vector.

Remarks

If several blocks of same plain text are encrypted, the ciphered data could all be the same aswell. Using an Initialization Vector can prevent same plain text blocks to reproduce the same ciphered blocks.

This can be generated using the GenerateIV method, or a new one will be generated if one hasnt been set when this property is accessed.

Read/Write.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: IV (let)

IV

Sets the Initialization Vector used by the cryptographic operation.

 Public Property Let IV(
      ByRef Value ( ) As Byte ) :

Parameters

Value
[ByRef] Byte. The new Initialization Vector.

Remarks

If several blocks of same plain text are encrypted, the ciphered data could all be the same aswell. Using an Initialization Vector can prevent same plain text blocks to reproduce the same ciphered blocks.

This can be generated using the GenerateIV method, or a new one will be generated if one hasnt been set when this property is accessed.

This must be set to an array the same size as the block size.

Read/Write.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: Key (get)

Key

Returns the secret key used by the cryptographic operation.

 Public Property Get Key ( ) As Byte ( ) :

Return Values

Byte() - Returns the secret key.

Remarks

Valid key sizes are determined by the individual algorithms. A list of valid sizes can be obtained through the LegalKeySizes property.

If a key has not been set, then a new key will be generated automatically.

Read/Write.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: Key (let)

Key

Sets the secret key to be used by the cryptographic operation.

 Public Property Let Key(
      ByRef Value ( ) As Byte ) :

Parameters

Value
[ByRef] Byte. The new secret key to be used.

Remarks

Valid key sizes are determined by the individual algorithms. A list of valid sizes can be obtained through the LegalKeySizes property.

Read/Write.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: KeySize (get)

KeySize

Returns the size of the key, in bits, used by the cryptographic operation.

 Public Property Get KeySize ( ) As Long

Return Values

Long - The size of the key in bits.

Read/Write.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: KeySize (let)

KeySize

Sets the size of the key, in bits.

 Public Property Let KeySize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The size of the key in bits.

Remarks

This will cause the Key property to reset and regenerate when needed.

Read/Write.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: LegalBlockSizes (get)

LegalBlockSizes

Returns a list of legal block sizes.

 Public Property Get LegalBlockSizes ( ) As KeySizes ( ) :

Return Values

KeySizes() - A list of legal block sizes the cryptographic operation supports.

Read Only.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: LegalKeySizes (get)

LegalKeySizes

Returns a list of legal key sizes.

 Public Property Get LegalKeySizes ( ) As KeySizes ( ) :

Return Values

KeySizes() - A list of legal key sizes the cryptographic operation supports.

Read Only.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: Mode (get)

Mode

Returns the mode the current algoritm is set to.

 Public Property Get Mode ( ) As CipherMode

Return Values

CipherMode - Returns a CipherMode value.

Remarks

The algoritm can operate in several modes. The modes determine how the data is processed from one block to the next.

Read/Write.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: Mode (let)

Mode

Sets the mode the current algorithm is set to.

 Public Property Let Mode(
      ByVal Value As CipherMode ) :

Parameters

Value
[ByVal] CipherMode. The new mode for the algorithm.

Remarks

The algoritm can operate in several modes. The modes determine how the data is processed from one block to the next.

Read/Write.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: Padding (get)

Padding

Returns the padding to be used by the algorithm.

 Public Property Get Padding ( ) As PaddingMode

Return Values

PaddingMode - A current padding being used.

Remarks

Padding is added to the end of plain text data to make the data length an even multiple of the block size.

Read/Write.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: Padding (let)

Padding

Sets the padding to be used by the algorithm.

 Public Property Let Padding(
      ByVal Value As PaddingMode ) :

Parameters

Value
[ByVal] PaddingMode. The new padding value to be used.

Remarks

Padding is added to the end of plain text data to make the data length an even multiple of the block size.

Read/Write.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: ToString

ToString

Returns a string representation of this instance.

 Public Function ToString ( ) As String

Return Values

String - A string that represents this instance.

See Also

Project CorLib Overview

Class RC2 Overview


RC2: ValidKeySize

ValidKeySize

Checks if the specific number of bits is a valid key size.

 Public Function ValidKeySize(
      ByVal BitLength As Long ) As Boolean

Parameters

BitLength
[ByVal] Long. A value to determine if is a legal key size.

Return Values

Boolean - Returns True if the bit length is a valid key size, False otherwise.

See Also

Project CorLib Overview

Class RC2 Overview


RC2CryptoServiceProvider

RC2CryptoServiceProvider

Provides cryptography services using the RC2 symmetric algorithm.

Implements:

IObject
RC2
SymmetricAlgorithm

Public:

Properties:

Name | Description
BlockSize (get) | Returns the block size, in bits, used by this algorithm.
BlockSize (let) | Sets the block size, in bits, used by this algorithm.
EffectiveKeySize (get) | Returns the effective key size to be used.
EffectiveKeySize (let) | Sets the effective key size to be used.
FeedbackSize (get) | Returns the Feedback Size in bits.
FeedbackSize (let) | Sets the Feedback size in bits.
IV (get) | Returns the Initialization Vector.
IV (let) | Sets the Initialization Vector to be used.
Key (get) | Returns the current secret key.
Key (let) | Sets the secret key.
KeySize (get) | Returns the key size in bits.
KeySize (let) | Sets the key size in bits.
LegalBlockSizes (get) | Returns a list of legal block sizes.
LegalKeySizes (get) | Returns a list of valid key sizes supported by this algorithm.
Mode (get) | Returns the Cipher mode this algorithm will use.
Mode (let) | Sets the Cipher mode this algorithm will use.
Padding (get) | Returns the padding mode being used.
Padding (let) | Sets the padding mode to be used.
UseSalt (get) | Returns if a salt value is to be used with the key generation.
UseSalt (let) | Sets if a salt value will be used with the key generation.

Methods:

Name | Description
Clear | Clears the Key and IV arrays.
CreateDecryptor | Returns a new cipher used to decrypt data.
CreateEncryptor | Returns a new cipher used to encrypt data.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GenerateIV | Generates a random IV array to use.
GenerateKey | Generates a random key to be used.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
ValidKeySize | Tests if a specific bit length is valid for a key.

Remarks

This class uses the Windows CryptoAPI services.

Examples

This example shows a very simple method of encrypting then decrypting a String value.

Private Sub Main()
    Dim Buffer() As Byte
    Dim PlainText As String

    ' Create a new RC2CryptoServiceProvider key.
    Dim Key As New RC2CryptoServiceProvider

    ' Encrypt a string to a byte array.
    Buffer = Encrypt("This is some plaintext!", Key)
    Debug.Print "Encrypted data"
    PrintBytes Buffer
    Debug.Print

    ' Decrypt the byte array back to a string.
    PlainText = Decrypt(Buffer, Key)

    ' Display the plaintext value to the console.
    Debug.Print "Decrypted data"
    Debug.Print PlainText
End Sub

Private Sub PrintBytes(ByRef Bytes() As Byte)
    Dim i As Long

    For i = LBound(Bytes) To UBound(Bytes)
        Debug.Print Object.ToString(Bytes(i), "X2"); " ";
    Next

    Debug.Print
End Sub

' Encrypt the string.
Private Function Encrypt(ByVal PlainText As String, ByVal Key As SymmetricAlgorithm) As Byte()
    Dim Encryptor As ICryptoTransform
    Dim Buffer() As Byte

    Buffer = Encoding.UTF8.GetBytes(PlainText)
    Set Encryptor = Key.CreateEncryptor
    Encrypt = Encryptor.TransformFinalBlock(Buffer, 0, CorArray.Length(Buffer))
End Function

' Decrypt the byte array.
Public Function Decrypt(ByRef CypherText() As Byte, ByVal Key As SymmetricAlgorithm) As String
    Dim Decryptor As ICryptoTransform
    Dim Buffer() As Byte

    Set Decryptor = Key.CreateDecryptor
    Buffer = Decryptor.TransformFinalBlock(CypherText, 0, CorArray.Length(CypherText))
    Decrypt = Encoding.UTF8.GetString(Buffer)
End Function

' This example code produces the following output. (encrypted data may be different because key is random)
'
'    Encrypted Data
'    B3 70 EC 9E 4C 6F A1 43 CA 1E 64 68 95 E5 0C A0 E0 71 0B DA CB 09 B4 42
'
'    Decrypted Data
'    This is some plaintext!

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview

RC2


RC2CryptoServiceProvider: BlockSize (get)

BlockSize

Returns the block size, in bits, used by this algorithm.

 Public Property Get BlockSize ( ) As Long

Return Values

Long - The block size in bits.

Remarks

This will always return 64 bits (8 bytes).

Read/Write.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: BlockSize (let)

BlockSize

Sets the block size, in bits, used by this algorithm.

 Public Property Let BlockSize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new block size in bits.

Remarks

The only valid block size is 64 bits.

Read/Write.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: Clear

Clear

Clears the Key and IV arrays.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: CreateDecryptor

CreateDecryptor

Returns a new cipher used to decrypt data.

 Public Function CreateDecryptor(
      Optional ByRef RgbKey As Variant,
      Optional ByRef RgbIV As Variant ) As ICryptoTransform

Parameters

RgbKey
[ByRef] Optional. Variant. A supplied byte array used as the secret key.
RgbIV
[ByRef] Optional. Variant. A supplied byte array used for the Initialization Vector (IV).

Return Values

ICryptoTransform - An ICryptoTransform object used to dencrypt data.

Remarks

Both parameters must be either supplied or missing. A single parameter will throw an exception.

If no parameters are supplied then the key and IV will be retrieved through the Key and IV properties.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: CreateEncryptor

CreateEncryptor

Returns a new cipher used to encrypt data.

 Public Function CreateEncryptor(
      Optional ByRef RgbKey As Variant,
      Optional ByRef RgbIV As Variant ) As ICryptoTransform

Parameters

RgbKey
[ByRef] Optional. Variant. A supplied byte array used as the secret key.
RgbIV
[ByRef] Optional. Variant. A supplied byte array used for the Initialization Vector (IV).

Return Values

ICryptoTransform - An ICryptoTransform object used to encrypt data.

Remarks

Both parameters must be either supplied or missing. A single parameter will throw an exception.

If no parameters are supplied then the key and IV will be retrieved through the Key and IV properties.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: EffectiveKeySize (get)

EffectiveKeySize

Returns the effective key size to be used.

 Public Property Get EffectiveKeySize ( ) As Long

Return Values

Long - The effective key size.

Read/Write.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: EffectiveKeySize (let)

EffectiveKeySize

Sets the effective key size to be used.

 Public Property Let EffectiveKeySize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new effective key size.

Remarks

This property can only be set to the same value as KeySize. This property is useless in setting the effective key size. It is here to complete the .NET interface for this class.

The effective key size to use will ultimately be determined by the length of the actual key being used.

Read/Write.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the values are the same.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: FeedbackSize (get)

FeedbackSize

Returns the Feedback Size in bits.

 Public Property Get FeedbackSize ( ) As Long

Return Values

Long - The Feedback size in bits.

Remarks

Always returns 64 bits.

Read/Write.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: FeedbackSize (let)

FeedbackSize

Sets the Feedback size in bits.

 Public Property Let FeedbackSize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new feedback size in bits.

Remarks

Only 64 bits is valid.

Read/Write.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: GenerateIV

GenerateIV

Generates a random IV array to use.

 Public Sub GenerateIV ( )

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: GenerateKey

GenerateKey

Generates a random key to be used.

 Public Sub GenerateKey ( )

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: IV (get)

IV

Returns the Initialization Vector.

 Public Property Get IV ( ) As Byte ( )

Return Values

Byte() - The Initialization Vector.

Remarks

If no IV has been set, then a new random IV will be generated.

Read/Write.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: IV (let)

IV

Sets the Initialization Vector to be used.

 Public Property Let IV(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new IV to use.

Remarks

The array must be 8 bytes in length.

Read/Write.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: Key (get)

Key

Returns the current secret key.

 Public Property Get Key ( ) As Byte ( )

Return Values

Byte() - The secret key.

Remarks

If no key has been set, then a new random key will be generated.

Read/Write.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: Key (let)

Key

Sets the secret key.

 Public Property Let Key(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new secret key.

Read/Write.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: KeySize (get)

KeySize

Returns the key size in bits.

 Public Property Get KeySize ( ) As Long

Return Values

Long - The key size in bits.

Read/Write.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: KeySize (let)

KeySize

Sets the key size in bits.

 Public Property Let KeySize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new key size in bits.

Remarks

Key sizes of 128 or 192 are supported.

Read/Write.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: LegalBlockSizes (get)

LegalBlockSizes

Returns a list of legal block sizes.

 Public Property Get LegalBlockSizes ( ) As KeySizes ( )

Return Values

KeySizes() - A list of legal block sizes.

Remarks

Only one block size is legal, 64 bits.

Read Only.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: LegalKeySizes (get)

LegalKeySizes

Returns a list of valid key sizes supported by this algorithm.

 Public Property Get LegalKeySizes ( ) As KeySizes ( )

Return Values

KeySizes() - A list of valid key sizes.

Read Only.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: Mode (get)

Mode

Returns the Cipher mode this algorithm will use.

 Public Property Get Mode ( ) As CipherMode

Return Values

CipherMode - The Cipher mode.

Read/Write.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: Mode (let)

Mode

Sets the Cipher mode this algorithm will use.

 Public Property Let Mode(
      ByVal Value As CipherMode )

Parameters

Value
[ByVal] CipherMode. The cipher mode to use.

Read/Write.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: Padding (get)

Padding

Returns the padding mode being used.

 Public Property Get Padding ( ) As PaddingMode

Return Values

PaddingMode - The current padding mode.

Read/Write.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: Padding (let)

Padding

Sets the padding mode to be used.

 Public Property Let Padding(
      ByVal Value As PaddingMode )

Parameters

Value
[ByVal] PaddingMode. The new padding mode.

Read/Write.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: RC2

RC2

 Implements RC2

Return Values

RC2 -

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: SymmetricAlgorithm

SymmetricAlgorithm

 Implements SymmetricAlgorithm

Return Values

SymmetricAlgorithm -

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: UseSalt (get)

UseSalt

Returns if a salt value is to be used with the key generation.

 Public Property Get UseSalt ( ) As Boolean

Return Values

Boolean - Returns if the a salt value will be used.

Read/Write.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: UseSalt (let)

UseSalt

Sets if a salt value will be used with the key generation.

 Public Property Let UseSalt(
      ByVal Value As Boolean )

Parameters

Value
[ByVal] Boolean. Whether a salt value will be used with the key generation.

Read/Write.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2CryptoServiceProvider: ValidKeySize

ValidKeySize

Tests if a specific bit length is valid for a key.

 Public Function ValidKeySize(
      ByVal BitLength As Long ) As Boolean

Parameters

BitLength
[ByVal] Long. The number of bits to test for.

Return Values

Boolean - Return True if the number of bits is supported, False otherwise.

Remarks

Valid sizes are from 40 bits to 128 bits in steps of 8 bits.

See Also

Project CorLib Overview

Class RC2CryptoServiceProvider Overview


RC2Static

RC2Static

Provides static methods associated with the RC2 algorithm.

Public:

Methods:

Name | Description
Create | Creates an RC2 crypto service provider based on the name.

See Also

Project CorLib Overview

Class RC2Static Overview


RC2Static: Create

Create

Creates an RC2 crypto service provider based on the name.

 Public Function Create(
      Optional ByVal AlgName As String = "RC2" ) As RC2

Parameters

AlgName
[ByVal] Optional. String. The name of the algorithm implementation.

Default: "RC2"

Return Values

RC2 -

Remarks

The names "RC2" and "RC2CryptoServiceProvider" will return the default RC2CryptoServiceProvider.

See Also

Project CorLib Overview

Class RC2Static Overview


Registry

Registry

Supplies the base Registrykeys that access values and subkeys in the registry.

Public:

Properties:

Name | Description
ClassesRoot (get) | Returns a RegistryKey object that is then used to access registry keys and values for class types and their properties. The root section of the Registry accessed is HKEY_CLASSES_ROOT.
CurrentConfig (get) | Returns a RegistryKey object that is then used to access registry keys and values for the current configuration of hardware. This is not user specific data. The root section of the Registry accessed is HKEY_CURRENT_CONFIG.
CurrentUser (get) | Returns a RegistryKey object that is then used to access registry keys and values for information and preferences of the current user. The root section of the Registry accessed is HKEY_CURRENT_USER.
LocalMachine (get) | Returns a RegistryKey object that can be used to access information and preferences about the local user machine. The root section of the Registry accessed is HKEY_LOCAL_MACHINE.
PerformanceData (get) | Contains performance information for software components. This field reads the Windows registry base key HKEY_PERFORMANCE_DATA.
Users (get) | Contains information about the default user configuration. This field reads the Windows registry base key HKEY_USERS.

Methods:

Name | Description
GetValue | Returns a value from the registry key.
SetValue | Sets a value to a registry key, creating it if it does not exist.

Remarks

These are the base sets of root registry keys used to access different classes of registry keys.

To access these methods, use the Registry.* syntax:

     Dim Key As RegistryKey
     Set Key = Registry.ClassesRoot

See Also

Project CorLib Overview

Class Registry Overview

RegistryKey

RegistryKeyStatic


Registry: ClassesRoot (get)

ClassesRoot

Returns a RegistryKey object that is then used to access registry keys and values for class types and their properties. The root section of the Registry accessed is HKEY_CLASSES_ROOT.

 Public Property Get ClassesRoot ( ) As RegistryKey

Return Values

RegistryKey - Returns a Registrykey that is used to access the Class Root keys.

Read Only.

See Also

Project CorLib Overview

Class Registry Overview


Registry: CurrentConfig (get)

CurrentConfig

Returns a RegistryKey object that is then used to access registry keys and values for the current configuration of hardware. This is not user specific data. The root section of the Registry accessed is HKEY_CURRENT_CONFIG.

 Public Property Get CurrentConfig ( ) As RegistryKey

Return Values

RegistryKey -

Read Only.

See Also

Project CorLib Overview

Class Registry Overview


Registry: CurrentUser (get)

CurrentUser

Returns a RegistryKey object that is then used to access registry keys and values for information and preferences of the current user. The root section of the Registry accessed is HKEY_CURRENT_USER.

 Public Property Get CurrentUser ( ) As RegistryKey

Return Values

RegistryKey -

Read Only.

See Also

Project CorLib Overview

Class Registry Overview


Registry: GetValue

GetValue

Returns a value from the registry key.

 Public Function GetValue(
      ByRef KeyName As String,
      ByRef ValueName As String,
      Optional ByRef DefaultValue As Variant ) As Variant

Parameters

KeyName
[ByRef] String. The full registry key name that contains the value.
ValueName
[ByRef] String. The name of the value in the registry key.
DefaultValue
[ByRef] Optional. Variant. The value to return if the registry value does not exist.

Return Values

Variant - A value from the registry.

Remarks

A full registry key name must include the root level key.

 v = Registry.GetValue("HKEY_CURRENT_USER\Environment\", "TEMP")

See Also

Project CorLib Overview

Class Registry Overview


Registry: LocalMachine (get)

LocalMachine

Returns a RegistryKey object that can be used to access information and preferences about the local user machine. The root section of the Registry accessed is HKEY_LOCAL_MACHINE.

 Public Property Get LocalMachine ( ) As RegistryKey

Return Values

RegistryKey -

Read Only.

See Also

Project CorLib Overview

Class Registry Overview


Registry: PerformanceData (get)

PerformanceData

Contains performance information for software components. This field reads the Windows registry base key HKEY_PERFORMANCE_DATA.

 Public Property Get PerformanceData ( ) As RegistryKey

Return Values

RegistryKey -

Read Only.

See Also

Project CorLib Overview

Class Registry Overview


Registry: SetValue

SetValue

Sets a value to a registry key, creating it if it does not exist.

 Public Sub SetValue(
      ByRef KeyName As String,
      ByRef ValueName As String,
      ByRef Value As Variant )

Parameters

KeyName
[ByRef] String. The full registry key name to write the value to.
ValueName
[ByRef] String. The name of the value to be written in the key.
Value
[ByRef] Variant. The value to be written in the key.

Remarks

A full registry key name must include the root level key.

 Registry.SetValue "HKEY_CURRENT_USER\Environment\", "MyValue", "Hello"

See Also

Project CorLib Overview

Class Registry Overview


Registry: Users (get)

Users

Contains information about the default user configuration. This field reads the Windows registry base key HKEY_USERS.

 Public Property Get Users ( ) As RegistryKey

Return Values

RegistryKey -

Read Only.

See Also

Project CorLib Overview

Class Registry Overview


RegistryKey

RegistryKey

Represents a key level node inside the Windows Registry.

Implements:

IObject

Public:

Types:

Name | Description
RegistryValueKind | The value types that can be set and retrieved from the Registry.
RegistryValueOptions |

Properties:

Name | Description
Name (get) | Returns the name of the key.
SubKeyCount (get) | Returns the number of SubKeys within the current key.
ValueCount (get) | Returns the number of values within the current key.

Methods:

Name | Description
CloseKey | Closes the RegistryKey object.
CreateSubKey | Creates a new Windows Registry node.
DeleteSubKey | Deletes a node from the Windows Registry.
DeleteSubKeyTree | Deletes all SubKeys within the specified SubKey to delete.
DeleteValue | Deletes the value from the registry.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
Flush | Flushes any changes to the Windows Registry back to disk.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetLastWriteTime | Returns the last time the subkey was written to.
GetSubKeyNames | Returns a list of SubKey names within the current SubKey.
GetValue | Returns the value of a key within a SubKey.
GetValueKind | Returns the type of value stored in the registry.
GetValueNames | Returns a list of value names within the current SubKey.
OpenSubKey | Returns a RegistryKey of the requested SubKey with the write permission specified.
SetValue | Sets the value of a key value within the SubKey.
ToString | Returns a string representation of this object instance.

Remarks

This class allows for easy access and manipulation of keys and key values within the Windows Registry. By using a key naming convention similar to folders the keys and values can be traversed and modified.

There a set of Root nodes that separate the Registry to common areas for specific needs. The Root nodes are the starting place for any keys in the registry. A key name could look like HKEY_LOCAL_MACHINE\Software'.

 Iterate the values found in a registry key.

 Private Sub Main()
     Dim rk As RegistryKey
     Dim names() As String
     Dim i As Long

     ' Open a registry subkey for enumeration.
     Set rk = Registry.LocalMachine.OpenSubKey("software\microsoft\windows\currentversion\run")

     ' Retrieve all names for the values in the key.
     names = rk.GetValueNames

     ' enumerate the names and get the value for each,
     ' displaying the pair as [name] = [value].
     For i = 0 To UBound(names)
         Console.WriteLine "{0} = {1}", names(i), rk.GetValue(names(i))
     Next i

     ' Close the registry key.
     rk.CloseKey

     ' Wait for user to hit return.
     Console.ReadLine
 End Sub

 'This code produces the following output.
 'The list will vary from machine to machine.

 'CplBCL50 = C:\Program Files\EzButton\CplBCL50.EXE
 'ccApp = "C:\Program Files\Common Files\Symantec Shared\ccApp.exe"
 'Symantec NetDriver Monitor = C:\PROGRA~1\SYMNET~1\SNDMon.exe

See Also

Project CorLib Overview

Class RegistryKey Overview

Registry

RegistryKeyStatic


RegistryKey: CloseKey

CloseKey

Closes the RegistryKey object.

 Public Sub CloseKey ( )

Remarks

When the key is closed, then it can no longer be manipulated using the RegistryKey

If the RegistryKey is a system root key, then it will not be closed.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: CreateSubKey

CreateSubKey

Creates a new Windows Registry node.

 Public Function CreateSubKey(
      ByRef SubKey As String ) As RegistryKey

Parameters

SubKey
[ByRef] String. The name of the new node to be created. Any slashes will be trimmed from the ends.

Return Values

RegistryKey - A RegistryKey to manipulate the new Registry node.

Remarks

If the Registry node already exists, then it is returned.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: DeleteSubKey

DeleteSubKey

Deletes a node from the Windows Registry.

 Public Sub DeleteSubKey(
      ByRef SubKey As String,
      Optional ByVal ThrowOnMissingSubKey As Boolean = True )

Parameters

SubKey
[ByRef] String. The node to be deleted.
ThrowOnMissingSubKey
[ByVal] Optional. Boolean. Whether to throw an exception if the node was not found.

Default: True

Remarks

The key node must be empty to be deleted. No sub keys or values are deleted. To delete all SubKeys use the DeleteSubKeyTree to recursively delete SubKeys and values.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: DeleteSubKeyTree

DeleteSubKeyTree

Deletes all SubKeys within the specified SubKey to delete.

 Public Sub DeleteSubKeyTree(
      ByRef SubKey As String )

Parameters

SubKey
[ByRef] String. The Registry node to be deleted.

Remarks

All subkeys and values are deleted recursively. Caution should be used.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: DeleteValue

DeleteValue

Deletes the value from the registry.

 Public Sub DeleteValue(
      ByRef Name As String,
      Optional ByVal ThrowOnMissingValue As Boolean = True )

Parameters

Name
[ByRef] String. The name of the value to be deleted, or an empty string to delete the default value for the key.
ThrowOnMissingValue
[ByVal] Optional. Boolean. Whether to throw an exception if the value was not found.

Default: True

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: Flush

Flush

Flushes any changes to the Windows Registry back to disk.

 Public Sub Flush ( )

Remarks

Generally this does not need to be called. Windows writes back to the disk Registry at regular intervals and when the system shuts down. values of other keys written to the Registry may also be flushed back to disk as well.

Only call this function if it is absolutely necessary to be sure the data has been written to the Registry. Excessive calls to this function can impact system performance.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: GetLastWriteTime

GetLastWriteTime

Returns the last time the subkey was written to.

 Public Function GetLastWriteTime ( ) As CorDateTime

Return Values

CorDateTime - A CorDateTime object.

Remarks

This method returns CorDateTime.MinValue on Windows 95,98 and ME.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: GetSubKeyNames

GetSubKeyNames

Returns a list of SubKey names within the current SubKey.

 Public Function GetSubKeyNames ( ) As String ( )

Return Values

String() - The list of SubKeys.

Remarks

Values within the SubKey are not included in the list.

If no SubKeys exist then a zero-length array is returned.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: GetValue

GetValue

Returns the value of a key within a SubKey.

 Public Function GetValue(
      ByRef Name As String,
      Optional ByRef Default As Variant,
      Optional ByVal Options As RegistryValueOptions ) As Variant

Parameters

Name
[ByRef] String. The name of the value to retrieve, or an empty string to retrieve the key default value.
Default
[ByRef] Optional. Variant. The value to be returned if the key name was not found.
Options
[ByVal] Optional. RegistryValueOptions. Additional options on how to handle how data is handled when reading from the key.

Return Values

Variant - The value found in the Registry, or Empty if the value does not exist.

Remarks

RegistryKey supports the return of 6 different key value types.
REG_DWORD (Integer numbers)
REG_QWORD (64-bit integer)
REG_BINARY (Byte arrays)
REG_SZ (Strings)
REG_MULTI_SZ (String arrays)
REG_EXPAND_SZ (String containing an environment variable)
The specific type will be created and returned based on the type in the registry.

If retrieving a REG_QWORD, a vbCurrency variable is returned to represent the 64-bit value. This means that the value will have the bias of being divided by 10000. To get the true 64-bit value, the vbCurrency value will need to be multiplied by 10000. The result may be an overflow.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: GetValueKind

GetValueKind

Returns the type of value stored in the registry.

 Public Function GetValueKind(
      ByRef Name As String ) As RegistryValueKind

Parameters

Name
[ByRef] String. The name of the value to get the type of.

Return Values

RegistryValueKind - The type of value in the registry.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: GetValueNames

GetValueNames

Returns a list of value names within the current SubKey.

 Public Function GetValueNames ( ) As String ( )

Return Values

String() - The list of value names.

Remarks

SubKeys within the SubKey are not included in the list.

Bad Spec: The MSDN says that if a default value exists, it will not be included as part of the names returned. However, a simple test in Dot NET shows that the default is included in the list. An empty string is the name of the default value. We include the default name ("") in the returned list.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: Name (get)

Name

Returns the name of the key.

 Public Property Get Name ( ) As String

Return Values

String - The name of the key.

Read Only.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: OpenSubKey

OpenSubKey

Returns a RegistryKey of the requested SubKey with the write permission specified.

 Public Function OpenSubKey(
      ByRef Name As String,
      Optional ByVal Writable As Boolean = False ) As RegistryKey

Parameters

Name
[ByRef] String. The name of the SubKey to be opened. Any slashes will will be trimmed from both ends.
Writable
[ByVal] Optional. Boolean. The permission to modify the opened SubKey.

Default: False

Return Values

RegistryKey - A new RegistryKey of the opened SubKey.

Remarks

The requested SubKey is opened starting at the location of the current RegistryKey node within the Registry.

If the requested SubKey was not found, then Nothing is returned. No error is thrown.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: RegistryValueKind

RegistryValueKind

The value types that can be set and retrieved from the Registry.

 Public Enum RegistryValueKind

Values

UnknownKind = 0
Determines the value type based on the variable type or registry setting.
StringKind = 1
Attempts to set or retrieve the value as a string.
DWordKind = 4
Attempts to set or retrieve the value as a DWord (Long).
BinaryKind = 3
Attempts to set or retrieve the value as a Byte array.
MultiStringKind = 7
Attempts to set or retrieve the value as a String array.
ExpandStringKind = 2
Attempts to set or retrieve the value as an expandable string.
QWordKind = 11
Attempts to set or retrieve the value as a 64-bit value.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: SetValue

SetValue

Sets the value of a key value within the SubKey.

 Public Sub SetValue(
      ByRef Name As String,
      ByRef Value As Variant,
      Optional ByVal ValueKind As RegistryValueKind = UnknownKind )

Parameters

Name
[ByRef] String. The name of the value to set, or an empty string to set the key default value.
Value
[ByRef] Variant. The value to write to the Registry.
ValueKind
[ByVal] Optional. RegistryValueKind. The type of value to be written to the registry.

Default: UnknownKind

Remarks

The registry can hold several types of data. RegistryKey supports many data types.
REG_DWORD (Integer numbers)
REG_QWORD (64-bit integer)
REG_BINARY (Byte arrays)
REG_SZ (Strings)
REG_MULTI_SZ (String arrays)
REG_EXPAND_SZ (Expandable string)

Another value type is any class that implements the cObject interface. The ToString method is used to write the string representation to the Registry. This makes it easy to write such values as cDateTime with ease.

If saving as a REG_QWORD then numeric values passed in may be adjusted to and mapped to an internal vbCurrency datatype to represent the 64-bit value accurately in the registry. If a vbLong value of 1 is passed in, then it will be set to a vbCurrency value of 0.0001. This will give the proper bit alignment with the 64-bit registry value. In order to avoid having the value mapped to a vbCurrency, pass the value in as a vbCurrency. In this case, the value is not changed and the 64-bits are saved to the registry as is. A vbCurrency of 1 will be saved to the registry as is, not as 0.0001.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: SubKeyCount (get)

SubKeyCount

Returns the number of SubKeys within the current key.

 Public Property Get SubKeyCount ( ) As Long

Return Values

Long - The number of SubKeys.

Read Only.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKey: ValueCount (get)

ValueCount

Returns the number of values within the current key.

 Public Property Get ValueCount ( ) As Long

Return Values

Long -

Remarks

The number of values.

Read Only.

See Also

Project CorLib Overview

Class RegistryKey Overview


RegistryKeyStatic

RegistryKeyStatic

Provides static methods for the RegistryKey class.

Public:

Types:

Name | Description
RegistryHive | The root registry key to open on the remote machine.

Methods:

Name | Description
OpenRemoteBaseKey | Connects to a Registry on a remote machine and returns a RegistryKey to the specified registry key on that machine.

Remarks

This class cannot be directly instantiated. To access the methods, use the variable name directly.

 Dim Key As RegistryKey
 Set Key = RegistryKey.OpenRemoteBaseKey(LocalMachine, "RemoteName")

See Also

Project CorLib Overview

Class RegistryKeyStatic Overview

Registry

PublicFunctions


RegistryKeyStatic: OpenRemoteBaseKey

OpenRemoteBaseKey

Connects to a Registry on a remote machine and returns a RegistryKey to the specified registry key on that machine.

 Public Function OpenRemoteBaseKey(
      ByVal hKey As RegistryHive,
      ByVal MachineName As String ) As RegistryKey

Parameters

hKey
[ByVal] RegistryHive. The registry key on the remote machine to open.
MachineName
[ByVal] String. The name of the remote machine.

Return Values

RegistryKey - A RegistryKey connected to the registry of a remote machine.

Remarks

If the MachineName is an empty String, then the registry of the local machine is opened.

See Also

Project CorLib Overview

Class RegistryKeyStatic Overview


RegistryKeyStatic: RegistryHive

RegistryHive

The root registry key to open on the remote machine.

 Public Enum RegistryHive

Values

ClassesRoot = &H80000000
Specifies the HKEY_CLASSES_ROOT key.
CurrentConfig = &H80000005
Specifies the HKEY_CURRENT_CONFIG key.
CurrentUser = &H80000001
Specifies the HKEY_CURRENT_USER key.
LocalMachine = &H80000002
Specifies the HKEY_LOCAL_MACHINE key.
Users = &H80000003
Specifies The HKEY_USERS key.
PerformanceData = &H80000004
Specifies the HKEY_PERFORMANCE_DATA key.

See Also

Project CorLib Overview

Class RegistryKeyStatic Overview


ResourceKey

ResourceKey

This class represents a Resource key by containing the 3 primary identifiers for a Windows resource.

Implements:

IObject

Public:

Types:

Name | Description
ResourceTypes | The type of resources acknowledged by Windows. These are used when a resource type is requested in function calls.

Properties:

Name | Description
LanguageID (get) | Returns the language this resource is identified with.
ResourceName (get) | Returns the Name or ID of the resource.
ResourceType (get) | Returns the Name or ID of the resource type.

Methods:

Name | Description
Equals | Determines if this object and the value are equal.
GetHashCode | Returns a pseudo-unique hashcode that represents this object.
ToString | Returns a String representation of this object.

Remarks

A Windows resource uses up to 3 identifying values that when combined are unique within the specific resource set. The LanguageID, ResourceName, and ResourceType are combined to create a single unique identifier for a Windows resource.

See Also

Project CorLib Overview

Class ResourceKey Overview


ResourceKey: Equals

Equals

Determines if this object and the value are equal.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare to this object instance.

Return Values

Boolean - Returns True if the value and object are equal, otherwise False.

Remarks

The value is equal if it is a ResourceKey with the same LanguageID, ResourceName, and ResourceType.

See Also

Project CorLib Overview

Class ResourceKey Overview


ResourceKey: GetHashCode

GetHashCode

Returns a pseudo-unique hashcode that represents this object.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A pseudo-unique hashcode that represents this object.

Remarks

The LanguageID, ResourceName, and ResourceType are all used to create the hashcode.

See Also

Project CorLib Overview

Class ResourceKey Overview


ResourceKey: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class ResourceKey Overview


ResourceKey: LanguageID (get)

LanguageID

Returns the language this resource is identified with.

 Public Property Get LanguageID ( ) As Long

Return Values

Long - The LCID or language ID for this resource.

Read Only.

See Also

Project CorLib Overview

Class ResourceKey Overview


ResourceKey: ResourceName (get)

ResourceName

Returns the Name or ID of the resource.

 Public Property Get ResourceName ( ) As Variant

Return Values

Variant -

Remarks

A resource can have an identification as either a string name or a numeric value. A string name of "101" is not the same as a numeric value of 101.

Read Only.

See Also

Project CorLib Overview

Class ResourceKey Overview


ResourceKey: ResourceType (get)

ResourceType

Returns the Name or ID of the resource type.

 Public Property Get ResourceType ( ) As Variant

Return Values

Variant - A String or Numeric value.

Remarks

A resource can be a type that is defined by the system. A system type is numeric. A custom resource type usually uses a name for the type.

Read Only.

See Also

Project CorLib Overview

Class ResourceKey Overview


ResourceKey: ResourceTypes

ResourceTypes

The type of resources acknowledged by Windows. These are used when a resource type is requested in function calls.

 Public Enum ResourceTypes

Values

CursorResource = 1
A Windows cursor resource type.
BitmapResource = 2
A bitmap resource type.
IconResource = 3
An icon resource type.
MenuResource = 4
A menu set resource type.
DialogBox = 5
A dialog box resource type.
StringResource = 6
A String resource type.
FontDirectory = 7
A font directory resource type.
FontResource = 8
A font resource type.
AcceleratorTable = 9
An accelerator table resource type.
UserDefined = 10
A user-defined resource type.
GroupCursor = 12
A group cursor resource type.
GroupIcon = 14
A group icon resource type.
VersionResource = 16
A version resource type.
DialogInclude = 17
A dialog include resource type.
PlugPlay = 19
A plug-n-play resource type.
VXD = 20
A VXD resource type.
AniCursor = 21
An animated cursor resource type.
AniIcon = 22
An animated icon resource type.
HTML = 23
An html resource type.

See Also

Project CorLib Overview

Class ResourceKey Overview


ResourceKey: ToString

ToString

Returns a String representation of this object.

 Public Function ToString ( ) As String

Return Values

String - A String representation of this object.

See Also

Project CorLib Overview

Class ResourceKey Overview


ResourceManager

ResourceManager

Provides convenient access to culture-specific resources at runtime.

Implements:

IEnumerable
IObject

Public:

Methods:

Name | Description
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetEnumerator | Returns an enumerator used to iterate through all resources for all cultures.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetObject | Returns a resource from the specified culture.
GetResourceSet | Returns a set of resources for a specific culture.
GetString | Returns a resource string for the specific culture.
ReleaseAllResources | Releases all resources.
ToString | Returns a string representation of this object instance.

Remarks

A ResourceManager contains all resources for all of the cultures found using an IResourceReader object or a .RES filename.

To load the resources from multiple .RES files, use ResourceManager.CreateFileBasedResourceManager.

See Also

Project CorLib Overview

Class ResourceManager Overview

Constructors

ResourceManagerStatic

ResourceReader

WinResourceReader

IResourceReader

Win32Resource


ResourceManager: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class ResourceManager Overview


ResourceManager: GetEnumerator

GetEnumerator

Returns an enumerator used to iterate through all resources for all cultures.

 Public Function GetEnumerator ( ) As IDictionaryEnumerator

Return Values

IDictionaryEnumerator - An IDictionaryEnumerator object.

Remarks

The enumerator returns DictionaryEntry objects. The Key contains the Culture ID. The Value contains the ResourceSet for that specific culture.

See Also

Project CorLib Overview

Class ResourceManager Overview


ResourceManager: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class ResourceManager Overview


ResourceManager: GetObject

GetObject

Returns a resource from the specified culture.

 Public Function GetObject(
      ByRef ResourceName As Variant,
      ByRef ResourceType As Variant,
      Optional ByRef CultureID As Variant ) As Variant

Parameters

ResourceName
[ByRef] Variant. The resource identifier.
ResourceType
[ByRef] Variant. The type of resource to search for.
CultureID
[ByRef] Optional. Variant. A CultureInfo object or Culture ID. The current culture is used if this parameter is missing.

Return Values

Variant - The resource value, or Empty if the resourse was not found.

See Also

Project CorLib Overview

Class ResourceManager Overview


ResourceManager: GetResourceSet

GetResourceSet

Returns a set of resources for a specific culture.

 Public Function GetResourceSet(
      ByRef CultureID As Variant ) As ResourceSet

Parameters

CultureID
[ByRef] Variant. A CultureInfo object or Culture ID. The current culture is used if this parameter is missing.

Return Values

ResourceSet - A set of resources for a specific culture, or Nothing if not found.

See Also

Project CorLib Overview

Class ResourceManager Overview


ResourceManager: GetString

GetString

Returns a resource string for the specific culture.

 Public Function GetString(
      ByRef ResourceName As Variant,
      Optional ByRef CultureID As Variant ) As String

Parameters

ResourceName
[ByRef] Variant. The resource ID.
CultureID
[ByRef] Optional. Variant. A CultureInfo object or Culture ID. The current culture is used if this parameter is missing.

Return Values

String - The resource as a String, or an empty string if the resource was not found.

See Also

Project CorLib Overview

Class ResourceManager Overview


ResourceManager: IEnumerable

IEnumerable

 Implements IEnumerable

Return Values

IEnumerable -

See Also

Project CorLib Overview

Class ResourceManager Overview


ResourceManager: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class ResourceManager Overview


ResourceManager: ReleaseAllResources

ReleaseAllResources

Releases all resources.

 Public Sub ReleaseAllResources ( )

See Also

Project CorLib Overview

Class ResourceManager Overview


ResourceManager: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class ResourceManager Overview


ResourceManagerStatic

ResourceManagerStatic

Provides static methods for the ResourceManager object.

Public:

Methods:

Name | Description
CreateFileBasedResourceManager | Creates a ResourceManager from a set of .RES files found in the ResourceDir.

Remarks

To access these methods, use the ResourceManager.* syntax.

See Also

Project CorLib Overview

Class ResourceManagerStatic Overview


ResourceManagerStatic: CreateFileBasedResourceManager

CreateFileBasedResourceManager

Creates a ResourceManager from a set of .RES files found in the ResourceDir.

 Public Function CreateFileBasedResourceManager(
      ByRef ResourceDir As String,
      Optional ByRef SearchPattern As String = "*" ) As ResourceManager

Parameters

ResourceDir
[ByRef] String. The folder containing the .RES files.
SearchPattern
[ByRef] Optional. String. The pattern used to match .RES files.

Default: "*"

Return Values

ResourceManager - A ResourceManager contain resources from a set of .RES files.

Remarks

To load a single specific .RES file use the Cor.NewResourceManager method.

See Also

Project CorLib Overview

Class ResourceManagerStatic Overview

Constructors

ResourceManager


ResourceReader

ResourceReader

Provides a means to iterate through the resources in a .RES file.

Implements:

IEnumerable
IObject
IResourceReader

Public:

Methods:

Name | Description
AddDecoder | Adds additional resource decoders to interpret binary data that is unknown to the ResourceReader.
CloseReader | Closes the reader and releases any resources.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetEnumerator | Returns an IDictionaryEnumerator object.
GetHashCode | Returns a pseudo-unique number identifying this instance.
ToString | Returns a string representation of this object instance.

Remarks

The only resource types recognized are Strings, Icons, Cursors, and Bitmaps. All other resource types are contained as a byte array.

Pass this object into the ResourceManager constructor to access specific resources based on ID, Type, and Culture. Or pass this object into a ResourceSet to retrieve the resources for a specific culture.

See Also

Project CorLib Overview

Class ResourceReader Overview

Constructors

ResourceManager

ResourceSet

IResourceReader

Win32Resource


ResourceReader: AddDecoder

AddDecoder

Adds additional resource decoders to interpret binary data that is unknown to the ResourceReader.

 Public Sub AddDecoder(
      ByVal DecoderToAdd As IResourceDecoder )

Parameters

DecoderToAdd
[ByVal] IResourceDecoder. A resource decoder associated with a specific resource type.

Remarks

This allows the ResourceReader to be extended to handle additional resource types. If no decoder exists for the specific resource type, then the raw data is returned in a Byte array.

Resource types can be identified by either a numeric value, or a string name.

See Also

Project CorLib Overview

Class ResourceReader Overview


ResourceReader: CloseReader

CloseReader

Closes the reader and releases any resources.

 Public Sub CloseReader ( )

Remarks

CloseReader can be called safely multiple times.

See Also

Project CorLib Overview

Class ResourceReader Overview


ResourceReader: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class ResourceReader Overview


ResourceReader: GetEnumerator

GetEnumerator

Returns an IDictionaryEnumerator object.

 Public Function GetEnumerator ( ) As IDictionaryEnumerator

Return Values

IDictionaryEnumerator - An enumerator.

Remarks

The enumerator returns values as DictionaryEntry objects. The value property in the DictionaryEntry object returns a Win32Resource object which contains details about the specific resource found in the .RES file. The Key property returns the ID for the specific resource. The Keys may not be unique across all resources, os using the Key as a unique identifier is not recommended.

See Also

Project CorLib Overview

Class ResourceReader Overview


ResourceReader: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class ResourceReader Overview


ResourceReader: IEnumerable

IEnumerable

 Implements IEnumerable

Return Values

IEnumerable -

See Also

Project CorLib Overview

Class ResourceReader Overview


ResourceReader: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class ResourceReader Overview


ResourceReader: IResourceReader

IResourceReader

 Implements IResourceReader

Return Values

IResourceReader -

See Also

Project CorLib Overview

Class ResourceReader Overview


ResourceReader: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class ResourceReader Overview


ResourceSet

ResourceSet

Stores all the resources localized for one particular culture, ignoring all other cultures.

Implements:

IEnumerable
IObject

Public:

Properties:

Name | Description
LanguageID (get) | Returns the Culture ID for the specific set of resources.

Methods:

Name | Description
CloseResourceSet | Closes the resource set.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetDefaultReader | Returns the name of the type of resource reader to use with this specific ResourceSet.
GetDefaultWriter | Returns the name of the type of resource writer to use with this specific ResourceSet
GetEnumerator | Returns an enumerator to iterate through all resources within the resource set.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetObject | Returns the resource specified.
GetString | Returns a String resource from the set.
ToString | Returns a string representation of this object instance.

Remarks

This can be constructed using a .RES filename, a .RES formatted Stream, or an IResourceReader object.

See Also

Project CorLib Overview

Class ResourceSet Overview

Constructors

ResourceReader

WinResourceReader

ResourceManager

Win32Resource


ResourceSet: CloseResourceSet

CloseResourceSet

Closes the resource set.

 Public Sub CloseResourceSet ( )

See Also

Project CorLib Overview

Class ResourceSet Overview


ResourceSet: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class ResourceSet Overview


ResourceSet: GetDefaultReader

GetDefaultReader

Returns the name of the type of resource reader to use with this specific ResourceSet.

 Public Function GetDefaultReader ( ) As String

Return Values

String - The name of a resource reader type.

See Also

Project CorLib Overview

Class ResourceSet Overview


ResourceSet: GetDefaultWriter

GetDefaultWriter

Returns the name of the type of resource writer to use with this specific ResourceSet

 Public Function GetDefaultWriter ( ) As String

Return Values

String - The name of a resource writer type.

See Also

Project CorLib Overview

Class ResourceSet Overview


ResourceSet: GetEnumerator

GetEnumerator

Returns an enumerator to iterate through all resources within the resource set.

 Public Function GetEnumerator ( ) As IDictionaryEnumerator

Return Values

IDictionaryEnumerator - An enumerator.

Remarks

The enumerator returns values as DictionaryEntry objects. The value property in the DictionaryEntry object returns a Win32Resource object which contains details about the specific resource found in the .RES file. The Key property returns the ID for the specific resource.

See Also

Project CorLib Overview

Class ResourceSet Overview


ResourceSet: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class ResourceSet Overview


ResourceSet: GetObject

GetObject

Returns the resource specified.

 Public Function GetObject(
      ByRef ResourceName As Variant,
      ByRef ResourceType As Variant ) As Variant

Parameters

ResourceName
[ByRef] Variant. The resource identifier.
ResourceType
[ByRef] Variant. The type of resource to search for.

Return Values

Variant - The resource value, or Empty if the resource was not found.

Remarks

The ResType can be either a String of the type of resource or a ResourceTypes enum value.

See Also

Project CorLib Overview

Class ResourceSet Overview


ResourceSet: GetString

GetString

Returns a String resource from the set.

 Public Function GetString(
      ByRef ResourceName As Variant ) As String

Parameters

ResourceName
[ByRef] Variant. The string identifier.

Return Values

String - A resource string, or an empty string if not found.

See Also

Project CorLib Overview

Class ResourceSet Overview


ResourceSet: IEnumerable

IEnumerable

 Implements IEnumerable

Return Values

IEnumerable -

See Also

Project CorLib Overview

Class ResourceSet Overview


ResourceSet: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class ResourceSet Overview


ResourceSet: LanguageID (get)

LanguageID

Returns the Culture ID for the specific set of resources.

 Public Property Get LanguageID ( ) As Long

Return Values

Long - The culture ID.

Read/Write.

See Also

Project CorLib Overview

Class ResourceSet Overview


ResourceSet: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class ResourceSet Overview


ResourceWriter

ResourceWriter

Writes encoded resources out to a .RES file.

Implements:

IObject
IResourceWriter

Public:

Methods:

Name | Description
AddEncoder | Allows additional encoders to be added to the writer to encode additional datatypes to be written to a .RES file.
AddResource | Adds a new value to the writer.
CloseWriter | Closes the writer.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
Generate | Creates a .RES file from the added resources.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

See Also

Project CorLib Overview

Class ResourceWriter Overview


ResourceWriter: AddEncoder

AddEncoder

Allows additional encoders to be added to the writer to encode additional datatypes to be written to a .RES file.

 Public Sub AddEncoder(
      ByVal EncoderToAdd As IResourceEncoder )

Parameters

EncoderToAdd
[ByVal] IResourceEncoder. The encodoer to be added to the writer.

Remarks

The encoder is inserted at the beginning of an internal list. This gives the most recent encoders first chance at encoding values.

See Also

Project CorLib Overview

Class ResourceWriter Overview


ResourceWriter: AddResource

AddResource

Adds a new value to the writer.

 Public Sub AddResource(
      ByRef Value As Variant,
      ByRef ResourceName As Variant,
      Optional ByRef ResourceType As Variant,
      Optional ByRef LanguageID As Variant )

Parameters

Value
[ByRef] Variant. The value to be added to a .RES file.
ResourceName
[ByRef] Variant. The identifier of the value. Can be a string or number.
ResourceType
[ByRef] Optional. Variant. The type of resource being writting.
LanguageID
[ByRef] Optional. Variant. The Locale ID associated with the resource.

See Also

Project CorLib Overview

Class ResourceWriter Overview


ResourceWriter: CloseWriter

CloseWriter

Closes the writer.

 Public Sub CloseWriter ( )

See Also

Project CorLib Overview

Class ResourceWriter Overview


ResourceWriter: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare with this instance.

Return Values

Boolean - Returns True if the value equals this instance, False otherwise.

See Also

Project CorLib Overview

Class ResourceWriter Overview


ResourceWriter: Generate

Generate

Creates a .RES file from the added resources.

 Public Sub Generate ( )

See Also

Project CorLib Overview

Class ResourceWriter Overview


ResourceWriter: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a hashcode value.

See Also

Project CorLib Overview

Class ResourceWriter Overview


ResourceWriter: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class ResourceWriter Overview


ResourceWriter: IResourceWriter

IResourceWriter

 Implements IResourceWriter

Return Values

IResourceWriter -

See Also

Project CorLib Overview

Class ResourceWriter Overview


ResourceWriter: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class ResourceWriter Overview


Rfc2898DeriveBytes

Rfc2898DeriveBytes

Implements password-based key derivation functionality, PBKDF2, by using a pseudo-random number generator based on HMACSHA1.

Implements:

IObject

Public:

Properties:

Name | Description
IterationCount (get) | Gets the number of iterations for the operation.
IterationCount (let) | Sets the number of iterations for the operation.
Salt (get) | Gets the key salt value for the operation.
Salt (let) | Sets the key salt value for the operation.

Methods:

Name | Description
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetBytes | Returns the pseudo-random key for this object.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function. An override might be necessary if the hashcode should be derived from a value contained within the class.
Reset | Resets the state of the operation.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides. A Person class may return the persons name instead.

Remarks

An Rfc2898DeriveBytes instance can be created using the NewRfc2898DeriveBytes constructor.

Rfc2898DeriveBytes takes a password, a salt, and an iteration count, and then generates keys through calls to the GetBytes method.

RFC 2898 includes methods for creating a key and initialization vector (IV) from a password and salt. You can use PBKDF2, a password-based key derivation function, to derive keys using a pseudo-random function that allows keys of virtually unlimited length to be generated. The Rfc2898DeriveBytes class can be used to produce a derived key from a base key and other parameters. In a password-based key derivation function, the base key is a password and the other parameters are a salt value and an iteration count.

Examples

The following code example uses the Rfc2898DeriveBytes class to create two identical keys for the TripleDES class. It then encrypts and decrypts some data using the keys.

Public Sub Main()
    Const Pwd1 As String = "Simple Password"
    Dim Salt1(8) As Byte
    Dim RngCsp As New RNGCryptoServiceProvider

    RngCsp.GetBytes Salt1

    ' Data1 can be a string or contents of a file.
    Const Data1 As String = "Some test data"

    ' The default iteration count is 1000 so the two methods use the same iteration count.
    Const MyIterations As Long = 1000

    On Error GoTo Catch

    Dim K1 As Rfc2898DeriveBytes
    Dim K2 As Rfc2898DeriveBytes

    Set K1 = NewRfc2898DeriveBytes(Pwd1, Salt1, MyIterations)
    Set K2 = NewRfc2898DeriveBytes(Pwd1, Salt1)

    ' Encrypt the data.
    Dim EncAlg As TripleDES
    Dim EncryptionStream As New MemoryStream
    Dim Encrypt As CryptoStream
    Dim UtfD1() As Byte

    Set EncAlg = TripleDES.Create()
    EncAlg.Key = K1.GetBytes(16)
    Set Encrypt = NewCryptoStream(EncryptionStream, EncAlg.CreateEncryptor(), CryptoStreamMode.WriteMode)
    UtfD1 = NewUTF8Encoding(False).GetBytes(Data1)

    Encrypt.WriteBlock UtfD1, 0, CorArray.Length(UtfD1)
    Encrypt.FlushFinalBlock
    Encrypt.CloseStream

    Dim EData1() As Byte
    EData1 = EncryptionStream.ToArray()
    K1.Reset

    ' Try to decrypt, thus showing it can be round-tripped.
    Dim DecAlg As TripleDES
    Dim DecryptionStreamBacking As New MemoryStream
    Dim Decrypt As CryptoStream

    Set DecAlg = TripleDES.Create()
    DecAlg.Key = K2.GetBytes(16)
    DecAlg.IV = EncAlg.IV

    Set Decrypt = NewCryptoStream(DecryptionStreamBacking, DecAlg.CreateDecryptor(), CryptoStreamMode.WriteMode)
    Decrypt.WriteBlock EData1, 0, CorArray.Length(EData1)
    Decrypt.Flush
    Decrypt.CloseStream
    K2.Reset

    Dim Data2 As String
    Data2 = NewUTF8Encoding(False).GetString(DecryptionStreamBacking.ToArray())

    If Data1 <> Data2 Then
        Debug.Print "Error: The two values are not equal."
    Else
        Debug.Print "The two values are equal."
        Debug.Print CorString.Format("K1 iterations: {0}", K1.IterationCount)
        Debug.Print CorString.Format("K2 iterations: {0}", K2.IterationCount)
    End If

    Exit Sub

Catch:
    Dim Ex As Exception

    Catch Ex, Err
    Debug.Print Ex.ToString
End Sub

' This example code produces the following output.
'
'    The two values are equal.
'    K1 iterations: 1000
'    K2 iterations: 1000

See Also

Project CorLib Overview

Class Rfc2898DeriveBytes Overview

Constructors


Rfc2898DeriveBytes: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test for equality.

Return Values

Boolean -

See Also

Project CorLib Overview

Class Rfc2898DeriveBytes Overview


Rfc2898DeriveBytes: GetBytes

GetBytes

Returns the pseudo-random key for this object.

 Public Function GetBytes(
      ByVal cb As Long ) As Byte ( )

Parameters

cb
[ByVal] Long. The number of pseudo-random key bytes to generate.

Return Values

Byte() - A byte array filled with pseudo-random key bytes.

Remarks

The Rfc2898DeriveBytes class implements PBKDF2 functionality by using a pseudorandom number generator based on HMACSHA1. The Rfc2898DeriveBytes class takes a password, a salt, and an iteration count, and then generates keys through calls to the GetBytes method. Repeated calls to this method will not generate the same key; instead, appending two calls of the GetBytes method with a cb parameter value of 20 is the equivalent of calling the GetBytes method once with a cb parameter value of 40.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | cb is out of range. This parameter requires a non-negative number.

Examples

The following example shows how to use the GetBytes method to get the key for an instance of Rfc2898DeriveBytes. This code example is part of a larger example provided for the Rfc2898DeriveBytes class.

    On Error GoTo Catch

    Dim K1 As Rfc2898DeriveBytes
    Dim K2 As Rfc2898DeriveBytes

    Set K1 = NewRfc2898DeriveBytes(Pwd1, Salt1, MyIterations)
    Set K2 = NewRfc2898DeriveBytes(Pwd1, Salt1)

    ' Encrypt the data.
    Dim EncAlg As TripleDES
    Dim EncryptionStream As New MemoryStream
    Dim Encrypt As CryptoStream
    Dim UtfD1() As Byte

    Set EncAlg = TripleDES.Create()
    EncAlg.Key = K1.GetBytes(16)
    Set Encrypt = NewCryptoStream(EncryptionStream, EncAlg.CreateEncryptor(), CryptoStreamMode.WriteMode)
    UtfD1 = NewUTF8Encoding(False).GetBytes(Data1)

See Also

Project CorLib Overview

Class Rfc2898DeriveBytes Overview


Rfc2898DeriveBytes: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

An override might be necessary if the hashcode should be derived from a value contained within the class.

 Public Function GetHashCode ( ) As Long

Return Values

Long -

See Also

Project CorLib Overview

Class Rfc2898DeriveBytes Overview


Rfc2898DeriveBytes: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class Rfc2898DeriveBytes Overview


Rfc2898DeriveBytes: IterationCount (get)

IterationCount

Gets the number of iterations for the operation.

 Public Property Get IterationCount ( ) As Long

Return Values

Long - The number of iterations for the operation.

Remarks

Iteration count is the number of times an operation is performed. For this method, the count should be greater than zero.The minimum recommended number of iterations is 1000.

Read/Write.

Examples

The following example shows how to use the IterationCount property to display the number of iterations used in the generation of the key. This code example is part of a larger example provided for the Rfc2898DeriveBytes class.

    ' The default iteration count is 1000 so the two methods use the same iteration count.
    Const MyIterations As Long = 1000

    On Error GoTo Catch

    Dim K1 As Rfc2898DeriveBytes
    Dim K2 As Rfc2898DeriveBytes

    Set K1 = NewRfc2898DeriveBytes(Pwd1, Salt1, MyIterations)
    Set K2 = NewRfc2898DeriveBytes(Pwd1, Salt1)

    ' Encrypt the data.
    Dim EncAlg As TripleDES
    Dim EncryptionStream As New MemoryStream
    Dim Encrypt As CryptoStream
    Dim UtfD1() As Byte

    Set EncAlg = TripleDES.Create()
    EncAlg.Key = K1.GetBytes(16)
    Set Encrypt = NewCryptoStream(EncryptionStream, EncAlg.CreateEncryptor(), CryptoStreamMode.WriteMode)
    UtfD1 = NewUTF8Encoding(False).GetBytes(Data1)

    Encrypt.WriteBlock UtfD1, 0, CorArray.Length(UtfD1)
    Encrypt.FlushFinalBlock
    Encrypt.CloseStream

    Dim EData1() As Byte
    EData1 = EncryptionStream.ToArray()
    K1.Reset

    ' Try to decrypt, thus showing it can be round-tripped.
    Dim DecAlg As TripleDES
    Dim DecryptionStreamBacking As New MemoryStream
    Dim Decrypt As CryptoStream

    Set DecAlg = TripleDES.Create()
    DecAlg.Key = K2.GetBytes(16)
    DecAlg.IV = EncAlg.IV

    Set Decrypt = NewCryptoStream(DecryptionStreamBacking, DecAlg.CreateDecryptor(), CryptoStreamMode.WriteMode)
    Decrypt.WriteBlock EData1, 0, CorArray.Length(EData1)
    Decrypt.Flush
    Decrypt.CloseStream
    K2.Reset

    Dim Data2 As String
    Data2 = NewUTF8Encoding(False).GetString(DecryptionStreamBacking.ToArray())

    If Data1 <> Data2 Then
        Debug.Print "Error: The two values are not equal."
    Else
        Debug.Print "The two values are equal."
        Debug.Print CorString.Format("K1 iterations: {0}", K1.IterationCount)
        Debug.Print CorString.Format("K2 iterations: {0}", K2.IterationCount)
    End If

See Also

Project CorLib Overview

Class Rfc2898DeriveBytes Overview


Rfc2898DeriveBytes: IterationCount (let)

IterationCount

Sets the number of iterations for the operation.

 Public Property Let IterationCount(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The number of iterations for the operation.

Remarks

Iteration count is the number of times an operation is performed. For this method, the count should be greater than zero.The minimum recommended number of iterations is 1000.

Read/Write.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | The number of iterations is less than 1.

Examples

The following example shows how to use the IterationCount property to display the number of iterations used in the generation of the key. This code example is part of a larger example provided for the Rfc2898DeriveBytes class.

    ' The default iteration count is 1000 so the two methods use the same iteration count.
    Const MyIterations As Long = 1000

    On Error GoTo Catch

    Dim K1 As Rfc2898DeriveBytes
    Dim K2 As Rfc2898DeriveBytes

    Set K1 = NewRfc2898DeriveBytes(Pwd1, Salt1, MyIterations)
    Set K2 = NewRfc2898DeriveBytes(Pwd1, Salt1)

    ' Encrypt the data.
    Dim EncAlg As TripleDES
    Dim EncryptionStream As New MemoryStream
    Dim Encrypt As CryptoStream
    Dim UtfD1() As Byte

    Set EncAlg = TripleDES.Create()
    EncAlg.Key = K1.GetBytes(16)
    Set Encrypt = NewCryptoStream(EncryptionStream, EncAlg.CreateEncryptor(), CryptoStreamMode.WriteMode)
    UtfD1 = NewUTF8Encoding(False).GetBytes(Data1)

    Encrypt.WriteBlock UtfD1, 0, CorArray.Length(UtfD1)
    Encrypt.FlushFinalBlock
    Encrypt.CloseStream

    Dim EData1() As Byte
    EData1 = EncryptionStream.ToArray()
    K1.Reset

    ' Try to decrypt, thus showing it can be round-tripped.
    Dim DecAlg As TripleDES
    Dim DecryptionStreamBacking As New MemoryStream
    Dim Decrypt As CryptoStream

    Set DecAlg = TripleDES.Create()
    DecAlg.Key = K2.GetBytes(16)
    DecAlg.IV = EncAlg.IV

    Set Decrypt = NewCryptoStream(DecryptionStreamBacking, DecAlg.CreateDecryptor(), CryptoStreamMode.WriteMode)
    Decrypt.WriteBlock EData1, 0, CorArray.Length(EData1)
    Decrypt.Flush
    Decrypt.CloseStream
    K2.Reset

    Dim Data2 As String
    Data2 = NewUTF8Encoding(False).GetString(DecryptionStreamBacking.ToArray())

    If Data1 <> Data2 Then
        Debug.Print "Error: The two values are not equal."
    Else
        Debug.Print "The two values are equal."
        Debug.Print CorString.Format("K1 iterations: {0}", K1.IterationCount)
        Debug.Print CorString.Format("K2 iterations: {0}", K2.IterationCount)
    End If

See Also

Project CorLib Overview

Class Rfc2898DeriveBytes Overview


Rfc2898DeriveBytes: Reset

Reset

Resets the state of the operation.

 Public Sub Reset ( )

Remarks

This method is automatically called if the salt or iteration count is modified.

See Also

Project CorLib Overview

Class Rfc2898DeriveBytes Overview


Rfc2898DeriveBytes: Salt (get)

Salt

Gets the key salt value for the operation.

 Public Property Get Salt ( ) As Byte ( )

Return Values

Byte() - The key salt value for the operation.

Remarks

Salt, a random set of bytes, is used to make unauthorized decrypting of a message more difficult. A dictionary attack is an attack in which the attacker attempts to decrypt an encrypted message by comparing the encrypted value with previously computed encrypted values for the most likely keys. This attack is made much more difficult by the introduction of salt, or random bytes, at the end of the password before the key derivation.

Read/Write.

See Also

Project CorLib Overview

Class Rfc2898DeriveBytes Overview


Rfc2898DeriveBytes: Salt (let)

Salt

Sets the key salt value for the operation.

 Public Property Let Salt(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The key salt value for the operation.

Remarks

Salt, a random set of bytes, is used to make unauthorized decrypting of a message more difficult. A dictionary attack is an attack in which the attacker attempts to decrypt an encrypted message by comparing the encrypted value with previously computed encrypted values for the most likely keys. This attack is made much more difficult by the introduction of salt, or random bytes, at the end of the password before the key derivation.
Exception | Condition
ArgumentException | The specified salt size is smaller than 8 bytes.
ArgumentNullException | The salt is an uninitialized array.

Read/Write.

See Also

Project CorLib Overview

Class Rfc2898DeriveBytes Overview


Rfc2898DeriveBytes: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

A Person class may return the persons name instead.

 Public Function ToString ( ) As String

Return Values

String -

See Also

Project CorLib Overview

Class Rfc2898DeriveBytes Overview


Rijndael

Rijndael

Provides a standard interface implemented by all Rijndael cryptographic service providers.

Public:

Properties:

Name | Description
BlockSize (get) | Returns the block size in bits.
BlockSize (let) | Sets the block size in bits.
FeedbackSize (get) | Returns the feedback size in bits.
FeedbackSize (let) | Sets the feedback size in bits.
IV (get) | Returns the Initialization Vector (IV).
IV (let) | Sets the Initialization Vectory (IV).
Key (get) | Returns the secret key used by the cryptographic operation.
Key (let) | Sets the secret key to be used by the cryptographic operation.
KeySize (get) | Returns the size of the key, in bits, used by the cryptographic operation.
KeySize (let) | Sets the size of the key, in bits.
LegalBlockSizes (get) | Returns a list of legal block sizes.
LegalKeySizes (get) | Returns a list of legal key sizes.
Mode (get) | Returns the mode the current algoritm is set to.
Mode (let) | Sets the mode the current algorithm is set to.
Padding (get) | Returns the padding to be used by the algorithm.
Padding (let) | Sets the padding to be used by the algorithm.

Methods:

Name | Description
Clear | Releases all resources.
CreateDecryptor | Creates a new decryptor using the Rijndael algorithm.
CreateEncryptor | Creates a new encryptor using the Rijndael algorithm.
Equals | Returns if this instance and the value are equal.
GenerateIV | Generates a new Initialization Vector array.
GenerateKey | Generates a new Key based on the key size.
GetHashCode | Returns a semi-unique value that represents this instance.
ToString | Returns a string representation of this instance.
ValidKeySize | Checks if the specific number of bits is a valid key size.

See Also

Project CorLib Overview

Class Rijndael Overview

RijndaelManaged.


Rijndael: BlockSize (get)

BlockSize

Returns the block size in bits.

 Public Property Get BlockSize ( ) As Long

Return Values

Long - The block size in bits.

Remarks

The block size is the amount of data that is processed as a single unit by the cipher

Read/Write.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: BlockSize (let)

BlockSize

Sets the block size in bits.

 Public Property Let BlockSize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The size of the block in bits.

Remarks

The block size is the amount of data that is processed as a single unit by the cipher.

Read/Write.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: Clear

Clear

Releases all resources.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: CreateDecryptor

CreateDecryptor

Creates a new decryptor using the Rijndael algorithm.

 Public Function CreateDecryptor(
      Optional ByRef RgbKey As Variant,
      Optional ByRef RgbIV As Variant ) As ICryptoTransform

Parameters

RgbKey
[ByRef] Optional. Variant. The secret key to be used to decrypt the ciphered text back into plain text.
RgbIV
[ByRef] Optional. Variant. The Initialization Vector to begin the feedback with.

Return Values

ICryptoTransform - A new ICryptoTransform used to decrypt ciphered text.

Remarks

Though both parameters are optional, if only one parameter is supplied, an exception will be thrown.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: CreateEncryptor

CreateEncryptor

Creates a new encryptor using the Rijndael algorithm.

 Public Function CreateEncryptor(
      Optional ByRef RgbKey As Variant,
      Optional ByRef RgbIV As Variant ) As ICryptoTransform

Parameters

RgbKey
[ByRef] Optional. Variant. The secret key to be used to encrypt the plain text into ciphered text.
RgbIV
[ByRef] Optional. Variant. The Initialization Vector to begin the feedback with.

Return Values

ICryptoTransform - A new ICryptoTransform used to encrypt plain text.

Remarks

Though both parameters are optional, if only one parameter is supplied, an exception will be thrown.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: Equals

Equals

Returns if this instance and the value are equal.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare for equality.

Return Values

Boolean - Returns if the value and this instance are equal.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: FeedbackSize (get)

FeedbackSize

Returns the feedback size in bits.

 Public Property Get FeedbackSize ( ) As Long

Return Values

Long - The feedback size in bits.

Remarks

The always returns 64 bits.

The feedback size determines how much of the previous data processed is to be used on the next block of data. This is to prevent identical blocks of data to appear the same when encrypted.

Read/Write.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: FeedbackSize (let)

FeedbackSize

Sets the feedback size in bits.

 Public Property Let FeedbackSize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The size of feedback in bits.

Remarks

DES only supports 64 bits.

The feedback size determines how much of the previous data processed is to be used on the next block of data. This is to prevent identical blocks of data to appear the same when encrypted.

Not all modes of DES support feedback.

Read/Write.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: GenerateIV

GenerateIV

Generates a new Initialization Vector array.

 Public Sub GenerateIV ( )

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: GenerateKey

GenerateKey

Generates a new Key based on the key size.

 Public Sub GenerateKey ( )

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: GetHashCode

GetHashCode

Returns a semi-unique value that represents this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns the semi-unique value.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: IV (get)

IV

Returns the Initialization Vector (IV).

 Public Property Get IV ( ) As Byte ( ) :

Return Values

Byte() - An array representing the IV.

Remarks

Only an 8-byte array is supported.

When the very first block of data is process there is no previous data to pull feedback data from, so the Initialization Vector is used as a dummy set of data for feedback.

Read/Write.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: IV (let)

IV

Sets the Initialization Vectory (IV).

 Public Property Let IV(
      ByRef Value ( ) As Byte ) :

Parameters

Value
[ByRef] Byte. A set of bytes representing the IV.

Remarks

Only an 8-byte array is supported.

When the very first block of data is process there is no previous data to pull feedback data from, so the Initialization Vector is used as a dummy set of data for feedback.

Read/Write.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: Key (get)

Key

Returns the secret key used by the cryptographic operation.

 Public Property Get Key ( ) As Byte ( ) :

Return Values

Byte() - Returns the secret key.

Remarks

Valid key sizes are determined by the individual algorithms. A list of valid sizes can be obtained through the LegalKeySizes property.

Read/Write.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: Key (let)

Key

Sets the secret key to be used by the cryptographic operation.

 Public Property Let Key(
      ByRef Value ( ) As Byte ) :

Parameters

Value
[ByRef] Byte. The new secret key to be used.

Remarks

Valid key sizes are determined by the individual algorithms. A list of valid sizes can be obtained through the LegalKeySizes property.

Read/Write.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: KeySize (get)

KeySize

Returns the size of the key, in bits, used by the cryptographic operation.

 Public Property Get KeySize ( ) As Long

Return Values

Long - The size of the key in bits.

Read/Write.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: KeySize (let)

KeySize

Sets the size of the key, in bits.

 Public Property Let KeySize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The size of the key in bits.

Remarks

This will cause the Key property to reset and regenerate when needed.

Read/Write.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: LegalBlockSizes (get)

LegalBlockSizes

Returns a list of legal block sizes.

 Public Property Get LegalBlockSizes ( ) As KeySizes ( ) :

Return Values

KeySizes() - A list of legal block sizes the cryptographic operation supports.

Remarks

Block sizes are represented in bits.

Read Only.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: LegalKeySizes (get)

LegalKeySizes

Returns a list of legal key sizes.

 Public Property Get LegalKeySizes ( ) As KeySizes ( ) :

Return Values

KeySizes() - A list of legal key sizes the cryptographic operation supports.

Remarks

Key sizes are represented in bits.

Read Only.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: Mode (get)

Mode

Returns the mode the current algoritm is set to.

 Public Property Get Mode ( ) As CipherMode

Return Values

CipherMode - Returns a CipherMode value.

Remarks

The algoritm can operate in several modes. The modes determine how the data is processed from one block to the next.

Read/Write.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: Mode (let)

Mode

Sets the mode the current algorithm is set to.

 Public Property Let Mode(
      ByVal Value As CipherMode ) :

Parameters

Value
[ByVal] CipherMode. The new mode for the algorithm.

Remarks

The algoritm can operate in several modes. The modes determine how the data is processed from one block to the next.

Read/Write.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: Padding (get)

Padding

Returns the padding to be used by the algorithm.

 Public Property Get Padding ( ) As PaddingMode

Return Values

PaddingMode - A current padding being used.

Remarks

Padding is added to the end of plain text data to make the data length an even multiple of the block size.

Read/Write.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: Padding (let)

Padding

Sets the padding to be used by the algorithm.

 Public Property Let Padding(
      ByVal Value As PaddingMode ) :

Parameters

Value
[ByVal] PaddingMode. The new padding value to be used.

Remarks

Padding is added to the end of plain text data to make the data length an even multiple of the block size.

Read/Write.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: ToString

ToString

Returns a string representation of this instance.

 Public Function ToString ( ) As String

Return Values

String - A string that represents this instance.

See Also

Project CorLib Overview

Class Rijndael Overview


Rijndael: ValidKeySize

ValidKeySize

Checks if the specific number of bits is a valid key size.

 Public Function ValidKeySize(
      ByVal BitLength As Long ) As Boolean

Parameters

BitLength
[ByVal] Long. A value to determine if is a legal key size.

Return Values

Boolean - Returns True if the bit length is a valid key size, False otherwise.

See Also

Project CorLib Overview

Class Rijndael Overview


RijndaelManaged

RijndaelManaged

Represents an implementation of the Rijndael symmetric block cipher algorithm

Implements:

IObject
Rijndael
SymmetricAlgorithm

Public:

Properties:

Name | Description
BlockSize (get) | Returns the block size, in bits, used by this algorithm.
BlockSize (let) | Sets the block size, in bits, used by this algorithm.
FeedbackSize (get) | Returns the Feedback Size in bits.
FeedbackSize (let) | Sets the Feedback size in bits.
IV (get) | Returns the Initialization Vector.
IV (let) | Sets the Initialization Vector to be used.
Key (get) | Returns the current secret key.
Key (let) | Sets the secret key.
KeySize (get) | Returns the key size in bits.
KeySize (let) | Sets the key size in bits.
LegalBlockSizes (get) | Returns a list of legal block sizes.
LegalKeySizes (get) | Returns a list of valid key sizes supported by this algorithm.
Mode (get) | Returns the Cipher mode this algorithm will use.
Mode (let) | Sets the Cipher mode this algorithm will use.
Padding (get) | Returns the padding mode being used.
Padding (let) | Sets the padding mode to be used.

Methods:

Name | Description
Clear | Clears the Key and IV arrays.
CreateDecryptor | Returns a new cipher used to decrypt data.
CreateEncryptor | Returns a new cipher used to encrypt data.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GenerateIV | Generates a random IV array to use.
GenerateKey | Generates a random key to be used.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
ValidKeySize | Tests if a specific bit length is valid for a key.

Remarks

Details about Rijndael can be found here: http://www.iaik.tugraz.at/research/krypto/AES/old/~rijmen/rijndael/

Examples

This example shows a very simple method of encrypting then decrypting a String value.

Private Sub Main()
    Dim Key As New RijndaelManaged
    Dim Buffer() As Byte
    Dim PlainText As String

    ' Encrypt a string to a byte array.
    Buffer = Encrypt("This is some plaintext!", Key)

    Debug.Print "Encrypted data"
    PrintBytes Buffer
    Debug.Print

    ' Decrypt the byte array back to a string.
    PlainText = Decrypt(Buffer, Key)

    ' Display the plaintext value to the console.
    Debug.Print "Original data"
    Debug.Print PlainText
End Sub

Private Sub PrintBytes(ByRef Bytes() As Byte)
    Dim i As Long

    For i = LBound(Bytes) To UBound(Bytes)
        Debug.Print Object.ToString(Bytes(i), "X2"); " ";
    Next

    Debug.Print
End Sub

' Encrypt the string.
Private Function Encrypt(ByVal PlainText As String, ByVal Key As SymmetricAlgorithm) As Byte()
    Dim Encryptor As ICryptoTransform
    Dim Buffer() As Byte

    Buffer = Encoding.UTF8.GetBytes(PlainText)
    Set Encryptor = Key.CreateEncryptor
    Encrypt = Encryptor.TransformFinalBlock(Buffer, 0, CorArray.Length(Buffer))
End Function

' Decrypt the byte array.
Public Function Decrypt(ByRef CypherText() As Byte, ByVal Key As SymmetricAlgorithm) As String
    Dim Decryptor As ICryptoTransform
    Dim Buffer() As Byte

    Set Decryptor = Key.CreateDecryptor
    Buffer = Decryptor.TransformFinalBlock(CypherText, 0, CorArray.Length(CypherText))
    Decrypt = Encoding.UTF8.GetString(Buffer)
End Function

' This example produces the following output.
'
'    Encrypted Data (may be different because key is generated)
'    FA 5B 69 FB 30 48 B6 08 C3 68 4C 63 45 BE F9 FA 17 DC 4D B9 EC FC E7 84 3A 35 CB 41 1C 5E 1D E5
'
'    Original Data
'    This is some plaintext!

See Also

Project CorLib Overview

Class RijndaelManaged Overview

RijndaelManagedTransform


RijndaelManaged: BlockSize (get)

BlockSize

Returns the block size, in bits, used by this algorithm.

 Public Property Get BlockSize ( ) As Long

Return Values

Long - The block size in bits.

Remarks

Block sizes of 128, 192, and 256 are supported.

Read/Write.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: BlockSize (let)

BlockSize

Sets the block size, in bits, used by this algorithm.

 Public Property Let BlockSize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new block size in bits.

Remarks

Block sizes of 128, 192, and 256 are supported.

Read/Write.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: Clear

Clear

Clears the Key and IV arrays.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: CreateDecryptor

CreateDecryptor

Returns a new cipher used to decrypt data.

 Public Function CreateDecryptor(
      Optional ByRef RgbKey As Variant,
      Optional ByRef RgbIV As Variant ) As ICryptoTransform

Parameters

RgbKey
[ByRef] Optional. Variant. A supplied byte array used as the secret key.
RgbIV
[ByRef] Optional. Variant. A supplied byte array used for the Initialization Vector (IV).

Return Values

ICryptoTransform - An ICryptoTransform (RijndaelManagedTransform) object used to dencrypt data.

Remarks

Both parameters must be either supplied or missing. A single parameter will throw an exception.

If no parameters are supplied then the key and IV will be retrieved through the Key and IV properties.

See Also

Project CorLib Overview

Class RijndaelManaged Overview

RijndaelManagedTransform


RijndaelManaged: CreateEncryptor

CreateEncryptor

Returns a new cipher used to encrypt data.

 Public Function CreateEncryptor(
      Optional ByRef RgbKey As Variant,
      Optional ByRef RgbIV As Variant ) As ICryptoTransform

Parameters

RgbKey
[ByRef] Optional. Variant. A supplied byte array used as the secret key.
RgbIV
[ByRef] Optional. Variant. A supplied byte array used for the Initialization Vector (IV).

Return Values

ICryptoTransform - An ICryptoTransform (RijndaelManagedTransform) object used to encrypt data.

Remarks

Both parameters must be either supplied or missing. A single parameter will throw an exception.

If no parameters are supplied then the key and IV will be retrieved through the Key and IV properties.

See Also

Project CorLib Overview

Class RijndaelManaged Overview

RijndaelManagedTransform


RijndaelManaged: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the values are the same.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: FeedbackSize (get)

FeedbackSize

Returns the Feedback Size in bits.

 Public Property Get FeedbackSize ( ) As Long

Return Values

Long - The Feedback size in bits.

Read/Write.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: FeedbackSize (let)

FeedbackSize

Sets the Feedback size in bits.

 Public Property Let FeedbackSize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new feedback size in bits.

Read/Write.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: GenerateIV

GenerateIV

Generates a random IV array to use.

 Public Sub GenerateIV ( )

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: GenerateKey

GenerateKey

Generates a random key to be used.

 Public Sub GenerateKey ( )

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: IV (get)

IV

Returns the Initialization Vector.

 Public Property Get IV ( ) As Byte ( )

Return Values

Byte() - The Initialization Vector.

Remarks

If no IV has been set, then a new random IV will be generated.

Read/Write.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: IV (let)

IV

Sets the Initialization Vector to be used.

 Public Property Let IV(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new IV to use.

Remarks

The array must be 8 bytes in length.

Read/Write.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: Key (get)

Key

Returns the current secret key.

 Public Property Get Key ( ) As Byte ( )

Return Values

Byte() - The secret key.

Remarks

If no key has been set, then a new random key will be generated.

Read/Write.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: Key (let)

Key

Sets the secret key.

 Public Property Let Key(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new secret key.

Remarks

Key sizes of 128, 192, and 256 bits are supported.

Read/Write.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: KeySize (get)

KeySize

Returns the key size in bits.

 Public Property Get KeySize ( ) As Long

Return Values

Long - The key size in bits.

Remarks

128, 192, and 256 bits are supported.

Read/Write.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: KeySize (let)

KeySize

Sets the key size in bits.

 Public Property Let KeySize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new key size in bits.

Remarks

128, 192, and 256 bits are supported.

Read/Write.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: LegalBlockSizes (get)

LegalBlockSizes

Returns a list of legal block sizes.

 Public Property Get LegalBlockSizes ( ) As KeySizes ( )

Return Values

KeySizes() - A list of legal block sizes.

Remarks

Block sizes of 128, 192, and 256 are supported.

Read Only.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: LegalKeySizes (get)

LegalKeySizes

Returns a list of valid key sizes supported by this algorithm.

 Public Property Get LegalKeySizes ( ) As KeySizes ( )

Return Values

KeySizes() - A list of valid key sizes.

Remarks

Key sizes of 128, 192, and 256 are supported.

Read Only.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: Mode (get)

Mode

Returns the Cipher mode this algorithm will use.

 Public Property Get Mode ( ) As CipherMode

Return Values

CipherMode - The Cipher mode.

Read/Write.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: Mode (let)

Mode

Sets the Cipher mode this algorithm will use.

 Public Property Let Mode(
      ByVal Value As CipherMode )

Parameters

Value
[ByVal] CipherMode. The cipher mode to use.

Read/Write.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: Padding (get)

Padding

Returns the padding mode being used.

 Public Property Get Padding ( ) As PaddingMode

Return Values

PaddingMode - The current padding mode.

Read/Write.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: Padding (let)

Padding

Sets the padding mode to be used.

 Public Property Let Padding(
      ByVal Value As PaddingMode )

Parameters

Value
[ByVal] PaddingMode. The new padding mode.

Read/Write.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: Rijndael

Rijndael

 Implements Rijndael

Return Values

Rijndael -

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: SymmetricAlgorithm

SymmetricAlgorithm

 Implements SymmetricAlgorithm

Return Values

SymmetricAlgorithm -

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManaged: ValidKeySize

ValidKeySize

Tests if a specific bit length is valid for a key.

 Public Function ValidKeySize(
      ByVal BitLength As Long ) As Boolean

Parameters

BitLength
[ByVal] Long. The number of bits to test for.

Return Values

Boolean - Return True if the number of bits is supported, False otherwise.

Remarks

128, 192, 256 bit keys are supported.

See Also

Project CorLib Overview

Class RijndaelManaged Overview


RijndaelManagedTransform

RijndaelManagedTransform

Performs cryptographic operations on data using the Rijndael algorithm.

Implements:

ICryptoTransform
IObject

Public:

Properties:

Name | Description
BlockSizeValue (get) | Returns the blocksize in bits.
CanReuseTransform (get) | Returns if the current transfrom can be reused after calling TransformFinalBlock.
CanTransformMultipleBlocks (get) | Returns if this transform can process more than one block per TransformBlock call.
InputBlockSize (get) | Returns the size of one block of data that is to be processed.
OutputBlockSize (get) | Returns the size of the resulting block of data after an input block of data has been processed.

Methods:

Name | Description
Clear | Releases all resources used by the class.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Reset | Resets the transform so a new set of data can begin to be processed.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Processes a set of data, encrypting or decrypting it.
TransformFinalBlock | Processes a set of data adding any padding needed to complete the process.

Remarks

Details about the Rijndael algorithm can be found at http://csrc.nist.gov/CryptoToolkit/aes/rijndael

Use the RijndaelManaged class to create an instance of this class.

See Also

Project CorLib Overview

Class RijndaelManagedTransform Overview

RijndaelManaged


RijndaelManagedTransform: BlockSizeValue (get)

BlockSizeValue

Returns the blocksize in bits.

 Public Property Get BlockSizeValue ( ) As Long

Return Values

Long - The blocksize in bits.

Read Only.

See Also

Project CorLib Overview

Class RijndaelManagedTransform Overview


RijndaelManagedTransform: CanReuseTransform (get)

CanReuseTransform

Returns if the current transfrom can be reused after calling TransformFinalBlock.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Returns True if it can be reused, False otherwise.

Remarks

This always returns True.

Read Only.

See Also

Project CorLib Overview

Class RijndaelManagedTransform Overview


RijndaelManagedTransform: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if this transform can process more than one block per TransformBlock call.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - This always returns True.

Read Only.

See Also

Project CorLib Overview

Class RijndaelManagedTransform Overview


RijndaelManagedTransform: Clear

Clear

Releases all resources used by the class.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class RijndaelManagedTransform Overview


RijndaelManagedTransform: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the values are the same.

See Also

Project CorLib Overview

Class RijndaelManagedTransform Overview


RijndaelManagedTransform: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class RijndaelManagedTransform Overview


RijndaelManagedTransform: ICryptoTransform

ICryptoTransform

 Implements ICryptoTransform

Return Values

ICryptoTransform -

See Also

Project CorLib Overview

Class RijndaelManagedTransform Overview


RijndaelManagedTransform: InputBlockSize (get)

InputBlockSize

Returns the size of one block of data that is to be processed.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - The size of one block of data to be processed.

Read Only.

See Also

Project CorLib Overview

Class RijndaelManagedTransform Overview


RijndaelManagedTransform: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class RijndaelManagedTransform Overview


RijndaelManagedTransform: OutputBlockSize (get)

OutputBlockSize

Returns the size of the resulting block of data after an input block of data has been processed.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - The size of the resulting block of data after an input block of data has been processed.

Read Only.

See Also

Project CorLib Overview

Class RijndaelManagedTransform Overview


RijndaelManagedTransform: Reset

Reset

Resets the transform so a new set of data can begin to be processed.

 Public Sub Reset ( )

See Also

Project CorLib Overview

Class RijndaelManagedTransform Overview


RijndaelManagedTransform: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class RijndaelManagedTransform Overview


RijndaelManagedTransform: TransformBlock

TransformBlock

Processes a set of data, encrypting or decrypting it.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to be processed.
InputOffset
[ByVal] Long. The index to begin processing from.
InputCount
[ByVal] Long. The amount of data to be processed.
OutputBuffer
[ByRef] Byte. The buffer to place the processed data.
OutputOffset
[ByVal] Long. The index to begin placing the processed data.

Return Values

Long - The number of bytes that were processed.

Remarks

The InputCount must be an exact multiple of the InputBlockSize or an exception will be thrown.

See Also

Project CorLib Overview

Class RijndaelManagedTransform Overview


RijndaelManagedTransform: TransformFinalBlock

TransformFinalBlock

Processes a set of data adding any padding needed to complete the process.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The final data to be processed.
InputOffset
[ByVal] Long. The index to begin processing from.
InputCount
[ByVal] Long. The amount of data to be processed.

Return Values

Byte() - The final block of processed data.

Remarks

Once a final block has been processed, the transform is reset to begin transforming new data.

See Also

Project CorLib Overview

Class RijndaelManagedTransform Overview


RijndaelStatic

RijndaelStatic

Provides static methods associated with the Rijndael class.

Public:

Methods:

Name | Description
Create | Returns an implementation of the Rijndael algorithm based on the name.

See Also

Project CorLib Overview

Class RijndaelStatic Overview


RijndaelStatic: Create

Create

Returns an implementation of the Rijndael algorithm based on the name.

 Public Function Create(
      Optional ByVal AlgName As String = "CorLib.Rijndael" ) As Rijndael

Parameters

AlgName
[ByVal] Optional. String. The name of the specific implementation.

Default: "CorLib.Rijndael"

Return Values

Rijndael - An implementation of the Rijndael alogrithm.

Remarks

If "Rijndael" or "RijndaelManaged" are passed in, then the default implementation RijndaelManaged is returned.

See Also

Project CorLib Overview

Class RijndaelStatic Overview


RIPEMD160

RIPEMD160

Provides a common interface to be implemented by all RIPEMD160 implementations.

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if the RIPEMD160 implementation can be reused after a final transformation.
CanTransformMultipleBlocks (get) | Returns if an RIPEMD160 implementation can transform multiple blocks at a time.
Hash (get) | Returns the final hash value generated after performing the hashing algorithm.
HashSize (get) | Returns the size of the hash in bits.
InputBlockSize (get) | Returns the input block size used by the SHA-1 hash implementation.
OutputBlockSize (get) | Returns the output block size created by the SHA-1 hash implementation.

Methods:

Name | Description
Clear | Releases any resources used by the hash implementation.
ComputeHash | Computes the hash for a give source.
Equals | Returns if the value is equal to this object instance.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Initialize | Resets the hashing algorithm to start again.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Computes the hash for the specified block of data.
TransformFinalBlock | Computes the final hash value.

See Also

Project CorLib Overview

Class RIPEMD160 Overview

RIPEMD160Managed


RIPEMD160: CanReuseTransform (get)

CanReuseTransform

Returns if the RIPEMD160 implementation can be reused after a final transformation.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Returns True if an instance can be reused, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class RIPEMD160 Overview


RIPEMD160: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if an RIPEMD160 implementation can transform multiple blocks at a time.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Returns True if an instance can transform multiple blocks at once, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class RIPEMD160 Overview


RIPEMD160: Clear

Clear

Releases any resources used by the hash implementation.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class RIPEMD160 Overview


RIPEMD160: ComputeHash

ComputeHash

Computes the hash for a give source.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( ) :

Parameters

Source
[ByRef] Variant. The source to compute the hash for.
Index
[ByRef] Optional. Variant. The starting index in a byte array to begin computing the hash.
Count
[ByRef] Optional. Variant. The number of bytes to use to compute the hash.

Return Values

Byte() - A 20-byte array containing the computed hash.

Remarks

The Source can be either a byte-array or a Stream object.

If the source is a Stream object, then the hash continues to read the stream until no more data is can be read. The hash is computed from all data read from the stream.

See Also

Project CorLib Overview

Class RIPEMD160 Overview


RIPEMD160: Equals

Equals

Returns if the value is equal to this object instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the value and this instance are equal, False otherwise.

See Also

Project CorLib Overview

Class RIPEMD160 Overview


RIPEMD160: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class RIPEMD160 Overview


RIPEMD160: Hash (get)

Hash

Returns the final hash value generated after performing the hashing algorithm.

 Public Property Get Hash ( ) As Byte ( ) :

Return Values

Byte() - A 20 byte array representing the final hash.

Read Only.

See Also

Project CorLib Overview

Class RIPEMD160 Overview


RIPEMD160: HashSize (get)

HashSize

Returns the size of the hash in bits.

 Public Property Get HashSize ( ) As Long

Return Values

Long - Returns 160 for RIPEMD160 hashes.

Read Only.

See Also

Project CorLib Overview

Class RIPEMD160 Overview


RIPEMD160: Initialize

Initialize

Resets the hashing algorithm to start again.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class RIPEMD160 Overview


RIPEMD160: InputBlockSize (get)

InputBlockSize

Returns the input block size used by the SHA-1 hash implementation.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Returns the block size in bytes.

Read Only.

See Also

Project CorLib Overview

Class RIPEMD160 Overview


RIPEMD160: OutputBlockSize (get)

OutputBlockSize

Returns the output block size created by the SHA-1 hash implementation.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Returns the block size in bytes.

Read Only.

See Also

Project CorLib Overview

Class RIPEMD160 Overview


RIPEMD160: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class RIPEMD160 Overview


RIPEMD160: TransformBlock

TransformBlock

Computes the hash for the specified block of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to compute the hash from.
InputOffset
[ByVal] Long. The starting index in the input data to compute the hash.
InputCount
[ByVal] Long. The number of bytes to compute the hash from.
OutputBuffer
[ByRef] Byte. The array to place the input buffer bytes in.
OutputOffset
[ByVal] Long. The starting index to beging copying the bytes to.

Return Values

Long - The number of bytes processed.

Remarks

The OutputBuffer will contain the same data as the InputBuffer. No hash values are placed in the OutputBuffer.

If the OutputBuffer is a Null Array, or is the same array as the InputBuffer and the OutputOffset equals the InputOffset, then nothing is copied, however, the hash is still computed on the InputBuffer data.

The TransformFinalBlock needs to be called to finish computing the hash, this method alone cannot compute the entire hash.

See Also

Project CorLib Overview

Class RIPEMD160 Overview


RIPEMD160: TransformFinalBlock

TransformFinalBlock

Computes the final hash value.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( ) :

Parameters

InputBuffer
[ByRef] Byte. The final block of data to compute the hash for.
InputOffset
[ByVal] Long. The index in the InputBuffer to begin computing data.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - Returns the section of the InputBuffer that was processed.

Remarks

This does not return the computed hash value. A copy of the data that was process is returned. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class RIPEMD160 Overview


RIPEMD160Managed

RIPEMD160Managed

Represents an implementation of the RIPEMD160 hashing algorithm.

Implements:

HashAlgorithm
ICryptoTransform
IHashAlgorithm
IObject
RIPEMD160

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if this service provider can be reused to transfrom more data.
CanTransformMultipleBlocks (get) | Returns if this transform can operate on multiple blocks at once.
Hash (get) | Returns the computed hash.
HashSize (get) | Returns the size of the computed hash.
InputBlockSize (get) | Returns the size of the input block size allowed.
OutputBlockSize (get) | Returns the output block size this transform can produce.

Methods:

Name | Description
Clear | Releases any resources.
ComputeHash | Computes a hash value for a source in a single pass.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Initialize | Resets the hashing algorithm to start again.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Computes the hash for the specified block of data.
TransformFinalBlock | Computes the final hash value.

Remarks

Details about the hash algorithm can be found here: http://homes.esat.kuleuven.be/~bosselae/ripemd160.html

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: CanReuseTransform (get)

CanReuseTransform

Returns if this service provider can be reused to transfrom more data.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if this transform can operate on multiple blocks at once.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: Clear

Clear

Releases any resources.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: ComputeHash

ComputeHash

Computes a hash value for a source in a single pass.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Source
[ByRef] Variant. This can be either a Byte array or any Stream compatible object.
Index
[ByRef] Optional. Variant. The starting index in the Byte array. This is ignored for Stream objects.
Count
[ByRef] Optional. Variant. The number of bytes in the array to be computed. This is ignored for Stream objects.

Return Values

Byte() - A 20-byte hash value.

Remarks

If a Stream object is passed in, then the stream is continuously read and the hash calculated until there is no more data left to read from the stream.

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the values are the same.

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: Hash (get)

Hash

Returns the computed hash.

 Public Property Get Hash ( ) As Byte ( )

Return Values

Byte() - A 20-byte array containing the hash value.

Remarks

The TransformFinalBlock must be called before accessing this property or an InvalidOperationException will be thrown.

Read Only.

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: HashAlgorithm

HashAlgorithm

 Implements HashAlgorithm

Return Values

HashAlgorithm -

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: HashSize (get)

HashSize

Returns the size of the computed hash.

 Public Property Get HashSize ( ) As Long

Return Values

Long - Always returns 160 bits.

Read Only.

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: ICryptoTransform

ICryptoTransform

 Implements ICryptoTransform

Return Values

ICryptoTransform -

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: IHashAlgorithm

IHashAlgorithm

 Implements IHashAlgorithm

Return Values

IHashAlgorithm -

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: Initialize

Initialize

Resets the hashing algorithm to start again.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: InputBlockSize (get)

InputBlockSize

Returns the size of the input block size allowed.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Remarks

When calling the TransformBlock method, the InputCount must be zero or a multiple of this value.

Read Only.

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: OutputBlockSize (get)

OutputBlockSize

Returns the output block size this transform can produce.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Read Only.

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: RIPEMD160

RIPEMD160

 Implements RIPEMD160

Return Values

RIPEMD160 -

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: TransformBlock

TransformBlock

Computes the hash for the specified block of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to compute the hash from.
InputOffset
[ByVal] Long. The starting index in the input data to compute the hash.
InputCount
[ByVal] Long. The number of bytes to compute the hash from.
OutputBuffer
[ByRef] Byte. The array to place the input buffer bytes in.
OutputOffset
[ByVal] Long. The starting index to beging copying the bytes to.

Return Values

Long - The number of bytes processed.

Remarks

The OutputBuffer will contain the same data as the InputBuffer. No hash values are placed in the OutputBuffer.

If the OutputBuffer is a Null Array, or is the same array as the InputBuffer and the OutputOffset equals the InputOffset, then nothing is copied, however, the hash is still computed on the InputBuffer data.

The TransformFinalBlock needs to be called to finish computing the hash, this method alone cannot compute the entire hash.

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RIPEMD160Managed: TransformFinalBlock

TransformFinalBlock

Computes the final hash value.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The final block of data to compute the hash for.
InputOffset
[ByVal] Long. The index in the InputBuffer to begin computing data.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - Returns the section of the InputBuffer that was processed.

Remarks

This does not return the computed hash value. A copy of the data that was process is returned. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class RIPEMD160Managed Overview


RNGCryptoServiceProvider

RNGCryptoServiceProvider

Provides random number generation that is a bit more random than the regular Visual Basic method by using a Cryptographic Service Provider.

Implements:

IObject
RandomNumberGenerator

Public:

Methods:

Name | Description
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetBytes | Fills an array of bytes with random values.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function. An override might be necessary if the hashcode should be derived from a value contained within the class.
GetNonZeroBytes | Fills an array of bytes with random values, with no zeros.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides. A Person class may return the persons name instead.

See Also

Project CorLib Overview

Class RNGCryptoServiceProvider Overview


RNGCryptoServiceProvider: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test for equality.

Return Values

Boolean -

See Also

Project CorLib Overview

Class RNGCryptoServiceProvider Overview


RNGCryptoServiceProvider: GetBytes

GetBytes

Fills an array of bytes with random values.

 Public Sub GetBytes(
      ByRef Data ( ) As Byte )

Parameters

Data
[ByRef] Byte. The byte array to be filled.

See Also

Project CorLib Overview

Class RNGCryptoServiceProvider Overview


RNGCryptoServiceProvider: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

An override might be necessary if the hashcode should be derived from a value contained within the class.

 Public Function GetHashCode ( ) As Long

Return Values

Long -

See Also

Project CorLib Overview

Class RNGCryptoServiceProvider Overview


RNGCryptoServiceProvider: GetNonZeroBytes

GetNonZeroBytes

Fills an array of bytes with random values, with no zeros.

 Public Sub GetNonZeroBytes(
      ByRef Data ( ) As Byte )

Parameters

Data
[ByRef] Byte. The byte array to be filled.

See Also

Project CorLib Overview

Class RNGCryptoServiceProvider Overview


RNGCryptoServiceProvider: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class RNGCryptoServiceProvider Overview


RNGCryptoServiceProvider: RandomNumberGenerator

RandomNumberGenerator

 Implements RandomNumberGenerator

Return Values

RandomNumberGenerator -

See Also

Project CorLib Overview

Class RNGCryptoServiceProvider Overview


RNGCryptoServiceProvider: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

A Person class may return the persons name instead.

 Public Function ToString ( ) As String

Return Values

String -

See Also

Project CorLib Overview

Class RNGCryptoServiceProvider Overview


RSA

RSA

Represents the base interface from which all RSA class implementations must implement.

Public:

Properties:

Name | Description
KeyExchangeAlgorithm (get) | Returns the algorithm used for key exchange.
KeySize (get) | Returns the key size used by the RSA instance.
KeySize (let) | Sets the key size used by the current RSA instance.
LegalKeySizes (get) | Returns an array of KeySizes objects representing all the valid key sizes.
SignatureAlgorithm (get) | Returns the name of the signature algorithm used.

Methods:

Name | Description
Clear | Releases any resources used by the RSA instance.
DecryptValue | Decrypts an array of encrypted data, returning the plain text data.
EncryptValue | Encrypts an array of plain text data, returning the encrypted data.
Equals | Returns if the Value is equal this RSA instance.
ExportParameters | Exports the RSA key in an RSAParameters object.
FromXmlString | Initializes an RSA instance with an Xml representation of an RSA key.
GetHashCode | Returns a hash code identifying this object instance.
ImportParameters | Imports the RSA key from an RSAParameters object.
ToString | Returns a string representation of this object instance.
ToXmlString | Returns an Xml representation of the key for this RSA instance.

See Also

Project CorLib Overview

Class RSA Overview

RSACryptoServiceProvider


RSA: Clear

Clear

Releases any resources used by the RSA instance.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class RSA Overview


RSA: DecryptValue

DecryptValue

Decrypts an array of encrypted data, returning the plain text data.

 Public Function DecryptValue(
      ByRef Rgb ( ) As Byte ) As Byte ( ) :

Parameters

Rgb
[ByRef] Byte. The encrypted data to be decrypted.

Return Values

Byte() - An array of plain text data.

See Also

Project CorLib Overview

Class RSA Overview


RSA: EncryptValue

EncryptValue

Encrypts an array of plain text data, returning the encrypted data.

 Public Function EncryptValue(
      ByRef Rgb ( ) As Byte ) As Byte ( ) :

Parameters

Rgb
[ByRef] Byte. The plain text data to be encrypted.

Return Values

Byte() - The encrypted data.

See Also

Project CorLib Overview

Class RSA Overview


RSA: Equals

Equals

Returns if the Value is equal this RSA instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to be tests for equality.

Return Values

Boolean - Returns True if the value is equal to this instance, False otherwise.

See Also

Project CorLib Overview

Class RSA Overview

IObject


RSA: ExportParameters

ExportParameters

Exports the RSA key in an RSAParameters object.

 Public Function ExportParameters(
      ByVal IncludePrivateParameters As Boolean ) As RSAParameters

Parameters

IncludePrivateParameters
[ByVal] Boolean. A flag indicating if the private portion of the key should be exported.

Return Values

RSAParameters - An RSAParameters object containing the RSA key.

Remarks

If the private portion is included, then another instance of an RSA implementation can use the key to encrypt values, otherwise, only enough information to decrypt is provided.

See Also

Project CorLib Overview

Class RSA Overview


RSA: FromXmlString

FromXmlString

Initializes an RSA instance with an Xml representation of an RSA key.

 Public Sub FromXmlString(
      ByRef XmlString As String )

Parameters

XmlString
[ByRef] String. The string to initialize the asymmetric algorithm with.

See Also

Project CorLib Overview

Class RSA Overview


RSA: GetHashCode

GetHashCode

Returns a hash code identifying this object instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A hash code.

See Also

Project CorLib Overview

Class RSA Overview

IObject


RSA: ImportParameters

ImportParameters

Imports the RSA key from an RSAParameters object.

 Public Sub ImportParameters(
      ByVal Parameters As RSAParameters )

Parameters

Parameters
[ByVal] RSAParameters. The object to import the RSA key from.

See Also

Project CorLib Overview

Class RSA Overview


RSA: KeyExchangeAlgorithm (get)

KeyExchangeAlgorithm

Returns the algorithm used for key exchange.

 Public Property Get KeyExchangeAlgorithm ( ) As String

Return Values

String - The algorithm used for key exchange.

Read Only.

See Also

Project CorLib Overview

Class RSA Overview


RSA: KeySize (get)

KeySize

Returns the key size used by the RSA instance.

 Public Property Get KeySize ( ) As Long

Return Values

Long - The key size in bits used by the current instance.

Read/Write.

See Also

Project CorLib Overview

Class RSA Overview


RSA: KeySize (let)

KeySize

Sets the key size used by the current RSA instance.

 Public Property Let KeySize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The new key size in bits.

Read/Write.

See Also

Project CorLib Overview

Class RSA Overview


RSA: LegalKeySizes (get)

LegalKeySizes

Returns an array of KeySizes objects representing all the valid key sizes.

 Public Property Get LegalKeySizes ( ) As KeySizes ( ) :

Return Values

KeySizes() - An array of KeySizes objects.

Read Only.

See Also

Project CorLib Overview

Class RSA Overview


RSA: SignatureAlgorithm (get)

SignatureAlgorithm

Returns the name of the signature algorithm used.

 Public Property Get SignatureAlgorithm ( ) As String

Return Values

String - The name of the signature algorithm.

Read Only.

See Also

Project CorLib Overview

Class RSA Overview


RSA: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - A string representation.

See Also

Project CorLib Overview

Class RSA Overview

IObject.


RSA: ToXmlString

ToXmlString

Returns an Xml representation of the key for this RSA instance.

 Public Function ToXmlString(
      ByVal IncludePrivateParameters As Boolean ) As String

Parameters

IncludePrivateParameters
[ByVal] Boolean. A flag indicating if the private portion of the key should be included in the Xml string.

Return Values

String - An Xml string representation of the RSA key.

Remarks

If the private portion is included, then another instance of an RSA implementation can use the key to encrypt values, otherwise, only enough information to decrypt is provided.

See Also

Project CorLib Overview

Class RSA Overview


RSACryptoServiceProvider

RSACryptoServiceProvider

Provides RSA encryption services using the Windows Crypto API methods.

Implements:

AsymmetricAlgorithm
ICspAsymmetricAlgorithm
IObject
RSA

Public:

Properties:

Name | Description
CspKeyContainerInfo (get) | Returns a CspKeyContainerInfo object containing information about this RSACryptoServiceProvider instance.
KeyExchangeAlgorithm (get) | Returns the name of the key exchange algorithm this instance represents.
KeySize (get) | Returns the RSA key size in bits.
KeySize (let) | Sets the key size.
LegalKeySizes (get) | Returns an array of KeySizes objects defining the valid key sizes.
PersistKeyInCsp (get) | Returns if the current key will be stored in the current provider container.
PersistKeyInCsp (let) | Sets if the current key will be stored in the current provider container.
PublicOnly (get) | Returns if the key for this RSA instance is only the public half of the key pair.
SignatureAlgorithm (get) | Returns the signature algorithm.

Methods:

Name | Description
Clear | Releases any resources and disposes the RSA instance.
Decrypt | Decrypts data using the private key in this RSA instance.
DecryptValue | Decrypts the value.
Encrypt | Encrypts data using the public key in this RSA instance.
EncryptValue | Encrypts a value.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
ExportCspBlob | Exports the key information as a CryptoAPI PRIVATEKEYBLOB or PUBLICKEYBLOB structure.
ExportParameters | Exports the RSA algorithm parameters.
FromXmlString | Imports RSA parameters from an XML string.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function. An override might be necessary if the hashcode should be derived from a value contained within the class.
ImportCspBlob | Imports a CryptoAPI PRIVATEKEYBLOB or PUBLICKEYBLOB into the RSA provider.
ImportParameters | Imports the RSA key parameters.
SignData | Signs data using the specified hash algorithm.
SignHash | Signs a hash using RSA AT_SIGNATURE.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides. A Person class may return the persons name instead.
ToXmlString | Exports the RSA key to an Xml string.
VerifyData | Verifies the data using the signature.
VerifyHash | Verifies the hash using the signature.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: AsymmetricAlgorithm

AsymmetricAlgorithm

 Implements AsymmetricAlgorithm

Return Values

AsymmetricAlgorithm -

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: Clear

Clear

Releases any resources and disposes the RSA instance.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: CspKeyContainerInfo (get)

CspKeyContainerInfo

Returns a CspKeyContainerInfo object containing information about this RSACryptoServiceProvider instance.

 Public Property Get CspKeyContainerInfo ( ) As CspKeyContainerInfo

Return Values

CspKeyContainerInfo - A CspKeyContainerInfo object.

Read Only.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: Decrypt

Decrypt

Decrypts data using the private key in this RSA instance.

 Public Function Decrypt(
      ByRef Rgb ( ) As Byte,
      ByVal fOAEP As Boolean ) As Byte ( )

Parameters

Rgb
[ByRef] Byte. The data to be decrypted.
fOAEP
[ByVal] Boolean. A flag indicating if the data was padded using OAEP padding.

Return Values

Byte() - Returns the decrypted data.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: DecryptValue

DecryptValue

Decrypts the value.

 Public Function DecryptValue(
      ByRef Rgb ( ) As Byte ) As Byte ( )

Parameters

Rgb
[ByRef] Byte. The value to be decrypted.

Return Values

Byte() - The decrypted value.

Remarks

In .NET this would throw a NotSupportedException, however, it is supported in VBCorLib. This is equivalent to calling Decrypt(Data, False).

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: Encrypt

Encrypt

Encrypts data using the public key in this RSA instance.

 Public Function Encrypt(
      ByRef Rgb ( ) As Byte,
      ByVal fOAEP As Boolean ) As Byte ( )

Parameters

Rgb
[ByRef] Byte. The data to be encrypted.
fOAEP
[ByVal] Boolean. A flag indicating if OAEP padding should be used, otherwise PKCS#1 v1.5 padding is used.

Return Values

Byte() -

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: EncryptValue

EncryptValue

Encrypts a value.

 Public Function EncryptValue(
      ByRef Rgb ( ) As Byte ) As Byte ( )

Parameters

Rgb
[ByRef] Byte. The value to be encrypted.

Return Values

Byte() - The encrypted value.

Remarks

In .NET this would throw a NotSupportedException, however, it is supported in VBCorLib. This is equivalent to calling Encrypt(Data, False).

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test for equality.

Return Values

Boolean -

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: ExportCspBlob

ExportCspBlob

Exports the key information as a CryptoAPI PRIVATEKEYBLOB or PUBLICKEYBLOB structure.

 Public Function ExportCspBlob(
      ByVal IncludePrivateParameters As Boolean ) As Byte ( )

Parameters

IncludePrivateParameters
[ByVal] Boolean. A flag indicating if only the public key should be exported or is both the public and private keys should be exported.

Return Values

Byte() - An exported key blob structure.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: ExportParameters

ExportParameters

Exports the RSA algorithm parameters.

 Public Function ExportParameters(
      ByVal IncludePrivateParameters As Boolean ) As RSAParameters

Parameters

IncludePrivateParameters
[ByVal] Boolean. A flag indicating if only the public key should be exported or is both the public and private keys should be exported.

Return Values

RSAParameters - An RSAParameters object containing the parameters of the RSA algorithms.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: FromXmlString

FromXmlString

Imports RSA parameters from an XML string.

 Public Sub FromXmlString(
      ByRef XmlString As String )

Parameters

XmlString
[ByRef] String. The string containing the XML formatted parameters.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

An override might be necessary if the hashcode should be derived from a value contained within the class.

 Public Function GetHashCode ( ) As Long

Return Values

Long -

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: ICspAsymmetricAlgorithm

ICspAsymmetricAlgorithm

 Implements ICspAsymmetricAlgorithm

Return Values

ICspAsymmetricAlgorithm -

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: ImportCspBlob

ImportCspBlob

Imports a CryptoAPI PRIVATEKEYBLOB or PUBLICKEYBLOB into the RSA provider.

 Public Sub ImportCspBlob(
      ByRef KeyBlob ( ) As Byte )

Parameters

KeyBlob
[ByRef] Byte. The blob key to be imported.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: ImportParameters

ImportParameters

Imports the RSA key parameters.

 Public Sub ImportParameters(
      ByVal Parameters As RSAParameters )

Parameters

Parameters
[ByVal] RSAParameters. The parameters to be imported as the new key.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: KeyExchangeAlgorithm (get)

KeyExchangeAlgorithm

Returns the name of the key exchange algorithm this instance represents.

 Public Property Get KeyExchangeAlgorithm ( ) As String

Return Values

String - The name of the key exchange algorithm.

Remarks

When an RSACryptoServiceProvider is created as a key exchange instead of a signature service, this returns RSA-PKCS1-KeyEx', otherwise nothing is returned.

Read Only.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: KeySize (get)

KeySize

Returns the RSA key size in bits.

 Public Property Get KeySize ( ) As Long

Return Values

Long - The key size in bits being used by this RSA instance.

Remarks

By default, the key size is 1024 for high encryption and 512 for base encryption providers.

Read/Write.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: KeySize (let)

KeySize

Sets the key size.

 Public Property Let KeySize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new key size.

Remarks

This property has no affect on the key size. To set the key size, use the Cor.NewRSACryptoServiceProvider constructor.

Read/Write.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: LegalKeySizes (get)

LegalKeySizes

Returns an array of KeySizes objects defining the valid key sizes.

 Public Property Get LegalKeySizes ( ) As KeySizes ( )

Return Values

KeySizes() - An array of KeySizes objects.

Remarks

For high encryption systems, the legal key sizes go from 384 bits to 16384 bits in steps of 8 bits. For base encryption systems, the key sizes go from 384 bits to 512 bits in steps of 8 bits.

Read Only.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: PersistKeyInCsp (get)

PersistKeyInCsp

Returns if the current key will be stored in the current provider container.

 Public Property Get PersistKeyInCsp ( ) As Boolean

Return Values

Boolean - Returns True if the key will be stored, False otherwise.

Remarks

By default this is set to False. If a container is specified using the Cor.NewRSACryptoServiceProvider, then this will be set to True.

A key is stored in the container to allow for each retrieval by any other service that knows where the key is. Only 1 key is stored in a container, therefore, if multiple providers share the same container, then the key may become invalid.

Read/Write.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: PersistKeyInCsp (let)

PersistKeyInCsp

Sets if the current key will be stored in the current provider container.

 Public Property Let PersistKeyInCsp(
      ByVal Value As Boolean )

Parameters

Value
[ByVal] Boolean. Set to True to save the key on exit, False to have the key be deleted.

Remarks

By default this is set to False. If a container is specified using the Cor.NewRSACryptoServiceProvider, then this will be set to True.

A key is stored in the container to allow for each retrieval by any other service that knows where the key is. Only 1 key is stored in a container, therefore, if multiple providers share the same container, then the key may become invalid.

Read/Write.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: PublicOnly (get)

PublicOnly

Returns if the key for this RSA instance is only the public half of the key pair.

 Public Property Get PublicOnly ( ) As Boolean

Return Values

Boolean - Returns True if only the public half of the key is present, False otherwise.

Remarks

RSA uses a private/public key pair to encrypt and decrypt. Only the public part is required to encrypt data. The private key is used to decrypt data.

Read Only.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: RSA

RSA

 Implements RSA

Return Values

RSA -

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: SignatureAlgorithm (get)

SignatureAlgorithm

Returns the signature algorithm.

 Public Property Get SignatureAlgorithm ( ) As String

Return Values

String - Always returns http://www.w3.org/2000/09/xmldsig#rsa-sha1'

Read Only.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: SignData

SignData

Signs data using the specified hash algorithm.

 Public Function SignData(
      ByRef InputStreamOrBuffer As Variant,
      ByRef hAlg As Variant,
      Optional ByRef Offset As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

InputStreamOrBuffer
[ByRef] Variant. The data to be signed. This can be a Stream object or a Byte Array.
hAlg
[ByRef] Variant. The hash algorithm to use for signing. Only MD5, SHA1, SHA256, SHA384, and SHA512 hashes are supported.
Offset
[ByRef] Optional. Variant. The starting index of a Byte array input source. This is ignored for Stream input sources.
Count
[ByRef] Optional. Variant. The number of bytes of a Byte array input source to process. This is ignored for Stream input sources.

Return Values

Byte() - The signature of the data.

Remarks

The hash algorithms can be specified either by the OID string, the hash name, or an actual instance of a hash object that implements either the SHA1 or MD5 interface.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview

CryptoConfig

SHA1

MD5

SHA1CryptoServiceProvider

SHA1Manged

MD5CryptoServiceProvider


RSACryptoServiceProvider: SignHash

SignHash

Signs a hash using RSA AT_SIGNATURE.

 Public Function SignHash(
      ByRef RgbHash ( ) As Byte,
      ByRef Str As String ) As Byte ( )

Parameters

RgbHash
[ByRef] Byte. The hash value to be signed.
Str
[ByRef] String. The type of hash value being signed.

Return Values

Byte() - The signature for the hash data.

Remarks

Only MD5, SHA1, SHA256, SHA384, and SHA512 hashes are supported.

The Str parameter can be "MD5", "SHA", "SHA1", "SHA256", "SHA384", "SHA512" or the OID.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview

CryptoConfig


RSACryptoServiceProvider: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

A Person class may return the persons name instead.

 Public Function ToString ( ) As String

Return Values

String -

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: ToXmlString

ToXmlString

Exports the RSA key to an Xml string.

 Public Function ToXmlString(
      ByVal IncludePrivateParameters As Boolean ) As String

Parameters

IncludePrivateParameters
[ByVal] Boolean. A flag indicating if the private portions of the key should be exported.

Return Values

String - An Xml representation of the RSA key.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview


RSACryptoServiceProvider: VerifyData

VerifyData

Verifies the data using the signature.

 Public Function VerifyData(
      ByRef Buffer ( ) As Byte,
      ByRef hAlg As Variant,
      ByRef Signature ( ) As Byte ) As Boolean

Parameters

Buffer
[ByRef] Byte. The data to be verified.
hAlg
[ByRef] Variant. The hash algorithm used to verify to the data. This is the same algorithm used to sign the data. Only MD5, SHA1, SHA256, SHA384, and SHA512 hashes are supported.
Signature
[ByRef] Byte. The signature used to ensure the data is valid.

Return Values

Boolean - Returns True if the data has a valid signature, False otherwise.

Remarks

The hash algorithms can be specified either by the OID string, the hash name, or an actual instance of a hash object that implements an MD5, SHA1, SHA256, SHA384, or SHA512 interface.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview

CryptoConfig

MD5

SHA1

SHA256

SHA384

SHA512

MD5CryptoServiceProvider

SHA1CryptoServiceProvider

SHA1Manged

SHA256Managed

SHA384Managed

SHA512Managed


RSACryptoServiceProvider: VerifyHash

VerifyHash

Verifies the hash using the signature.

 Public Function VerifyHash(
      ByRef RgbHash ( ) As Byte,
      ByRef Str As String,
      ByRef Signature ( ) As Byte ) As Boolean

Parameters

RgbHash
[ByRef] Byte. The hash to be verified.
Str
[ByRef] String. The type of hash value being signed.
Signature
[ByRef] Byte. The signature for the hash data.

Return Values

Boolean - Returns True if the signature is correct, False otherwise.

Remarks

Only MD5, SHA1, SHA256, SHA384, and SHA512 hashes are supported.

The Str parameter can be "MD5", "SHA", "SHA1", "SHA256", "SHA384", "SHA512" or the OID.

See Also

Project CorLib Overview

Class RSACryptoServiceProvider Overview

CryptoConfig


RSACryptoServiceProviderStatic

RSACryptoServiceProviderStatic

Public:

Properties:

Name | Description
UseMachineKeyStore (get) |
UseMachineKeyStore (let) |

See Also

Project CorLib Overview

Class RSACryptoServiceProviderStatic Overview


RSAParameters

RSAParameters

Represents the Key information for an RSA implementation.

Implements:

IObject

Public:

Properties:

Name | Description
d (get) | Returns the D parameter of the RSA key.
d (let) | Sets the D parameter of the RSA key.
DP (get) | Returns the DP parameter of the key.
DP (let) | Sets the DP parameter of the key.
DQ (get) | Returns the DQ parameter of the key.
DQ (let) | Sets the DQ parameter of the key.
Exponent (get) | Returns the public exponent of the key.
Exponent (let) | Sets the public exponent of the key.
InverseQ (get) | Returns InverseQ parameter of the key.
InverseQ (let) | Sets the InverseQ parameter of the key
Modulus (get) | Returns the modulus of the key.
Modulus (let) | Sets the modulus of the key.
p (get) | Returns the P parameter of the key.
p (let) | Sets the P parameter of the key.
q (get) | Returns the Q parameter of the key.
q (let) | Sets the Q parameter of the key.

Methods:

Name | Description
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function. An override might be necessary if the hashcode should be derived from a value contained within the class.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides. A Person class may return the persons name instead.

Remarks

To learn more about RSAParameters, please visit this Shawnfa blog entry: http://blogs.msdn.com/shawnfa/archive/2005/11/17/493972.aspx

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: d (get)

d

Returns the D parameter of the RSA key.

 Public Property Get d ( ) As Byte ( )

Return Values

Byte() - A byte array of the D parameter.

Remarks

This is the Private Exponent of the RSA key.

Read/Write.

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: d (let)

d

Sets the D parameter of the RSA key.

 Public Property Let d(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new D parameter value.

Remarks

This is the Private Exponent of the RSA key.

Read/Write.

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: DP (get)

DP

Returns the DP parameter of the key.

 Public Property Get DP ( ) As Byte ( )

Return Values

Byte() - A byte array of the DP parameter.

Remarks

This is the Exponent1 value of the key. It has the numeric value "d mod (p - 1)".

Read/Write.

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: DP (let)

DP

Sets the DP parameter of the key.

 Public Property Let DP(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new DP value.

Remarks

This is the Exponent1 value of the key. It has the numeric value "d mod (p - 1)".

Read/Write.

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: DQ (get)

DQ

Returns the DQ parameter of the key.

 Public Property Get DQ ( ) As Byte ( )

Return Values

Byte() - A byte array of the DQ paramter

Remarks

This is the Exponent2 value of the key. It has the numeric value "d mod (q - 1)".

Read/Write.

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: DQ (let)

DQ

Sets the DQ parameter of the key.

 Public Property Let DQ(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new DQ value.

Remarks

This is the Exponent2 value of the key. It has the numeric value "d mod (q - 1)".

Read/Write.

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test for equality.

Return Values

Boolean -

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: Exponent (get)

Exponent

Returns the public exponent of the key.

 Public Property Get Exponent ( ) As Byte ( )

Return Values

Byte() - A byte array of the public exponent.

Read/Write.

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: Exponent (let)

Exponent

Sets the public exponent of the key.

 Public Property Let Exponent(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new exponent value.

Read/Write.

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

An override might be necessary if the hashcode should be derived from a value contained within the class.

 Public Function GetHashCode ( ) As Long

Return Values

Long -

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: InverseQ (get)

InverseQ

Returns InverseQ parameter of the key.

 Public Property Get InverseQ ( ) As Byte ( )

Return Values

Byte() - A byte array of the InverseQ parameter.

Remarks

This is the Coefficient. It has a numeric value "(inverse of q) mod p".

Read/Write.

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: InverseQ (let)

InverseQ

Sets the InverseQ parameter of the key

 Public Property Let InverseQ(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new InverseQ value.

Remarks

This is the Coefficient. It has a numeric value "(inverse of q) mod p".

Read/Write.

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: Modulus (get)

Modulus

Returns the modulus of the key.

 Public Property Get Modulus ( ) As Byte ( )

Return Values

Byte() - A byte array of the modulus of the key.

Remarks

This has a value of "prime1 * prime2" and is often known as "n".

Read/Write.

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: Modulus (let)

Modulus

Sets the modulus of the key.

 Public Property Let Modulus(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new modulus value.

Remarks

This has a value of "prime1 * prime2" and is often known as "n".

Read/Write.

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: p (get)

p

Returns the P parameter of the key.

 Public Property Get p ( ) As Byte ( )

Return Values

Byte() - A byte array of the P parameter.

Remarks

This is the Prime1 value of the key.

Read/Write.

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: p (let)

p

Sets the P parameter of the key.

 Public Property Let p(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new P value.

Remarks

This is the Prime1 value of the key.

Read/Write.

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: q (get)

q

Returns the Q parameter of the key.

 Public Property Get q ( ) As Byte ( )

Return Values

Byte() - A byte array of the Q value.

Remarks

This is the Prime2 value of the key.

Read/Write.

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: q (let)

q

Sets the Q parameter of the key.

 Public Property Let q(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new Q value.

Remarks

This is the Prime2 value of the key.

Read/Write.

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAParameters: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

A Person class may return the persons name instead.

 Public Function ToString ( ) As String

Return Values

String -

See Also

Project CorLib Overview

Class RSAParameters Overview


RSAStatic

RSAStatic

Represents methods associated with the RSA class.

Public:

Types:

Name | Description
KeyNumber |

Methods:

Name | Description
Create | Creates an implementation of an RSA class.

See Also

Project CorLib Overview

Class RSAStatic Overview


RSAStatic: Create

Create

Creates an implementation of an RSA class.

 Public Function Create(
      Optional ByVal AlgName As String = "CorLib.RSA" ) As RSA

Parameters

AlgName
[ByVal] Optional. String. The name of the implementation to be created.

Default: "CorLib.RSA"

Return Values

RSA - An implementation of an RSA algorithm.

Remarks

If a custom implementation is desired, then the stand method of . can be used to create it.

See Also

Project CorLib Overview

Class RSAStatic Overview

CryptoConfig.

RSA

RSACryptoServiceProvider


SafeFileHandle

SafeFileHandle

Represents a wrapper class for a file handle.

Implements:

IObject
SafeHandle

Public:

Properties:

Name | Description
IsClosed (get) | Gets a value indicating whether the handle is closed.
IsInvalid (get) | Gets a value that indicates whether the handle is invalid.

Methods:

Name | Description
CloseHandle |
DangerousGetHandle | Returns the value of the handle field.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
ToString | Returns a string representation of this object instance.

See Also

Project CorLib Overview

Class SafeFileHandle Overview


SafeFileHandle: DangerousGetHandle

DangerousGetHandle

Returns the value of the handle field.

 Public Function DangerousGetHandle ( ) As Long

Return Values

Long - A 32-bit integer representing the value of the handle field.

See Also

Project CorLib Overview

Class SafeFileHandle Overview


SafeFileHandle: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test equality on.

Return Values

Boolean - True if Value and this instance are the same instance; False otherwise.

See Also

Project CorLib Overview

Class SafeFileHandle Overview

IObject


SafeFileHandle: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class SafeFileHandle Overview

IObject


SafeFileHandle: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class SafeFileHandle Overview


SafeFileHandle: IsClosed (get)

IsClosed

Gets a value indicating whether the handle is closed.

 Public Property Get IsClosed ( ) As Boolean

Return Values

Boolean - True if the handle is closed; otherwise, False.

Read Only.

See Also

Project CorLib Overview

Class SafeFileHandle Overview


SafeFileHandle: IsInvalid (get)

IsInvalid

Gets a value that indicates whether the handle is invalid.

 Public Property Get IsInvalid ( ) As Boolean

Return Values

Boolean - True if the handle is not valid; otherwise, False.

Read Only.

See Also

Project CorLib Overview

Class SafeFileHandle Overview


SafeFileHandle: SafeHandle

SafeHandle

 Implements SafeHandle

Return Values

SafeHandle -

See Also

Project CorLib Overview

Class SafeFileHandle Overview


SafeFileHandle: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class SafeFileHandle Overview

IObject


SafeHandle

SafeHandle

Represents a wrapper class for operating system handles. This class must be implemented.

Public:

Properties:

Name | Description
IsClosed (get) | Indicates if the SafeHandle is considered closed.
IsInvalid (get) | Indicates if the wrapped handle is considered invalid.

Methods:

Name | Description
CloseHandle | Attempts to close the handle by raising the ReleaseHandle event.
DangerousGetHandle | Returns the wrapped handle.

Events:

Name | Description
ReleaseHandle |

Remarks

This class should be implemented using the Implements keyword for usage within the system.

The class also manages the lifetime of a given handle. It should be used within a custom safe-handle implementation and handle the ReleaseHandle event to peform clean-up for the specific handle in implementations.

An example of implementing and using SafeHandle is SafeFileHandle.

See Also

Project CorLib Overview

Class SafeHandle Overview


SafeHandle: CloseHandle

CloseHandle

Attempts to close the handle by raising the ReleaseHandle event.

 Public Sub CloseHandle ( )

Remarks

An event is raise indicating the handle should be closed by a subclass. The reference to this class must use WithEvents to correctly conduct the closing of the handle.

See Also

Project CorLib Overview

Class SafeHandle Overview


SafeHandle: DangerousGetHandle

DangerousGetHandle

Returns the wrapped handle.

 Public Function DangerousGetHandle ( ) As Long

Return Values

Long -

See Also

Project CorLib Overview

Class SafeHandle Overview


SafeHandle: IsClosed (get)

IsClosed

Indicates if the SafeHandle is considered closed.

 Public Property Get IsClosed ( ) As Boolean

Return Values

Boolean -

Read Only.

See Also

Project CorLib Overview

Class SafeHandle Overview


SafeHandle: IsInvalid (get)

IsInvalid

Indicates if the wrapped handle is considered invalid.

 Public Property Get IsInvalid ( ) As Boolean

Return Values

Boolean - Returns true if the handle is invalide, false otherwise.

Remarks

An invalid handle is equal to the value -1.

Read Only.

See Also

Project CorLib Overview

Class SafeHandle Overview


SafeMemoryMappedFileHandle

SafeMemoryMappedFileHandle

Provides a safe handle that represents a memory-mapped file for sequential access.

Implements:

IObject
SafeHandle

Public:

Properties:

Name | Description
IsClosed (get) | Gets a value indicating whether the handle is closed.
IsInvalid (get) | When overridden in a derived class, gets a value indicating whether the handle value is invalid.

Methods:

Name | Description
CloseHandle | Marks the handle for releasing and freeing resources.
DangerousGetHandle | Returns the value of the handle field.
Equals | Determines whether the specified value passed in is equal to the current object.
GetHashCode | Serves as the default hash function.
ToString | Returns a string that represents the current object.

See Also

Project CorLib Overview

Class SafeMemoryMappedFileHandle Overview


SafeMemoryMappedFileHandle: CloseHandle

CloseHandle

Marks the handle for releasing and freeing resources.

 Public Sub CloseHandle ( )

See Also

Project CorLib Overview

Class SafeMemoryMappedFileHandle Overview


SafeMemoryMappedFileHandle: DangerousGetHandle

DangerousGetHandle

Returns the value of the handle field.

 Public Function DangerousGetHandle ( ) As Long

Return Values

Long - An Long representing the value of the handle field.

See Also

Project CorLib Overview

Class SafeMemoryMappedFileHandle Overview


SafeMemoryMappedFileHandle: Equals

Equals

Determines whether the specified value passed in is equal to the current object.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare to the current object.

Return Values

Boolean - True if the specified value is equal to the current object; otherwise, False.

See Also

Project CorLib Overview

Class SafeMemoryMappedFileHandle Overview

IObject


SafeMemoryMappedFileHandle: GetHashCode

GetHashCode

Serves as the default hash function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A hash code for the current object.

See Also

Project CorLib Overview

Class SafeMemoryMappedFileHandle Overview

IObject


SafeMemoryMappedFileHandle: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class SafeMemoryMappedFileHandle Overview


SafeMemoryMappedFileHandle: IsClosed (get)

IsClosed

Gets a value indicating whether the handle is closed.

 Public Property Get IsClosed ( ) As Boolean

Return Values

Boolean - True if the handle is closed; otherwise, False.

Read Only.

See Also

Project CorLib Overview

Class SafeMemoryMappedFileHandle Overview


SafeMemoryMappedFileHandle: IsInvalid (get)

IsInvalid

When overridden in a derived class, gets a value indicating whether the handle value is invalid.

 Public Property Get IsInvalid ( ) As Boolean

Return Values

Boolean - True if the handle value is invalid; otherwise, False.

Read Only.

See Also

Project CorLib Overview

Class SafeMemoryMappedFileHandle Overview


SafeMemoryMappedFileHandle: SafeHandle

SafeHandle

 Implements SafeHandle

Return Values

SafeHandle -

See Also

Project CorLib Overview

Class SafeMemoryMappedFileHandle Overview


SafeMemoryMappedFileHandle: ToString

ToString

Returns a string that represents the current object.

 Public Function ToString ( ) As String

Return Values

String - A string the represents the current object.

See Also

Project CorLib Overview

Class SafeMemoryMappedFileHandle Overview

IObject


SecurityElement

SecurityElement

Provides simple XML text management capabilities.

Implements:

IObject

Public:

Properties:

Name | Description
Attributes (get) | Returns any attributes contained within the xml element.
Attributes (set) | Sets the attributes for this xml element.
Children (get) | Returns a list of child SecurityElement objects.
Children (set) | Sets the list of children SecurityElements for this element.
Tag (get) | Returns the tag name for this SecurityElement.
Tag (let) | Sets the tag name for this SecurityElement.
Text (get) | Returns the text between the opening and closing element tags.
Text (let) | Sets the text between the opening and closing element tags.

Methods:

Name | Description
AddAttribute | Adds an attribute to the set of attributes for this SecurityElement.
AddChild | Adds a new child to the SecurityElement.
Copy | Returns a copy of the SecurityElement object.
Equal | Compares two SecurityElement instances for equality.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetAttribute | Searches for the specified attribute and returns the value or an empty string.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
SearchForChildByTag | Searches for a child element by tag name.
SearchForTextOfTag | Searches for the text of a child with the specified tag name.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

Remarks

This class is primarily used to assist with the RSACryptoServiceProvider and DSACryptoServiceProvider classes when dealing with the keys as xml parameters. It is not meant for serious xml text manipulation.

See Also

Project CorLib Overview

Class SecurityElement Overview

SecurityElementStatic


SecurityElement: AddAttribute

AddAttribute

Adds an attribute to the set of attributes for this SecurityElement.

 Public Sub AddAttribute(
      ByRef Name As String,
      ByRef Value As String )

Parameters

Name
[ByRef] String. The name of the new attribute. This is case sensitive.
Value
[ByRef] String. The value of the new attribute.

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElement: AddChild

AddChild

Adds a new child to the SecurityElement.

 Public Sub AddChild(
      ByVal Child As SecurityElement )

Parameters

Child
[ByVal] SecurityElement. The child to be added.

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElement: Attributes (get)

Attributes

Returns any attributes contained within the xml element.

 Public Property Get Attributes ( ) As Hashtable

Return Values

Hashtable - An IDictionary object containing key/value pairs of attributes or Nothing.

Remarks

The attribute names are case sensitive.

Read/Write.

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElement: Attributes (set)

Attributes

Sets the attributes for this xml element.

 Public Property Set Attributes(
      ByVal Value As Hashtable )

Parameters

Value
[ByVal] Hashtable. An IDictionary of key/value pairs as attributes.

Remarks

The attribute names and values are validated before the list is accepted.

Read/Write.

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElement: Children (get)

Children

Returns a list of child SecurityElement objects.

 Public Property Get Children ( ) As ArrayList

Return Values

ArrayList - A list of children objects or Nothing.

Read/Write.

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElement: Children (set)

Children

Sets the list of children SecurityElements for this element.

 Public Property Set Children(
      ByVal Value As ArrayList )

Parameters

Value
[ByVal] ArrayList. The list of children to be set to this SecurityElement.

Read/Write.

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElement: Copy

Copy

Returns a copy of the SecurityElement object.

 Public Function Copy ( ) As SecurityElement

Return Values

SecurityElement - A copy of the object.

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElement: Equal

Equal

Compares two SecurityElement instances for equality.

 Public Function Equal(
      ByVal Other As SecurityElement ) As Boolean

Parameters

Other
[ByVal] SecurityElement. The instance to compare equality to.

Return Values

Boolean - Returns if both instances contain the same properties, the same attributes (in the same order) and equal children (in the same order).

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElement: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test for equality.

Return Values

Boolean - Returns True if they are equal, False otherwise.

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElement: GetAttribute

GetAttribute

Searches for the specified attribute and returns the value or an empty string.

 Public Function GetAttribute(
      ByRef Name As String ) As String

Parameters

Name
[ByRef] String. The name of the attribute to retrieve.

Return Values

String - Returns the attribute value or an empty string if not found.

Remarks

This is the same as the Attribute method in the .NET SecurityElement class.

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElement: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns an integer.

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElement: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElement: SearchForChildByTag

SearchForChildByTag

Searches for a child element by tag name.

 Public Function SearchForChildByTag(
      ByRef Tag As String ) As SecurityElement

Parameters

Tag
[ByRef] String. The tag name of the child element.

Return Values

SecurityElement - Returns the child element if found, or Nothing if not.

Remarks

Only the first level of children for this instance are searched, no grandchildren are searched.

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElement: SearchForTextOfTag

SearchForTextOfTag

Searches for the text of a child with the specified tag name.

 Public Function SearchForTextOfTag(
      ByRef Tag As String ) As String

Parameters

Tag
[ByRef] String. The tag name of the child being searched for.

Return Values

String - Returns the text for the found child, or an empty string if not found.

Remarks

Only the first level of children for this instance are searched, no grandchildren are searched.

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElement: Tag (get)

Tag

Returns the tag name for this SecurityElement.

 Public Property Get Tag ( ) As String

Return Values

String - The tag name for this SecurityElement.

Read/Write.

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElement: Tag (let)

Tag

Sets the tag name for this SecurityElement.

 Public Property Let Tag(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new tag name.

Remarks

The tag is validated prior to setting.

Read/Write.

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElement: Text (get)

Text

Returns the text between the opening and closing element tags.

 Public Property Get Text ( ) As String

Return Values

String - The element text.

Read/Write.

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElement: Text (let)

Text

Sets the text between the opening and closing element tags.

 Public Property Let Text(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new element text.

Remarks

The text is validated prior to being set.

Read/Write.

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElement: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - A string representation of this instance.

See Also

Project CorLib Overview

Class SecurityElement Overview


SecurityElementStatic

SecurityElementStatic

Provides static functions associated to the SecurityElement class.

Public:

Methods:

Name | Description
Escape | Replaces the set of invalid XML characters in a string to their xml representations.
FromString | Creates a SecurityElement from an XML string.
IsValidAttributeName | Determines if an attribute name if valid.
IsValidAttributeValue | Determines if an attribute value is valid.
IsValidTag | Determines if a tag name is valid.
IsValidText | Determines if an XML text is valid.

See Also

Project CorLib Overview

Class SecurityElementStatic Overview

SecurityElement


SecurityElementStatic: Escape

Escape

Replaces the set of invalid XML characters in a string to their xml representations.

 Public Function Escape(
      ByRef Text As String ) As String

Parameters

Text
[ByRef] String. The text containing the invalid XML characters.

Return Values

String - The text with the valid XML representation.

Remarks

This replaces the following characters:

 "&" = &amp;
 "<" = &lt;
 ">" = &gt;
 Double Quote = &quot;
 Single Quote = &apos;

See Also

Project CorLib Overview

Class SecurityElementStatic Overview


SecurityElementStatic: FromString

FromString

Creates a SecurityElement from an XML string.

 Public Function FromString(
      ByRef Xml As String ) As SecurityElement

Parameters

Xml
[ByRef] String. The string to parse into a SecurityElement.

Return Values

SecurityElement - A SecurityElement representation of the XML string.

See Also

Project CorLib Overview

Class SecurityElementStatic Overview


SecurityElementStatic: IsValidAttributeName

IsValidAttributeName

Determines if an attribute name if valid.

 Public Function IsValidAttributeName(
      ByRef Name As String ) As Boolean

Parameters

Name
[ByRef] String. The name of the attribute to test.

Return Values

Boolean - Returns True if the attribute name is valid, False otherwise.

Remarks

The name if not valid if it contains any of the following: "<", ">", or a space.

See Also

Project CorLib Overview

Class SecurityElementStatic Overview


SecurityElementStatic: IsValidAttributeValue

IsValidAttributeValue

Determines if an attribute value is valid.

 Public Function IsValidAttributeValue(
      ByRef Value As String ) As Boolean

Parameters

Value
[ByRef] String. The attribute value to test.

Return Values

Boolean - Returns True if the value is valid, False otherwise.

Remarks

The value is not valid if it contains any of the following: "<", ">".

See Also

Project CorLib Overview

Class SecurityElementStatic Overview


SecurityElementStatic: IsValidTag

IsValidTag

Determines if a tag name is valid.

 Public Function IsValidTag(
      ByRef Tag As String ) As Boolean

Parameters

Tag
[ByRef] String. The tag to be tested.

Return Values

Boolean - Returns True if the tag is valid, False otherwise.

Remarks

A tag is not valid if it contains any of the following: "<", ">", or a space.

See Also

Project CorLib Overview

Class SecurityElementStatic Overview


SecurityElementStatic: IsValidText

IsValidText

Determines if an XML text is valid.

 Public Function IsValidText(
      ByRef Text As String ) As Boolean

Parameters

Text
[ByRef] String. The text to be tested.

Return Values

Boolean - Returns True if the text is valid, False otherwise.

Remarks

The text is not valid if it contains any of the following: "<", ">".

See Also

Project CorLib Overview

Class SecurityElementStatic Overview


SerializationException

SerializationException

This exception is thrown when an error occurs reading or writing a propertybag and a value cannot be serialized.

Implements:

Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

See Also

Project CorLib Overview

Class SerializationException Overview


SerializationException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class SerializationException Overview


SerializationException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class SerializationException Overview


SerializationException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class SerializationException Overview


SerializationException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class SerializationException Overview


SerializationException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class SerializationException Overview


SerializationException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class SerializationException Overview


SerializationException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class SerializationException Overview


SerializationException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class SerializationException Overview


SerializationException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class SerializationException Overview

Exception


SerializationException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class SerializationException Overview


SerializationException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class SerializationException Overview


SerializationException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewSystemException.

Read Only.

See Also

Project CorLib Overview

Class SerializationException Overview


SerializationException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class SerializationException Overview


SerializationException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class SerializationException Overview


SerializationException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class SerializationException Overview


SerializationException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class SerializationException Overview


SHA1

SHA1

Represents a standard interface for SHA-1 class implementations.

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if the SHA-1 implementation can be reused after a final transformation.
CanTransformMultipleBlocks (get) | Returns if an SHA-1 implementation can transform multiple blocks at a time.
Hash (get) | Returns the final hash value generated after performing the hashing algorithm.
HashSize (get) | Returns the size of the hash in bits.
InputBlockSize (get) | Returns the input block size used by the SHA-1 hash implementation.
OutputBlockSize (get) | Returns the output block size created by the SHA-1 hash implementation.

Methods:

Name | Description
Clear | Releases any resources used by the hash implementation.
ComputeHash | Computes the hash for a give source.
Equals | Returns if the value is equal to this object instance.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Initialize | Resets the hashing algorithm to start again.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Computes the hash for the specified block of data.
TransformFinalBlock | Computes the final hash value.

See Also

Project CorLib Overview

Class SHA1 Overview

SHA1CryptoServiceProvider

SHA1Managed


SHA1: CanReuseTransform (get)

CanReuseTransform

Returns if the SHA-1 implementation can be reused after a final transformation.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Returns True if an instance can be reused, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class SHA1 Overview


SHA1: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if an SHA-1 implementation can transform multiple blocks at a time.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Returns True if an instance can transform multiple blocks at once, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class SHA1 Overview


SHA1: Clear

Clear

Releases any resources used by the hash implementation.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class SHA1 Overview


SHA1: ComputeHash

ComputeHash

Computes the hash for a give source.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( ) :

Parameters

Source
[ByRef] Variant. The source to compute the hash for.
Index
[ByRef] Optional. Variant. The starting index in a byte array to begin computing the hash.
Count
[ByRef] Optional. Variant. The number of bytes to use to compute the hash.

Return Values

Byte() - A 20-byte array containing the computed hash.

Remarks

The Source can be either a byte-array or a Stream object.

If the source is a Stream object, then the hash continues to read the stream until no more data is can be read. The hash is computed from all data read from the stream.

See Also

Project CorLib Overview

Class SHA1 Overview


SHA1: Equals

Equals

Returns if the value is equal to this object instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the value and this instance are equal, False otherwise.

See Also

Project CorLib Overview

Class SHA1 Overview


SHA1: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class SHA1 Overview


SHA1: Hash (get)

Hash

Returns the final hash value generated after performing the hashing algorithm.

 Public Property Get Hash ( ) As Byte ( ) :

Return Values

Byte() - A 20 byte array representing the final hash.

Read Only.

See Also

Project CorLib Overview

Class SHA1 Overview


SHA1: HashSize (get)

HashSize

Returns the size of the hash in bits.

 Public Property Get HashSize ( ) As Long

Return Values

Long - Returns 160 for SHA-1 hashes.

Read Only.

See Also

Project CorLib Overview

Class SHA1 Overview


SHA1: Initialize

Initialize

Resets the hashing algorithm to start again.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class SHA1 Overview


SHA1: InputBlockSize (get)

InputBlockSize

Returns the input block size used by the SHA-1 hash implementation.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Returns the block size in bytes.

Read Only.

See Also

Project CorLib Overview

Class SHA1 Overview


SHA1: OutputBlockSize (get)

OutputBlockSize

Returns the output block size created by the SHA-1 hash implementation.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Returns the block size in bytes.

Read Only.

See Also

Project CorLib Overview

Class SHA1 Overview


SHA1: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class SHA1 Overview


SHA1: TransformBlock

TransformBlock

Computes the hash for the specified block of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to compute the hash from.
InputOffset
[ByVal] Long. The starting index in the input data to compute the hash.
InputCount
[ByVal] Long. The number of bytes to compute the hash from.
OutputBuffer
[ByRef] Byte. The array to place the input buffer bytes in.
OutputOffset
[ByVal] Long. The starting index to beging copying the bytes to.

Return Values

Long - The number of bytes processed.

Remarks

The OutputBuffer will contain the same data as the InputBuffer. No hash values are placed in the OutputBuffer.

If the OutputBuffer is a Null Array, or is the same array as the InputBuffer and the OutputOffset equals the InputOffset, then nothing is copied, however, the hash is still computed on the InputBuffer data.

The TransformFinalBlock needs to be called to finish computing the hash, this method alone cannot compute the entire hash.

See Also

Project CorLib Overview

Class SHA1 Overview


SHA1: TransformFinalBlock

TransformFinalBlock

Computes the final hash value.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( ) :

Parameters

InputBuffer
[ByRef] Byte. The final block of data to compute the hash for.
InputOffset
[ByVal] Long. The index in the InputBuffer to begin computing data.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - Returns the section of the InputBuffer that was processed.

Remarks

This does not return the computed hash value. A copy of the data that was process is returned. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class SHA1 Overview


SHA1CryptoServiceProvider

SHA1CryptoServiceProvider

Provides services to compute the SHA-1 hash values of data.

Implements:

HashAlgorithm
ICryptoTransform
IObject
SHA1

Name | Description
SHA1_ComputeHash |

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if this service provider can be reused to transfrom more data.
CanTransformMultipleBlocks (get) | Returns if this transform can operate on multiple blocks at once.
Hash (get) | Returns the computed hash.
HashSize (get) | Returns the size of the computed hash.
InputBlockSize (get) | Returns the input block size this transform can work on.
OutputBlockSize (get) | Returns the output block size this transform can produce.

Methods:

Name | Description
Clear | Releases any resources.
ComputeHash | Computes a hash value for a source in a single pass.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Initialize | Resets the hashing algorithm to start again.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Computes the hash for the specified block of data.
TransformFinalBlock | Computes the final hash value.

Remarks

This uses the CryptoAPI version of the algorithm.

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview

SHA1

SHA1Managed

SHA1Static

HashAlgorithm


SHA1CryptoServiceProvider: CanReuseTransform (get)

CanReuseTransform

Returns if this service provider can be reused to transfrom more data.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview


SHA1CryptoServiceProvider: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if this transform can operate on multiple blocks at once.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview


SHA1CryptoServiceProvider: Clear

Clear

Releases any resources.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview


SHA1CryptoServiceProvider: ComputeHash

ComputeHash

Computes a hash value for a source in a single pass.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Source
[ByRef] Variant. This can be either a Byte array or any Stream compatible object.
Index
[ByRef] Optional. Variant. The starting index in the Byte array. This is ignored for Stream objects.
Count
[ByRef] Optional. Variant. The number of bytes in the array to be computed. This is ignored for Stream objects.

Return Values

Byte() - A 20-byte hash value.

Remarks

If a Stream object is passed in, then the stream is continuously read and the hash calculated until there is no more data left to read from the stream.

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview


SHA1CryptoServiceProvider: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the values are the same.

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview


SHA1CryptoServiceProvider: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview


SHA1CryptoServiceProvider: Hash (get)

Hash

Returns the computed hash.

 Public Property Get Hash ( ) As Byte ( )

Return Values

Byte() - A 20-byte array containing the hash value.

Remarks

The TransformFinalBlock must be called before accessing this property or an InvalidOperationException will be thrown.

Read Only.

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview


SHA1CryptoServiceProvider: HashAlgorithm

HashAlgorithm

 Implements HashAlgorithm

Return Values

HashAlgorithm -

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview


SHA1CryptoServiceProvider: HashSize (get)

HashSize

Returns the size of the computed hash.

 Public Property Get HashSize ( ) As Long

Return Values

Long - Always returns 160 bits.

Read Only.

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview


SHA1CryptoServiceProvider: ICryptoTransform

ICryptoTransform

 Implements ICryptoTransform

Return Values

ICryptoTransform -

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview


SHA1CryptoServiceProvider: Initialize

Initialize

Resets the hashing algorithm to start again.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview


SHA1CryptoServiceProvider: InputBlockSize (get)

InputBlockSize

Returns the input block size this transform can work on.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Read Only.

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview


SHA1CryptoServiceProvider: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview


SHA1CryptoServiceProvider: OutputBlockSize (get)

OutputBlockSize

Returns the output block size this transform can produce.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Read Only.

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview


SHA1CryptoServiceProvider: SHA1

SHA1

 Implements SHA1

Return Values

SHA1 -

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview


SHA1CryptoServiceProvider: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview


SHA1CryptoServiceProvider: TransformBlock

TransformBlock

Computes the hash for the specified block of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to compute the hash from.
InputOffset
[ByVal] Long. The starting index in the input data to compute the hash.
InputCount
[ByVal] Long. The number of bytes to compute the hash from.
OutputBuffer
[ByRef] Byte. The array to place the input buffer bytes in.
OutputOffset
[ByVal] Long. The starting index to beging copying the bytes to.

Return Values

Long - The number of bytes processed.

Remarks

The OutputBuffer will contain the same data as the InputBuffer. No hash values are placed in the OutputBuffer.

If the OutputBuffer is a Null Array, or is the same array as the InputBuffer and the OutputOffset equals the InputOffset, then nothing is copied, however, the hash is still computed on the InputBuffer data.

The TransformFinalBlock needs to be called to finish computing the hash, this method alone cannot compute the entire hash.

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview


SHA1CryptoServiceProvider: TransformFinalBlock

TransformFinalBlock

Computes the final hash value.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The final block of data to compute the hash for.
InputOffset
[ByVal] Long. The index in the InputBuffer to begin computing data.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - Returns the section of the InputBuffer that was processed.

Remarks

This does not return the computed hash value. A copy of the data that was process is returned. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class SHA1CryptoServiceProvider Overview


SHA1Managed

SHA1Managed

Provides services to compute the SHA-1 hash value.

Implements:

HashAlgorithm
ICryptoTransform
IHashAlgorithm
IObject
SHA1

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if this service provider can be reused to transfrom more data.
CanTransformMultipleBlocks (get) | Returns if this transform can operate on multiple blocks at once.
Hash (get) | Returns the computed hash.
HashSize (get) | Returns the size of the computed hash.
InputBlockSize (get) | Returns the size of the input block size allowed.
OutputBlockSize (get) | Returns the output block size this transform can produce.

Methods:

Name | Description
Clear | Releases any resources.
ComputeHash | Computes a hash value for a source in a single pass.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Initialize | Resets the hashing algorithm to start again.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Computes the hash for the specified block of data.
TransformFinalBlock | Computes the final hash value.

Remarks

The SHA-1 algorithm is implemented in Visual Basic.

Details can be found at http://csrc.nist.gov/CryptoToolkit/tkhash.html

See Also

Project CorLib Overview

Class SHA1Managed Overview

SHA1CryptoServiceProvider

SHA1

SHA1Static

HashAlgorithm


SHA1Managed: CanReuseTransform (get)

CanReuseTransform

Returns if this service provider can be reused to transfrom more data.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Managed: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if this transform can operate on multiple blocks at once.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Managed: Clear

Clear

Releases any resources.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Managed: ComputeHash

ComputeHash

Computes a hash value for a source in a single pass.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Source
[ByRef] Variant. This can be either a Byte array or any Stream compatible object.
Index
[ByRef] Optional. Variant. The starting index in the Byte array. This is ignored for Stream objects.
Count
[ByRef] Optional. Variant. The number of bytes in the array to be computed. This is ignored for Stream objects.

Return Values

Byte() - A 20-byte hash value.

Remarks

If a Stream object is passed in, then the stream is continuously read and the hash calculated until there is no more data left to read from the stream.

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Managed: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the values are the same.

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Managed: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Managed: Hash (get)

Hash

Returns the computed hash.

 Public Property Get Hash ( ) As Byte ( )

Return Values

Byte() - A 20-byte array containing the hash value.

Remarks

The TransformFinalBlock must be called before accessing this property or an InvalidOperationException will be thrown.

Read Only.

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Managed: HashAlgorithm

HashAlgorithm

 Implements HashAlgorithm

Return Values

HashAlgorithm -

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Managed: HashSize (get)

HashSize

Returns the size of the computed hash.

 Public Property Get HashSize ( ) As Long

Return Values

Long - Always returns 160 bits.

Read Only.

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Managed: ICryptoTransform

ICryptoTransform

 Implements ICryptoTransform

Return Values

ICryptoTransform -

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Managed: IHashAlgorithm

IHashAlgorithm

 Implements IHashAlgorithm

Return Values

IHashAlgorithm -

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Managed: Initialize

Initialize

Resets the hashing algorithm to start again.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Managed: InputBlockSize (get)

InputBlockSize

Returns the size of the input block size allowed.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Remarks

When calling the TransformBlock method, the InputCount must be zero or a multiple of this value.

Read Only.

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Managed: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Managed: OutputBlockSize (get)

OutputBlockSize

Returns the output block size this transform can produce.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Read Only.

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Managed: SHA1

SHA1

 Implements SHA1

Return Values

SHA1 -

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Managed: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Managed: TransformBlock

TransformBlock

Computes the hash for the specified block of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to compute the hash from.
InputOffset
[ByVal] Long. The starting index in the input data to compute the hash.
InputCount
[ByVal] Long. The number of bytes to compute the hash from.
OutputBuffer
[ByRef] Byte. The array to place the input buffer bytes in.
OutputOffset
[ByVal] Long. The starting index to beging copying the bytes to.

Return Values

Long - The number of bytes processed.

Remarks

The OutputBuffer will contain the same data as the InputBuffer. No hash values are placed in the OutputBuffer.

If the OutputBuffer is a Null Array, or is the same array as the InputBuffer and the OutputOffset equals the InputOffset, then nothing is copied, however, the hash is still computed on the InputBuffer data.

The TransformFinalBlock needs to be called to finish computing the hash, this method alone cannot compute the entire hash.

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Managed: TransformFinalBlock

TransformFinalBlock

Computes the final hash value.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The final block of data to compute the hash for.
InputOffset
[ByVal] Long. The index in the InputBuffer to begin computing data.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - Returns the section of the InputBuffer that was processed.

Remarks

This does not return the computed hash value. A copy of the data that was process is returned. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class SHA1Managed Overview


SHA1Static

SHA1Static

Provides methods specific to the SHA-1 class.

Public:

Methods:

Name | Description
Create | Creates a new instance of the SHA-1 algorithm using the specified implementation.

See Also

Project CorLib Overview

Class SHA1Static Overview


SHA1Static: Create

Create

Creates a new instance of the SHA-1 algorithm using the specified implementation.

 Public Function Create(
      Optional ByRef AlgName As String = "CorLib.SHA1" ) As SHA1

Parameters

AlgName
[ByRef] Optional. String. The name of the implementation to create.

Default: "CorLib.SHA1"

Return Values

SHA1 - A new implementation of the SHA-1 algorithm.

Remarks

If no name is specified, then a new SHA1CryptoServiceProvider instance will be created.

See Also

Project CorLib Overview

Class SHA1Static Overview


SHA256

SHA256

Represents a standard interface for SHA-256 class implementations.

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if the SHA-256 implementation can be reused after a final transformation.
CanTransformMultipleBlocks (get) | Returns if an SHA-256 implementation can transform multiple blocks at a time.
Hash (get) | Returns the final hash value generated after performing the hashing algorithm.
HashSize (get) | Returns the size of the hash in bits.
InputBlockSize (get) | Returns the input block size used by the SHA-1 hash implementation.
OutputBlockSize (get) | Returns the output block size created by the SHA-1 hash implementation.

Methods:

Name | Description
Clear | Releases any resources used by the hash implementation.
ComputeHash | Computes the hash for a give source.
Equals | Returns if the value is equal to this object instance.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Initialize | Resets the hashing algorithm to start again.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Computes the hash for the specified block of data.
TransformFinalBlock | Computes the final hash value.

See Also

Project CorLib Overview

Class SHA256 Overview

SHA256Managed


SHA256: CanReuseTransform (get)

CanReuseTransform

Returns if the SHA-256 implementation can be reused after a final transformation.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Returns True if an instance can be reused, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class SHA256 Overview


SHA256: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if an SHA-256 implementation can transform multiple blocks at a time.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Returns True if an instance can transform multiple blocks at once, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class SHA256 Overview


SHA256: Clear

Clear

Releases any resources used by the hash implementation.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class SHA256 Overview


SHA256: ComputeHash

ComputeHash

Computes the hash for a give source.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( ) :

Parameters

Source
[ByRef] Variant. The source to compute the hash for.
Index
[ByRef] Optional. Variant. The starting index in a byte array to begin computing the hash.
Count
[ByRef] Optional. Variant. The number of bytes to use to compute the hash.

Return Values

Byte() - A 32-byte array containing the computed hash.

Remarks

The Source can be either a byte-array or a Stream object.

If the source is a Stream object, then the hash continues to read the stream until no more data is can be read. The hash is computed from all data read from the stream.

See Also

Project CorLib Overview

Class SHA256 Overview


SHA256: Equals

Equals

Returns if the value is equal to this object instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the value and this instance are equal, False otherwise.

See Also

Project CorLib Overview

Class SHA256 Overview


SHA256: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class SHA256 Overview


SHA256: Hash (get)

Hash

Returns the final hash value generated after performing the hashing algorithm.

 Public Property Get Hash ( ) As Byte ( ) :

Return Values

Byte() - A 32 byte array representing the final hash.

Read Only.

See Also

Project CorLib Overview

Class SHA256 Overview


SHA256: HashSize (get)

HashSize

Returns the size of the hash in bits.

 Public Property Get HashSize ( ) As Long

Return Values

Long - Returns 256 for SHA-256 hashes.

Read Only.

See Also

Project CorLib Overview

Class SHA256 Overview


SHA256: Initialize

Initialize

Resets the hashing algorithm to start again.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class SHA256 Overview


SHA256: InputBlockSize (get)

InputBlockSize

Returns the input block size used by the SHA-1 hash implementation.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Returns the block size in bytes.

Read Only.

See Also

Project CorLib Overview

Class SHA256 Overview


SHA256: OutputBlockSize (get)

OutputBlockSize

Returns the output block size created by the SHA-1 hash implementation.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Returns the block size in bytes.

Read Only.

See Also

Project CorLib Overview

Class SHA256 Overview


SHA256: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class SHA256 Overview


SHA256: TransformBlock

TransformBlock

Computes the hash for the specified block of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to compute the hash from.
InputOffset
[ByVal] Long. The starting index in the input data to compute the hash.
InputCount
[ByVal] Long. The number of bytes to compute the hash from.
OutputBuffer
[ByRef] Byte. The array to place the input buffer bytes in.
OutputOffset
[ByVal] Long. The starting index to beging copying the bytes to.

Return Values

Long - The number of bytes processed.

Remarks

The OutputBuffer will contain the same data as the InputBuffer. No hash values are placed in the OutputBuffer.

If the OutputBuffer is a Null Array, or is the same array as the InputBuffer and the OutputOffset equals the InputOffset, then nothing is copied, however, the hash is still computed on the InputBuffer data.

The TransformFinalBlock needs to be called to finish computing the hash, this method alone cannot compute the entire hash.

See Also

Project CorLib Overview

Class SHA256 Overview


SHA256: TransformFinalBlock

TransformFinalBlock

Computes the final hash value.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( ) :

Parameters

InputBuffer
[ByRef] Byte. The final block of data to compute the hash for.
InputOffset
[ByVal] Long. The index in the InputBuffer to begin computing data.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - Returns the section of the InputBuffer that was processed.

Remarks

This does not return the computed hash value. A copy of the data that was process is returned. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class SHA256 Overview


SHA256Managed

SHA256Managed

Provides services to compute the SHA-256 hash value.

Implements:

HashAlgorithm
ICryptoTransform
IHashAlgorithm
IObject
SHA256

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if this service provider can be reused to transfrom more data.
CanTransformMultipleBlocks (get) | Returns if this transform can operate on multiple blocks at once.
Hash (get) | Returns the computed hash.
HashSize (get) | Returns the size of the computed hash.
InputBlockSize (get) | Returns the input block size this transform can work on.
OutputBlockSize (get) | Returns the output block size this transform can produce.

Methods:

Name | Description
Clear | Releases any resources.
ComputeHash | Computes a hash value for a source in a single pass.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Initialize | Resets the hashing algorithm to start again.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Computes the hash for the specified block of data.
TransformFinalBlock | Computes the final hash value.

Remarks

The SHA-256 algorithm is implemented in Visual Basic.

Details can be found at http://csrc.nist.gov/CryptoToolkit/tkhash.html

See Also

Project CorLib Overview

Class SHA256Managed Overview

HashAlgorithm


SHA256Managed: CanReuseTransform (get)

CanReuseTransform

Returns if this service provider can be reused to transfrom more data.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Managed: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if this transform can operate on multiple blocks at once.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Managed: Clear

Clear

Releases any resources.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Managed: ComputeHash

ComputeHash

Computes a hash value for a source in a single pass.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Source
[ByRef] Variant. This can be either a Byte array or any Stream compatible object.
Index
[ByRef] Optional. Variant. The starting index in the Byte array. This is ignored for Stream objects.
Count
[ByRef] Optional. Variant. The number of bytes in the array to be computed. This is ignored for Stream objects.

Return Values

Byte() - A 32-byte hash value.

Remarks

If a Stream object is passed in, then the stream is continuously read and the hash calculated until there is no more data left to read from the stream.

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Managed: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the values are the same.

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Managed: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Managed: Hash (get)

Hash

Returns the computed hash.

 Public Property Get Hash ( ) As Byte ( )

Return Values

Byte() - A 32-byte array containing the hash value.

Remarks

The TransformFinalBlock must be called before accessing this property or an InvalidOperationException will be thrown.

Read Only.

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Managed: HashAlgorithm

HashAlgorithm

 Implements HashAlgorithm

Return Values

HashAlgorithm -

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Managed: HashSize (get)

HashSize

Returns the size of the computed hash.

 Public Property Get HashSize ( ) As Long

Return Values

Long - Always returns 256 bits.

Read Only.

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Managed: ICryptoTransform

ICryptoTransform

 Implements ICryptoTransform

Return Values

ICryptoTransform -

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Managed: IHashAlgorithm

IHashAlgorithm

 Implements IHashAlgorithm

Return Values

IHashAlgorithm -

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Managed: Initialize

Initialize

Resets the hashing algorithm to start again.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Managed: InputBlockSize (get)

InputBlockSize

Returns the input block size this transform can work on.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Remarks

When calling the TransformBlock method, the InputCount must be zero or a multiple of this value.

Read Only.

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Managed: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Managed: OutputBlockSize (get)

OutputBlockSize

Returns the output block size this transform can produce.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Read Only.

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Managed: SHA256

SHA256

 Implements SHA256

Return Values

SHA256 -

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Managed: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Managed: TransformBlock

TransformBlock

Computes the hash for the specified block of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to compute the hash from.
InputOffset
[ByVal] Long. The starting index in the input data to compute the hash.
InputCount
[ByVal] Long. The number of bytes to compute the hash from.
OutputBuffer
[ByRef] Byte. The array to place the input buffer bytes in.
OutputOffset
[ByVal] Long. The starting index to beging copying the bytes to.

Return Values

Long - The number of bytes processed.

Remarks

The OutputBuffer will contain the same data as the InputBuffer. No hash values are placed in the OutputBuffer.

If the OutputBuffer is a Null Array, or is the same array as the InputBuffer and the OutputOffset equals the InputOffset, then nothing is copied, however, the hash is still computed on the InputBuffer data.

The TransformFinalBlock needs to be called to finish computing the hash, this method alone cannot compute the entire hash.

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Managed: TransformFinalBlock

TransformFinalBlock

Computes the final hash value.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The final block of data to compute the hash for.
InputOffset
[ByVal] Long. The index in the InputBuffer to begin computing data.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - Returns the section of the InputBuffer that was processed.

Remarks

This does not return the computed hash value. A copy of the data that was process is returned. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class SHA256Managed Overview


SHA256Static

SHA256Static

Provides methods associated with the SHA-256 class.

Public:

Methods:

Name | Description
Create | Creates a new instance of an SHA-256 implementation.

See Also

Project CorLib Overview

Class SHA256Static Overview


SHA256Static: Create

Create

Creates a new instance of an SHA-256 implementation.

 Public Function Create(
      Optional ByRef AlgName As String = "CorLib.SHA256" ) As SHA256

Parameters

AlgName
[ByRef] Optional. String. The name of the implementation to create an instance of.

Default: "CorLib.SHA256"

Return Values

SHA256 - A new SHA-256 compatible implementation.

Remarks

If not name is given, then a new SHA256Managed is returned.

See Also

Project CorLib Overview

Class SHA256Static Overview


SHA384

SHA384

Represents a standard interface for SHA-384 class implementations.

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if the SHA-384 implementation can be reused after a final transformation.
CanTransformMultipleBlocks (get) | Returns if an SHA-384 implementation can transform multiple blocks at a time.
Hash (get) | Returns the final hash value generated after performing the hashing algorithm.
HashSize (get) | Returns the size of the hash in bits.
InputBlockSize (get) | Returns the input block size used by the SHA-1 hash implementation.
OutputBlockSize (get) | Returns the output block size created by the SHA-1 hash implementation.

Methods:

Name | Description
Clear | Releases any resources used by the hash implementation.
ComputeHash | Computes the hash for a give source.
Equals | Returns if the value is equal to this object instance.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Initialize | Resets the hashing algorithm to start again.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Computes the hash for the specified block of data.
TransformFinalBlock | Computes the final hash value.

See Also

Project CorLib Overview

Class SHA384 Overview

SHA384Managed


SHA384: CanReuseTransform (get)

CanReuseTransform

Returns if the SHA-384 implementation can be reused after a final transformation.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Returns True if an instance can be reused, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class SHA384 Overview


SHA384: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if an SHA-384 implementation can transform multiple blocks at a time.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Returns True if an instance can transform multiple blocks at once, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class SHA384 Overview


SHA384: Clear

Clear

Releases any resources used by the hash implementation.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class SHA384 Overview


SHA384: ComputeHash

ComputeHash

Computes the hash for a give source.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( ) :

Parameters

Source
[ByRef] Variant. The source to compute the hash for.
Index
[ByRef] Optional. Variant. The starting index in a byte array to begin computing the hash.
Count
[ByRef] Optional. Variant. The number of bytes to use to compute the hash.

Return Values

Byte() - A 48-byte array containing the computed hash.

Remarks

The Source can be either a byte-array or a Stream object.

If the source is a Stream object, then the hash continues to read the stream until no more data is can be read. The hash is computed from all data read from the stream.

See Also

Project CorLib Overview

Class SHA384 Overview


SHA384: Equals

Equals

Returns if the value is equal to this object instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the value and this instance are equal, False otherwise.

See Also

Project CorLib Overview

Class SHA384 Overview


SHA384: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class SHA384 Overview


SHA384: Hash (get)

Hash

Returns the final hash value generated after performing the hashing algorithm.

 Public Property Get Hash ( ) As Byte ( ) :

Return Values

Byte() - A 48 byte array representing the final hash.

Read Only.

See Also

Project CorLib Overview

Class SHA384 Overview


SHA384: HashSize (get)

HashSize

Returns the size of the hash in bits.

 Public Property Get HashSize ( ) As Long

Return Values

Long - Returns 384 for SHA-384 hashes.

Read Only.

See Also

Project CorLib Overview

Class SHA384 Overview


SHA384: Initialize

Initialize

Resets the hashing algorithm to start again.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class SHA384 Overview


SHA384: InputBlockSize (get)

InputBlockSize

Returns the input block size used by the SHA-1 hash implementation.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Returns the block size in bytes.

Read Only.

See Also

Project CorLib Overview

Class SHA384 Overview


SHA384: OutputBlockSize (get)

OutputBlockSize

Returns the output block size created by the SHA-1 hash implementation.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Returns the block size in bytes.

Read Only.

See Also

Project CorLib Overview

Class SHA384 Overview


SHA384: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class SHA384 Overview


SHA384: TransformBlock

TransformBlock

Computes the hash for the specified block of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to compute the hash from.
InputOffset
[ByVal] Long. The starting index in the input data to compute the hash.
InputCount
[ByVal] Long. The number of bytes to compute the hash from.
OutputBuffer
[ByRef] Byte. The array to place the input buffer bytes in.
OutputOffset
[ByVal] Long. The starting index to beging copying the bytes to.

Return Values

Long - The number of bytes processed.

Remarks

The OutputBuffer will contain the same data as the InputBuffer. No hash values are placed in the OutputBuffer.

If the OutputBuffer is a Null Array, or is the same array as the InputBuffer and the OutputOffset equals the InputOffset, then nothing is copied, however, the hash is still computed on the InputBuffer data.

The TransformFinalBlock needs to be called to finish computing the hash, this method alone cannot compute the entire hash.

See Also

Project CorLib Overview

Class SHA384 Overview


SHA384: TransformFinalBlock

TransformFinalBlock

Computes the final hash value.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( ) :

Parameters

InputBuffer
[ByRef] Byte. The final block of data to compute the hash for.
InputOffset
[ByVal] Long. The index in the InputBuffer to begin computing data.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - Returns the section of the InputBuffer that was processed.

Remarks

This does not return the computed hash value. A copy of the data that was process is returned. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class SHA384 Overview


SHA384Managed

SHA384Managed

Provides services to compute the SHA-384 hash value.

Implements:

HashAlgorithm
ICryptoTransform
IObject
SHA384

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if this service provider can be reused to transfrom more data.
CanTransformMultipleBlocks (get) | Returns if this transform can operate on multiple blocks at once.
Hash (get) | Returns the computed hash.
HashSize (get) | Returns the size of the computed hash.
InputBlockSize (get) | Returns the input block size this transform can work on.
OutputBlockSize (get) | Returns the output block size this transform can produce.

Methods:

Name | Description
Clear | Releases any resources.
ComputeHash | Computes a hash value for a source in a single pass.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Initialize | Resets the hashing algorithm to start again.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Computes the hash for the specified block of data.
TransformFinalBlock | Computes the final hash value.

Remarks

The SHA-384 algorithm is implemented in Visual Basic.

Details can be found at http://csrc.nist.gov/CryptoToolkit/tkhash.html

See Also

Project CorLib Overview

Class SHA384Managed Overview

HashAlgorithm


SHA384Managed: CanReuseTransform (get)

CanReuseTransform

Returns if this service provider can be reused to transfrom more data.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class SHA384Managed Overview


SHA384Managed: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if this transform can operate on multiple blocks at once.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class SHA384Managed Overview


SHA384Managed: Clear

Clear

Releases any resources.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class SHA384Managed Overview


SHA384Managed: ComputeHash

ComputeHash

Computes a hash value for a source in a single pass.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Source
[ByRef] Variant. This can be either a Byte array or any Stream compatible object.
Index
[ByRef] Optional. Variant. The starting index in the Byte array. This is ignored for Stream objects.
Count
[ByRef] Optional. Variant. The number of bytes in the array to be computed. This is ignored for Stream objects.

Return Values

Byte() - A 48-byte hash value.

Remarks

If a Stream object is passed in, then the stream is continuously read and the hash calculated until there is no more data left to read from the stream.

See Also

Project CorLib Overview

Class SHA384Managed Overview


SHA384Managed: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the values are the same.

See Also

Project CorLib Overview

Class SHA384Managed Overview


SHA384Managed: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class SHA384Managed Overview


SHA384Managed: Hash (get)

Hash

Returns the computed hash.

 Public Property Get Hash ( ) As Byte ( )

Return Values

Byte() - A 48-byte array containing the hash value.

Remarks

The TransformFinalBlock must be called before accessing this property or an InvalidOperationException will be thrown.

Read Only.

See Also

Project CorLib Overview

Class SHA384Managed Overview


SHA384Managed: HashAlgorithm

HashAlgorithm

 Implements HashAlgorithm

Return Values

HashAlgorithm -

See Also

Project CorLib Overview

Class SHA384Managed Overview


SHA384Managed: HashSize (get)

HashSize

Returns the size of the computed hash.

 Public Property Get HashSize ( ) As Long

Return Values

Long - Always returns 384 bits.

Read Only.

See Also

Project CorLib Overview

Class SHA384Managed Overview


SHA384Managed: ICryptoTransform

ICryptoTransform

 Implements ICryptoTransform

Return Values

ICryptoTransform -

See Also

Project CorLib Overview

Class SHA384Managed Overview


SHA384Managed: Initialize

Initialize

Resets the hashing algorithm to start again.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class SHA384Managed Overview


SHA384Managed: InputBlockSize (get)

InputBlockSize

Returns the input block size this transform can work on.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Remarks

When calling the TransformBlock method, the InputCount must be zero or a multiple of this value.

Read Only.

See Also

Project CorLib Overview

Class SHA384Managed Overview


SHA384Managed: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class SHA384Managed Overview


SHA384Managed: OutputBlockSize (get)

OutputBlockSize

Returns the output block size this transform can produce.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Read Only.

See Also

Project CorLib Overview

Class SHA384Managed Overview


SHA384Managed: SHA384

SHA384

 Implements SHA384

Return Values

SHA384 -

See Also

Project CorLib Overview

Class SHA384Managed Overview


SHA384Managed: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class SHA384Managed Overview


SHA384Managed: TransformBlock

TransformBlock

Computes the hash for the specified block of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to compute the hash from.
InputOffset
[ByVal] Long. The starting index in the input data to compute the hash.
InputCount
[ByVal] Long. The number of bytes to compute the hash from.
OutputBuffer
[ByRef] Byte. The array to place the input buffer bytes in.
OutputOffset
[ByVal] Long. The starting index to beging copying the bytes to.

Return Values

Long - The number of bytes processed.

Remarks

The OutputBuffer will contain the same data as the InputBuffer. No hash values are placed in the OutputBuffer.

If the OutputBuffer is a Null Array, or is the same array as the InputBuffer and the OutputOffset equals the InputOffset, then nothing is copied, however, the hash is still computed on the InputBuffer data.

The TransformFinalBlock needs to be called to finish computing the hash, this method alone cannot compute the entire hash.

See Also

Project CorLib Overview

Class SHA384Managed Overview


SHA384Managed: TransformFinalBlock

TransformFinalBlock

Computes the final hash value.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The final block of data to compute the hash for.
InputOffset
[ByVal] Long. The index in the InputBuffer to begin computing data.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - Returns the section of the InputBuffer that was processed.

Remarks

This does not return the computed hash value. A copy of the data that was process is returned. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class SHA384Managed Overview


SHA384Static

SHA384Static

Provides methods associated with the SHA-384 class.

Public:

Methods:

Name | Description
Create | Creates a new instance of an SHA-384 implementation.

See Also

Project CorLib Overview

Class SHA384Static Overview


SHA384Static: Create

Create

Creates a new instance of an SHA-384 implementation.

 Public Function Create(
      Optional ByRef AlgName As String = "CorLib.SHA384" ) As SHA384

Parameters

AlgName
[ByRef] Optional. String. The name of the implementation to create an instance of.

Default: "CorLib.SHA384"

Return Values

SHA384 - A new SHA-384 compatible implementation.

Remarks

If not name is given, then a new SHA384Managed is returned.

See Also

Project CorLib Overview

Class SHA384Static Overview


SHA512

SHA512

Represents a standard interface for SHA-512 class implementations.

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if the SHA-512 implementation can be reused after a final transformation.
CanTransformMultipleBlocks (get) | Returns if an SHA-512 implementation can transform multiple blocks at a time.
Hash (get) | Returns the final hash value generated after performing the hashing algorithm.
HashSize (get) | Returns the size of the hash in bits.
InputBlockSize (get) | Returns the input block size used by the SHA-1 hash implementation.
OutputBlockSize (get) | Returns the output block size created by the SHA-1 hash implementation.

Methods:

Name | Description
Clear | Releases any resources used by the hash implementation.
ComputeHash | Computes the hash for a give source.
Equals | Returns if the value is equal to this object instance.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Initialize | Resets the hashing algorithm to start again.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Computes the hash for the specified block of data.
TransformFinalBlock | Computes the final hash value.

See Also

Project CorLib Overview

Class SHA512 Overview

SHA512Managed


SHA512: CanReuseTransform (get)

CanReuseTransform

Returns if the SHA-512 implementation can be reused after a final transformation.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Returns True if an instance can be reused, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class SHA512 Overview


SHA512: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if an SHA-512 implementation can transform multiple blocks at a time.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Returns True if an instance can transform multiple blocks at once, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class SHA512 Overview


SHA512: Clear

Clear

Releases any resources used by the hash implementation.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class SHA512 Overview


SHA512: ComputeHash

ComputeHash

Computes the hash for a give source.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( ) :

Parameters

Source
[ByRef] Variant. The source to compute the hash for.
Index
[ByRef] Optional. Variant. The starting index in a byte array to begin computing the hash.
Count
[ByRef] Optional. Variant. The number of bytes to use to compute the hash.

Return Values

Byte() - A 64-byte array containing the computed hash.

Remarks

The Source can be either a byte-array or a Stream object.

If the source is a Stream object, then the hash continues to read the stream until no more data is can be read. The hash is computed from all data read from the stream.

See Also

Project CorLib Overview

Class SHA512 Overview


SHA512: Equals

Equals

Returns if the value is equal to this object instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the value and this instance are equal, False otherwise.

See Also

Project CorLib Overview

Class SHA512 Overview


SHA512: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class SHA512 Overview


SHA512: Hash (get)

Hash

Returns the final hash value generated after performing the hashing algorithm.

 Public Property Get Hash ( ) As Byte ( ) :

Return Values

Byte() - A 64 byte array representing the final hash.

Read Only.

See Also

Project CorLib Overview

Class SHA512 Overview


SHA512: HashSize (get)

HashSize

Returns the size of the hash in bits.

 Public Property Get HashSize ( ) As Long

Return Values

Long - Returns 512 for SHA-512 hashes.

Read Only.

See Also

Project CorLib Overview

Class SHA512 Overview


SHA512: Initialize

Initialize

Resets the hashing algorithm to start again.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class SHA512 Overview


SHA512: InputBlockSize (get)

InputBlockSize

Returns the input block size used by the SHA-1 hash implementation.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Returns the block size in bytes.

Read Only.

See Also

Project CorLib Overview

Class SHA512 Overview


SHA512: OutputBlockSize (get)

OutputBlockSize

Returns the output block size created by the SHA-1 hash implementation.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Returns the block size in bytes.

Read Only.

See Also

Project CorLib Overview

Class SHA512 Overview


SHA512: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class SHA512 Overview


SHA512: TransformBlock

TransformBlock

Computes the hash for the specified block of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to compute the hash from.
InputOffset
[ByVal] Long. The starting index in the input data to compute the hash.
InputCount
[ByVal] Long. The number of bytes to compute the hash from.
OutputBuffer
[ByRef] Byte. The array to place the input buffer bytes in.
OutputOffset
[ByVal] Long. The starting index to beging copying the bytes to.

Return Values

Long - The number of bytes processed.

Remarks

The OutputBuffer will contain the same data as the InputBuffer. No hash values are placed in the OutputBuffer.

If the OutputBuffer is a Null Array, or is the same array as the InputBuffer and the OutputOffset equals the InputOffset, then nothing is copied, however, the hash is still computed on the InputBuffer data.

The TransformFinalBlock needs to be called to finish computing the hash, this method alone cannot compute the entire hash.

See Also

Project CorLib Overview

Class SHA512 Overview


SHA512: TransformFinalBlock

TransformFinalBlock

Computes the final hash value.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( ) :

Parameters

InputBuffer
[ByRef] Byte. The final block of data to compute the hash for.
InputOffset
[ByVal] Long. The index in the InputBuffer to begin computing data.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - Returns the section of the InputBuffer that was processed.

Remarks

This does not return the computed hash value. A copy of the data that was process is returned. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class SHA512 Overview


SHA512Managed

SHA512Managed

Provides services to compute the SHA-512 hash value.

Implements:

HashAlgorithm
ICryptoTransform
IHashAlgorithm
IObject
SHA512

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if this service provider can be reused to transfrom more data.
CanTransformMultipleBlocks (get) | Returns if this transform can operate on multiple blocks at once.
Hash (get) | Returns the computed hash.
HashSize (get) | Returns the size of the computed hash.
InputBlockSize (get) | Returns the input block size this transform can work on.
OutputBlockSize (get) | Returns the output block size this transform can produce.

Methods:

Name | Description
Clear | Releases any resources.
ComputeHash | Computes a hash value for a source in a single pass.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
Initialize | Resets the hashing algorithm to start again.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Computes the hash for the specified block of data.
TransformFinalBlock | Computes the final hash value.

Remarks

The SHA-512 algorithm is implemented in Visual Basic.

Details can be found at http://csrc.nist.gov/CryptoToolkit/tkhash.html

See Also

Project CorLib Overview

Class SHA512Managed Overview

HashAlgorithm


SHA512Managed: CanReuseTransform (get)

CanReuseTransform

Returns if this service provider can be reused to transfrom more data.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Managed: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if this transform can operate on multiple blocks at once.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Always returns True.

Read Only.

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Managed: Clear

Clear

Releases any resources.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Managed: ComputeHash

ComputeHash

Computes a hash value for a source in a single pass.

 Public Function ComputeHash(
      ByRef Source As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Source
[ByRef] Variant. This can be either a Byte array or any Stream compatible object.
Index
[ByRef] Optional. Variant. The starting index in the Byte array. This is ignored for Stream objects.
Count
[ByRef] Optional. Variant. The number of bytes in the array to be computed. This is ignored for Stream objects.

Return Values

Byte() - A 64-byte hash value.

Remarks

If a Stream object is passed in, then the stream is continuously read and the hash calculated until there is no more data left to read from the stream.

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Managed: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the values are the same.

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Managed: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Managed: Hash (get)

Hash

Returns the computed hash.

 Public Property Get Hash ( ) As Byte ( )

Return Values

Byte() - A 64-byte array containing the hash value.

Remarks

The TransformFinalBlock must be called before accessing this property or an InvalidOperationException will be thrown.

Read Only.

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Managed: HashAlgorithm

HashAlgorithm

 Implements HashAlgorithm

Return Values

HashAlgorithm -

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Managed: HashSize (get)

HashSize

Returns the size of the computed hash.

 Public Property Get HashSize ( ) As Long

Return Values

Long - Always returns 512 bits.

Read Only.

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Managed: ICryptoTransform

ICryptoTransform

 Implements ICryptoTransform

Return Values

ICryptoTransform -

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Managed: IHashAlgorithm

IHashAlgorithm

 Implements IHashAlgorithm

Return Values

IHashAlgorithm -

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Managed: Initialize

Initialize

Resets the hashing algorithm to start again.

 Public Sub Initialize ( )

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Managed: InputBlockSize (get)

InputBlockSize

Returns the input block size this transform can work on.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Remarks

When calling the TransformBlock method, the InputCount must be zero or a multiple of this value.

Read Only.

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Managed: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Managed: OutputBlockSize (get)

OutputBlockSize

Returns the output block size this transform can produce.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - Always returns 1.

Read Only.

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Managed: SHA512

SHA512

 Implements SHA512

Return Values

SHA512 -

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Managed: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Managed: TransformBlock

TransformBlock

Computes the hash for the specified block of data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. The data to compute the hash from.
InputOffset
[ByVal] Long. The starting index in the input data to compute the hash.
InputCount
[ByVal] Long. The number of bytes to compute the hash from.
OutputBuffer
[ByRef] Byte. The array to place the input buffer bytes in.
OutputOffset
[ByVal] Long. The starting index to beging copying the bytes to.

Return Values

Long - The number of bytes processed.

Remarks

The OutputBuffer will contain the same data as the InputBuffer. No hash values are placed in the OutputBuffer.

If the OutputBuffer is a Null Array, or is the same array as the InputBuffer and the OutputOffset equals the InputOffset, then nothing is copied, however, the hash is still computed on the InputBuffer data.

The TransformFinalBlock needs to be called to finish computing the hash, this method alone cannot compute the entire hash.

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Managed: TransformFinalBlock

TransformFinalBlock

Computes the final hash value.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. The final block of data to compute the hash for.
InputOffset
[ByVal] Long. The index in the InputBuffer to begin computing data.
InputCount
[ByVal] Long. The number of bytes to be processed.

Return Values

Byte() - Returns the section of the InputBuffer that was processed.

Remarks

This does not return the computed hash value. A copy of the data that was process is returned. To retrieve the hash value, call the Hash property.

See Also

Project CorLib Overview

Class SHA512Managed Overview


SHA512Static

SHA512Static

Provides methods associated with the SHA-512 class.

Public:

Methods:

Name | Description
Create | Creates a new instance of an SHA-512 implementation.

See Also

Project CorLib Overview

Class SHA512Static Overview


SHA512Static: Create

Create

Creates a new instance of an SHA-512 implementation.

 Public Function Create(
      Optional ByRef AlgName As String = "CorLib.SHA512" ) As SHA512

Parameters

AlgName
[ByRef] Optional. String. The name of the implementation to create an instance of.

Default: "CorLib.SHA512"

Return Values

SHA512 - A new SHA-512 compatible implementation.

Remarks

If not name is given, then a new SHA512Managed is returned.

See Also

Project CorLib Overview

Class SHA512Static Overview


SortedList

SortedList

Provides a means to maintain a list of sorted items based on an associated key.

Implements:

ICollection
IDictionary
IEnumerable
IObject
IVersionable

Public:

Properties:

Name | Description
Capacity (get) | Gets the capacity of the SortedList object.
Capacity (let) | Gets the capacity of the SortedList object.
Count (get) | Gets the number of elements contained in a SortedList object.
IsFixedSize (get) | Gets a value indicating whether a SortedList object has a fixed size.
IsReadOnly (get) | Gets a value indicating whether a SortedList object is read-only.
Item (get) | Gets the value associated with a specific key in a SortedList object.
Item (let) | Sets the value associated with a specific key in a SortedList object.
Item (set) | Sets the value associated with a specific key in a SortedList object.
Keys (get) | Gets the keys in the SortedList object.
Values (get) | Gets the values in the SortedList object.

Methods:

Name | Description
Add | Adds an element with the specified key and value to a SortedList object..
Clear | Removes all of the items from the SortedList object.
Clone | Returns a cloned version of this instance.
Contains | Determines whether a SortedList object contains a specific key.
ContainsKey | Determines whether a SortedList object contains a specific key.
ContainsValue | Determines whether a SortedList object contains a specific value.
CopyTo | Copies SortedList elements to a one-dimensional array, starting at the specified index in the array.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetByIndex | Gets the value at the specified index of a SortedList object.
GetEnumerator | Returns an enumerator that can be used to iterate through the key/value pairs.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetKey | Returns the key at the specified index in the list.
GetKeyList | Gets the keys in a SortedList object.
GetValueList | Gets the values in a SortedList object.
IndexOfKey | Returns the zero-based index of the specified key in a SortedList object.
IndexOfValue | Returns the zero-based index of the first occurrence of the specified value in a SortedList object.
Remove | Removes the element with the specified key from a SortedList object.
RemoveAt | Removes the element at the specified index of a SortedList object.
SetByIndex | Replaces the value at a specific index in a SortedList object.
ToString | Returns a string representation of this object instance.
TrimToSize | Sets the capacity to the actual number of elements in a SortedList object.

Remarks

The SortedList maintains sort order for every key/value pair added to the list. The list is expanded as needed with the addition of new items. If a key already exists in the list, an exception is thrown.

See Also

Project CorLib Overview

Class SortedList Overview

Constructors

IDictionary

ICollection

IEnumerable


SortedList: Add

Add

Adds an element with the specified key and value to a SortedList object..

 Public Sub Add(
      ByRef Key As Variant,
      ByRef Value As Variant )

Parameters

Key
[ByRef] Variant. The value to used to maintain a sorted order.
Value
[ByRef] Variant. The value associated with the key.

Remark

The insertion point is determined based on the comparer selected, either explicitly or by default, when the SortedList object was created.

You can also use the Item property to add new elements by setting the value of a key that does not exist in the SortedList object (for example, myCollection("myNonexistentKey") = myValue). However, if the specified key already exists in the SortedList, setting the Item property overwrites the old value. In contrast, the Add method does not modify existing elements.

The elements of a SortedList object are sorted by the keys either according to a specific IComparer implementation specified when the SortedList is created.

Exceptions

Exception | Condition
ArgumentException | An element with the specified Key already exists in the SortedList object. -or- The comparer throws an exception.
NotSupportedException | The SortedList is read-only. -or- The SortedList has a fixed size.

Examples

The following code example shows how to add elements to a SortedList object.

Public Sub Main()
    Dim List As New SortedList

    List.Add "one", "The"
    List.Add "two", "quick"
    List.Add "three", "brown"
    List.Add "four", "fox"

    Debug.Print "The SortedList contains the following sorted by key:"
    PrintKeysAndValues List
End Sub

Private Sub PrintKeysAndValues(ByVal List As SortedList)
    Dim i As Long

    Debug.Print "-KEY-", "-VALUE-"

    For i = 0 To List.Count - 1
        Debug.Print List.GetKey(i), List.GetByIndex(i)
    Next

    Debug.Print
End Sub

' This code produces the following output.
'
'    The SortedList contains the following:
'    -KEY-         -VALUE-
'    four          fox
'    one           The
'    three         brown
'    two           quick

See Also

Project CorLib Overview

Class SortedList Overview

Item

IComparer


SortedList: Capacity (get)

Capacity

Gets the capacity of the SortedList object.

 Public Property Get Capacity ( ) As Long

Return Values

Long - The number of elements that the SortedList object can contain.

Remarks

Capacity is the number of elements that the SortedList object can store. Count is the number of elements that are actually in the SortedList.

Capacity is always greater than or equal to Count. If Count exceeds Capacity while adding elements, the capacity is automatically increased by reallocating the internal array before copying the old elements and adding the new elements.

The capacity can be decreased by calling TrimToSize or by setting the Capacity property explicitly. When the value of Capacity is set explicitly, the internal array is also reallocated to accommodate the specified capacity.

Read/Write.

See Also

Project CorLib Overview

Class SortedList Overview


SortedList: Capacity (let)

Capacity

Gets the capacity of the SortedList object.

 Public Property Let Capacity(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The number of elements the SortedList object can contain.

Remarks

Capacity is the number of elements that the SortedList object can store. Count is the number of elements that are actually in the SortedList.

Capacity is always greater than or equal to Count. If Count exceeds Capacity while adding elements, the capacity is automatically increased by reallocating the internal array before copying the old elements and adding the new elements.

The capacity can be decreased by calling TrimToSize or by setting the Capacity property explicitly. When the value of Capacity is set explicitly, the internal array is also reallocated to accommodate the specified capacity.

Read/Write.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | The value assigned is less than the current number of elements in the SortedList object.

See Also

Project CorLib Overview

Class SortedList Overview


SortedList: Clear

Clear

Removes all of the items from the SortedList object.

 Public Sub Clear ( )

Remarks

Count is set to zero and elements are cleared from the collection.

Capacity remains unchanged. To reset the capacity of the SortedList object, call TrimToSize or set the Capacity property directly.

See Also

Project CorLib Overview

Class SortedList Overview


SortedList: Clone

Clone

Returns a cloned version of this instance.

 Public Function Clone ( ) As SortedList

Return Values

SortedList -

Remarks

Reference types are not cloned. If there are object types in the list, then a new reference to the object is created, but the object itself is not cloned.

See Also

Project CorLib Overview

Class SortedList Overview


SortedList: Contains

Contains

Determines whether a SortedList object contains a specific key.

 Public Function Contains(
      ByRef Key As Variant ) As Boolean

Parameters

Key
[ByRef] Variant. The key to locate in the SortedList object.

Return Values

Boolean - True if the SortedList object contains an element with specified Key; otherwise False.

Remarks

The elements of a SortedList object are sorted by the keys either according to a specific IComparer implementation specified when the SortedList is created.

This method behaves exactly as the ContainsKey method.

This method uses a binary search algorithm; therefore, this method is an O(log n) operation, where n is Count.

Exceptions

Exception | Condition
InvalidOperationException | The comparer throws an exception.

Examples

The following code example shows how to determine whether a SortedList object contains a specific element.

Public Sub Main()
    Dim List As New SortedList
    Dim TempArray() As String
    Dim TargetArray() As DictionaryEntry
    Dim i As Long

    List.Add 2, "cats"
    List.Add 3, "in"
    List.Add 1, "napping"
    List.Add 4, "the"
    List.Add 0, "three"
    List.Add 5, "barn"

    TempArray = NewStrings("The", "quick", "brown", "fox", "jumped", "over", "the", "lazy", "dog")
    ReDim TargetArray(0 To 14)

    For i = 0 To UBound(TargetArray)
        If i &lt;= UBound(TempArray) Then
            Set TargetArray(i) = NewDictionaryEntry(i, TempArray(i))
        Else
            Set TargetArray(i) = NewDictionaryEntry(i, "")
        End If
    Next

    Debug.Print "The target Array contains the following (before and after copying):"
    PrintValues TargetArray

    List.CopyTo TargetArray, 6

    PrintValues TargetArray
End Sub

Private Sub PrintValues(ByRef Arr() As DictionaryEntry)
    Dim i As Long

    For i = LBound(Arr) To UBound(Arr)
        Debug.Print " "; Arr(i).Value;
    Next

    Debug.Print
End Sub

' The code produces the following output.
'
'    The target Array contains the following (before and after copying):
'     The quick brown fox jumped over the lazy dog
'     The quick brown fox jumped over three napping cats in the barn

See Also

Project CorLib Overview

Class SortedList Overview

ContainsKey

ContainsValue


SortedList: ContainsKey

ContainsKey

Determines whether a SortedList object contains a specific key.

 Public Function ContainsKey(
      ByRef Key As Variant ) As Boolean

Parameters

Key
[ByRef] Variant. The key to locate in the SortedList object.

Return Values

Boolean - Indication of the key existing in the list.

Remarks

The elements of a SortedList object are sorted by the keys either according to a specific IComparer implementation specified when the SortedList is created.

This method behaves exactly as the Contains.

This method uses a binary search algorithm; therefore, this method is an O(log n) operation, where n is Count.

Exceptions

Exception | Condition
InvalidOperationException | The comparer throws an exception.

Examples

The following code example shows how to determine whether a SortedList object contains a specific element.

Public Sub Main()
    Dim List As New SortedList
    Dim TempArray() As String
    Dim TargetArray() As DictionaryEntry
    Dim i As Long

    List.Add 2, "cats"
    List.Add 3, "in"
    List.Add 1, "napping"
    List.Add 4, "the"
    List.Add 0, "three"
    List.Add 5, "barn"

    TempArray = NewStrings("The", "quick", "brown", "fox", "jumped", "over", "the", "lazy", "dog")
    ReDim TargetArray(0 To 14)

    For i = 0 To UBound(TargetArray)
        If i &lt;= UBound(TempArray) Then
            Set TargetArray(i) = NewDictionaryEntry(i, TempArray(i))
        Else
            Set TargetArray(i) = NewDictionaryEntry(i, "")
        End If
    Next

    Debug.Print "The target Array contains the following (before and after copying):"
    PrintValues TargetArray

    List.CopyTo TargetArray, 6

    PrintValues TargetArray
End Sub

Private Sub PrintValues(ByRef Arr() As DictionaryEntry)
    Dim i As Long

    For i = LBound(Arr) To UBound(Arr)
        Debug.Print " "; Arr(i).Value;
    Next

    Debug.Print
End Sub

' The code produces the following output.
'
'    The target Array contains the following (before and after copying):
'     The quick brown fox jumped over the lazy dog
'     The quick brown fox jumped over three napping cats in the barn

See Also

Project CorLib Overview

Class SortedList Overview

Contains

ContainsValue


SortedList: ContainsValue

ContainsValue

Determines whether a SortedList object contains a specific value.

 Public Function ContainsValue(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to locate for in the SortedList object.

Return Values

Boolean - True if the SortedList object contains an element with the specified Value; otherwise, False.

Remarks

This method performs a linear search; therefore, the average execution time is proportional to Count. That is, this method is an O(n) operation, where n is Count.

Examples

The following code example shows how to determine whether a SortedList object contains a specific element.

Public Sub Main()
    Dim List As New SortedList
    Dim TempArray() As String
    Dim TargetArray() As DictionaryEntry
    Dim i As Long

    List.Add 2, "cats"
    List.Add 3, "in"
    List.Add 1, "napping"
    List.Add 4, "the"
    List.Add 0, "three"
    List.Add 5, "barn"

    TempArray = NewStrings("The", "quick", "brown", "fox", "jumped", "over", "the", "lazy", "dog")
    ReDim TargetArray(0 To 14)

    For i = 0 To UBound(TargetArray)
        If i &lt;= UBound(TempArray) Then
            Set TargetArray(i) = NewDictionaryEntry(i, TempArray(i))
        Else
            Set TargetArray(i) = NewDictionaryEntry(i, "")
        End If
    Next

    Debug.Print "The target Array contains the following (before and after copying):"
    PrintValues TargetArray

    List.CopyTo TargetArray, 6

    PrintValues TargetArray
End Sub

Private Sub PrintValues(ByRef Arr() As DictionaryEntry)
    Dim i As Long

    For i = LBound(Arr) To UBound(Arr)
        Debug.Print " "; Arr(i).Value;
    Next

    Debug.Print
End Sub

' The code produces the following output.
'
'    The target Array contains the following (before and after copying):
'     The quick brown fox jumped over the lazy dog
'     The quick brown fox jumped over three napping cats in the barn

See Also

Project CorLib Overview

Class SortedList Overview

Contains

ContainsKey


SortedList: CopyTo

CopyTo

Copies SortedList elements to a one-dimensional array, starting at the specified index in the array.

 Public Sub CopyTo(
      ByRef Arr As Variant,
      ByVal ArrayIndex As Long )

Parameters

Arr
[ByRef] Variant. The one-dimensional array that is the destination of the DictionaryEntry objects copied from SortedList.
ArrayIndex
[ByVal] Long. The starting index in Arr to begin copying to.

Remarks

The key/value pairs are copied to the array in the same order in which the enumerator iterates through the SortedList object.

To copy only the keys in the SortedList, use SortedList.Keys.CopyTo.

To copy only the values in the SortedList, use SortedList.Values.CopyTo.

Exceptions

Exception | Condition
ArgumentNullException | Arr is uninitialized.
ArgumentOutOfRangeException | ArrayIndex is less than the lower-bound of Arr.
ArgumentException | Arr is multidimensional. -or- The number of elements in the source SortedList object is greater than the available space from ArrayIndex to the end of the destination array.
InvalidCastException | The type of the source SortedList cannot be cast automatically to the type of the destination array.

Examples

The following code example shows how to copy the values in a SortedList object into a one-dimensional array.

Public Sub Main()
    Dim List As New SortedList
    Dim TempArray() As String
    Dim TargetArray() As DictionaryEntry
    Dim i As Long

    List.Add 2, "cats"
    List.Add 3, "in"
    List.Add 1, "napping"
    List.Add 4, "the"
    List.Add 0, "three"
    List.Add 5, "barn"

    TempArray = NewStrings("The", "quick", "brown", "fox", "jumped", "over", "the", "lazy", "dog")
    ReDim TargetArray(0 To 14)

    For i = 0 To UBound(TargetArray)
        If i &lt;= UBound(TempArray) Then
            Set TargetArray(i) = NewDictionaryEntry(i, TempArray(i))
        Else
            Set TargetArray(i) = NewDictionaryEntry(i, "")
        End If
    Next

    Debug.Print "The target Array contains the following (before and after copying):"
    PrintValues TargetArray

    List.CopyTo TargetArray, 6

    PrintValues TargetArray
End Sub

Private Sub PrintValues(ByRef Arr() As DictionaryEntry)
    Dim i As Long

    For i = LBound(Arr) To UBound(Arr)
        Debug.Print " "; Arr(i).Value;
    Next

    Debug.Print
End Sub

' The code produces the following output.
'
'    The target Array contains the following (before and after copying):
'     The quick brown fox jumped over the lazy dog
'     The quick brown fox jumped over three napping cats in the barn

See Also

Project CorLib Overview

Class SortedList Overview

DictionaryEntry


SortedList: Count (get)

Count

Gets the number of elements contained in a SortedList object.

 Public Property Get Count ( ) As Long

Return Values

Long - The number of elements in the SortedList object.

Remarks

Capacity is the number of elements that the SortedList object can store. Count is the number of elements that are actually in the SortedList.

Capacity is always greater than or equal to Count. If Count exceeds Capacity while adding elements, the capacity is automatically increased by reallocating the internal array before copying the old elements and adding the new elements.

Read Only.

See Also

Project CorLib Overview

Class SortedList Overview

Capacity


SortedList: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class SortedList Overview


SortedList: GetByIndex

GetByIndex

Gets the value at the specified index of a SortedList object.

 Public Function GetByIndex(
      ByVal Index As Long ) As Variant

Parameters

Index
[ByVal] Long. The zero-based index of the value to get.

Return Values

Variant - The value at the specified index in the SortedList object.

Remarks

The index sequence is based on the sort sequence. When an element is added, it is inserted into SortedList in the correct sort order, and the indexing adjusts accordingly. When an element is removed, the indexing also adjusts accordingly. Therefore, the index of a specific key/value pair might change as elements are added or removed from the SortedList object.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Index is outside the range of valid indexes for the SortedList object.

Examples

The following code example shows how to get one or all the keys or values in a SortedList object.

Public Sub Main()
    Dim List As New SortedList
    Dim KeyList As IList
    Dim ValueList As IList
    Dim Index As Long
    Dim i As Long

    List.Add 1.3, "fox"
    List.Add 1.4, "jumped"
    List.Add 1.5, "over"
    List.Add 1.2, "brown"
    List.Add 1.1, "quick"
    List.Add 1#, "The"
    List.Add 1.6, "the"
    List.Add 1.8, "dog"
    List.Add 1.7, "lazy"

    Index = 3
    Debug.Print CorString.Format("The key   at index {0} is {1}.", Index, List.GetKey(Index))
    Debug.Print CorString.Format("The value at index {0} is {1}.", Index, List.GetByIndex(Index))

    Set KeyList = List.GetKeyList
    Set ValueList = List.GetValueList

    Debug.Print , "Key", "Value"

    For i = 0 To List.Count - 1
        Debug.Print , KeyList(i), ValueList(i)
    Next
End Sub

' The code produces the following output.
'
'    The key   at index 3 is 1.3.
'    The value at index 3 is fox.
'      Key           Value
'       1            The
'       1.1          quick
'       1.2          brown
'       1.3          fox
'       1.4          jumped
'       1.5          over
'       1.6          the
'       1.7          lazy
'       1.8          dog

See Also

Project CorLib Overview

Class SortedList Overview

IndexOfKey

IndexOfValue


SortedList: GetEnumerator

GetEnumerator

Returns an enumerator that can be used to iterate through the key/value pairs.

 Public Function GetEnumerator ( ) As IEnumerator

Return Values

IEnumerator - An IEnumerator object to be use for iterating the key/value pairs.

See Also

Project CorLib Overview

Class SortedList Overview


SortedList: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class SortedList Overview


SortedList: GetKey

GetKey

Returns the key at the specified index in the list.

 Public Function GetKey(
      ByVal Index As Long ) As Variant

Parameters

Index
[ByVal] Long. The index into the list from which to retrieve the key.

Return Values

Variant - The key at the specified index.

Remarks

Since the list maintains sort order, when an item is added or removed, there is no garauntee that the same key will be found at the same index in future calls.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Index is outside the range of valid indexes for the SortedList object.

Examples

The following code example shows how to get one or all the keys or values in a SortedList object.

Public Sub Main()
    Dim List As New SortedList
    Dim KeyList As IList
    Dim ValueList As IList
    Dim Index As Long
    Dim i As Long

    List.Add 1.3, "fox"
    List.Add 1.4, "jumped"
    List.Add 1.5, "over"
    List.Add 1.2, "brown"
    List.Add 1.1, "quick"
    List.Add 1#, "The"
    List.Add 1.6, "the"
    List.Add 1.8, "dog"
    List.Add 1.7, "lazy"

    Index = 3
    Debug.Print CorString.Format("The key   at index {0} is {1}.", Index, List.GetKey(Index))
    Debug.Print CorString.Format("The value at index {0} is {1}.", Index, List.GetByIndex(Index))

    Set KeyList = List.GetKeyList
    Set ValueList = List.GetValueList

    Debug.Print , "Key", "Value"

    For i = 0 To List.Count - 1
        Debug.Print , KeyList(i), ValueList(i)
    Next
End Sub

' The code produces the following output.
'
'    The key   at index 3 is 1.3.
'    The value at index 3 is fox.
'      Key           Value
'       1            The
'       1.1          quick
'       1.2          brown
'       1.3          fox
'       1.4          jumped
'       1.5          over
'       1.6          the
'       1.7          lazy
'       1.8          dog

See Also

Project CorLib Overview

Class SortedList Overview


SortedList: GetKeyList

GetKeyList

Gets the keys in a SortedList object.

 Public Function GetKeyList ( ) As IList

Return Values

IList - An IList object containing the keys in the SortedList object.

Remarks

The returned IList object is a read-only view of the keys of the SortedList object. Modifications made to the underlying SortedList are immediately reflected in the IList.

The elements of the returned IList are sorted in the same order as the keys of the SortedList.

This method is similar to the Keys property, but returns an IList object instead of an ICollection object.

Examples

The following code example shows how to get one or all the keys or values in a SortedList object.

Public Sub Main()
    Dim List As New SortedList
    Dim KeyList As IList
    Dim ValueList As IList
    Dim Index As Long
    Dim i As Long

    List.Add 1.3, "fox"
    List.Add 1.4, "jumped"
    List.Add 1.5, "over"
    List.Add 1.2, "brown"
    List.Add 1.1, "quick"
    List.Add 1#, "The"
    List.Add 1.6, "the"
    List.Add 1.8, "dog"
    List.Add 1.7, "lazy"

    Index = 3
    Debug.Print CorString.Format("The key   at index {0} is {1}.", Index, List.GetKey(Index))
    Debug.Print CorString.Format("The value at index {0} is {1}.", Index, List.GetByIndex(Index))

    Set KeyList = List.GetKeyList
    Set ValueList = List.GetValueList

    Debug.Print , "Key", "Value"

    For i = 0 To List.Count - 1
        Debug.Print , KeyList(i), ValueList(i)
    Next
End Sub

' The code produces the following output.
'
'    The key   at index 3 is 1.3.
'    The value at index 3 is fox.
'      Key           Value
'       1            The
'       1.1          quick
'       1.2          brown
'       1.3          fox
'       1.4          jumped
'       1.5          over
'       1.6          the
'       1.7          lazy
'       1.8          dog

See Also

Project CorLib Overview

Class SortedList Overview

IList

GetValueList

Keys


SortedList: GetValueList

GetValueList

Gets the values in a SortedList object.

 Public Function GetValueList ( ) As IList

Return Values

IList - An IList object containing the values in the SortedList object.

Remarks

The returned IList object is a read-only view of the values of the SortedList object. Modifications made to the underlying SortedList are immediately reflected in the IList.

The elements of the returned IList are sorted in the same order as the values of the SortedList.

This method is similar to the Values property, but returns an IList object instead of an ICollection object.

Examples

The following code example shows how to get one or all the keys or values in a SortedList object.

Public Sub Main()
    Dim List As New SortedList
    Dim KeyList As IList
    Dim ValueList As IList
    Dim Index As Long
    Dim i As Long

    List.Add 1.3, "fox"
    List.Add 1.4, "jumped"
    List.Add 1.5, "over"
    List.Add 1.2, "brown"
    List.Add 1.1, "quick"
    List.Add 1#, "The"
    List.Add 1.6, "the"
    List.Add 1.8, "dog"
    List.Add 1.7, "lazy"

    Index = 3
    Debug.Print CorString.Format("The key   at index {0} is {1}.", Index, List.GetKey(Index))
    Debug.Print CorString.Format("The value at index {0} is {1}.", Index, List.GetByIndex(Index))

    Set KeyList = List.GetKeyList
    Set ValueList = List.GetValueList

    Debug.Print , "Key", "Value"

    For i = 0 To List.Count - 1
        Debug.Print , KeyList(i), ValueList(i)
    Next
End Sub

' The code produces the following output.
'
'    The key   at index 3 is 1.3.
'    The value at index 3 is fox.
'      Key           Value
'       1            The
'       1.1          quick
'       1.2          brown
'       1.3          fox
'       1.4          jumped
'       1.5          over
'       1.6          the
'       1.7          lazy
'       1.8          dog

See Also

Project CorLib Overview

Class SortedList Overview

IList

GetKeyList

Values


SortedList: ICollection

ICollection

 Implements ICollection

Return Values

ICollection -

See Also

Project CorLib Overview

Class SortedList Overview


SortedList: IDictionary

IDictionary

 Implements IDictionary

Return Values

IDictionary -

See Also

Project CorLib Overview

Class SortedList Overview


SortedList: IEnumerable

IEnumerable

 Implements IEnumerable

Return Values

IEnumerable -

See Also

Project CorLib Overview

Class SortedList Overview


SortedList: IndexOfKey

IndexOfKey

Returns the zero-based index of the specified key in a SortedList object.

 Public Function IndexOfKey(
      ByRef Key As Variant ) As Long

Parameters

Key
[ByRef] Variant. The key to locate in the SortedList object.

Return Values

Long - The zero-based index of the Key parameter, if Key is found in the SortedList object; otherwise, -1.

Remarks

The elements of a SortedList object are sorted by the keys either according to a specific IComparer implementation specified when the SortedList is created, or the default Comparer.

The index sequence is based on the sort sequence. When an element is added, it is inserted into SortedList in the correct sort order, and the indexing adjusts accordingly. When an element is removed, the indexing also adjusts accordingly. Therefore, the index of a specific key/value pair might change as elements are added or removed from the SortedList.

This method uses a binary search algorithm; therefore, this method is an O(log n) operation, where n is Count.

Exceptions

Exception | Condition
InvalidOperationException | The comparer throws an exception.

Examples

The following code example shows how to determine the index of a key or a value in a SortedList object.

Public Sub Main()
    Dim List As New SortedList
    Dim Key As Integer
    Dim Value As String

    List.Add 1, "one"
    List.Add 3, "three"
    List.Add 2, "two"
    List.Add 4, "four"
    List.Add 0, "zero"

    Debug.Print "The SortedList contains the following values:"
    PrintIndexAndKeysAndValues List

    Key = 2
    Debug.Print CorString.Format("The key ""{0}"" is at index {1}.", Key, List.IndexOfKey(Key))

    Value = "three"
    Debug.Print CorString.Format("The value ""{0}"" is at index {1}.", Value, List.IndexOfValue(Value))
End Sub

Private Sub PrintIndexAndKeysAndValues(ByVal List As SortedList)
    Dim i As Long

    Debug.Print t("-INDEX-\t-KEY-\t-VALUE-")

    For i = 0 To List.Count - 1
        Debug.Print CorString.Format(t("[{0}]:\t{1}\t{2}"), i, List.GetKey(i), List.GetByIndex(i))
    Next

    Debug.Print
End Sub

' The following code produces the following output.
'
'    The SortedList contains the following values:
'    -INDEX- -KEY-   -VALUE-
'    [0]:    0   zero
'    [1]:    1   one
'    [2]:    2   two
'    [3]:    3   three
'    [4]:    4   four
'
'    The key "2" is at index 2.
'    The value "three" is at index 3.

See Also

Project CorLib Overview

Class SortedList Overview

ContainsKey

IndexOfValue


SortedList: IndexOfValue

IndexOfValue

Returns the zero-based index of the first occurrence of the specified value in a SortedList object.

 Public Function IndexOfValue(
      ByRef Value As Variant ) As Long

Parameters

Value
[ByRef] Variant. The value to locate in the SortedList object. The value can be Nothing.

Return Values

Long - The zero-based index of the first occurrence of the value parameter, if value is found in the SortedList object; otherwise, -1.

Remarks

The index sequence is based on the sort sequence. When an element is added, it is inserted into SortedList in the correct sort order, and the indexing adjusts accordingly. When an element is removed, the indexing also adjusts accordingly. Therefore, the index of a specific key/value pair might change as elements are added or removed from the SortedList object.

The values of the elements of the SortedList are compared to the specified value using the Equals method.

This method uses a linear search; therefore, this method is an O(n) operation, where n is Count.

Examples

The following code example shows how to determine the index of a key or a value in a SortedList object.

Public Sub Main()
    Dim List As New SortedList
    Dim Key As Integer
    Dim Value As String

    List.Add 1, "one"
    List.Add 3, "three"
    List.Add 2, "two"
    List.Add 4, "four"
    List.Add 0, "zero"

    Debug.Print "The SortedList contains the following values:"
    PrintIndexAndKeysAndValues List

    Key = 2
    Debug.Print CorString.Format("The key ""{0}"" is at index {1}.", Key, List.IndexOfKey(Key))

    Value = "three"
    Debug.Print CorString.Format("The value ""{0}"" is at index {1}.", Value, List.IndexOfValue(Value))
End Sub

Private Sub PrintIndexAndKeysAndValues(ByVal List As SortedList)
    Dim i As Long

    Debug.Print t("-INDEX-\t-KEY-\t-VALUE-")

    For i = 0 To List.Count - 1
        Debug.Print CorString.Format(t("[{0}]:\t{1}\t{2}"), i, List.GetKey(i), List.GetByIndex(i))
    Next

    Debug.Print
End Sub

' The following code produces the following output.
'
'    The SortedList contains the following values:
'    -INDEX- -KEY-   -VALUE-
'    [0]:    0   zero
'    [1]:    1   one
'    [2]:    2   two
'    [3]:    3   three
'    [4]:    4   four
'
'    The key "2" is at index 2.
'    The value "three" is at index 3.

See Also

Project CorLib Overview

Class SortedList Overview

ContainsValue

IndexOfKey


SortedList: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class SortedList Overview


SortedList: IsFixedSize (get)

IsFixedSize

Gets a value indicating whether a SortedList object has a fixed size.

 Public Property Get IsFixedSize ( ) As Boolean

Return Values

Boolean - True if the SortedList object has a fixed size; otherwise, False. The default is False.

Remarks

A collection with a fixed size does not allow the addition or removal of elements after the collection is created, but does allow the modification of existing elements.

A collection with a fixed size is simply a collection with a wrapper that prevents adding and removing elements; therefore, if changes are made to the underlying collection, including the addition or removal of elements, the fixed-size collection reflects those changes.

Read Only.

See Also

Project CorLib Overview

Class SortedList Overview


SortedList: IsReadOnly (get)

IsReadOnly

Gets a value indicating whether a SortedList object is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - True if the SortedList object is read-only; otherwise, False. The default is False.

Remarks

A collection that is read-only does not allow the addition, removal, or modification of elements after the collection is created.

A collection that is read-only is simply a collection with a wrapper that prevents modifying the collection; therefore, if changes are made to the underlying collection, the read-only collection reflects those changes.

Read Only.

See Also

Project CorLib Overview

Class SortedList Overview


SortedList: Item (get)

Item

Gets the value associated with a specific key in a SortedList object.

 Public Property Get Item(
      ByRef Key As Variant ) As Variant

Parameters

Key
[ByRef] Variant. The key associated with the value to get.

Return Values

Variant - The value associated with the Key parameter in the SortedList object, if key is found; otherwise, Empty.

Remarks

You can use the Item property to access a specific element in a collection by specifying the following syntax: myCollection(key).

You can also use this property to add new elements by setting the value of a key that does not exist in the SortedList object (for example, myCollection("myNonexistentKey") = myValue). However, if the specified key already exists in the SortedList, setting the Item property overwrites the old value. In contrast, the Add method does not modify existing elements.

The elements of a SortedList are sorted by the keys either according to a specific IComparer implementation specified when the SortedList is created, or by the default Comparer.

Read/Write.

Exceptions

Exception | Condition
InvalidOperationException | The comparer throws an exception.

See Also

Project CorLib Overview

Class SortedList Overview

Add

Contains

ContainsKey


SortedList: Item (let)

Item

Sets the value associated with a specific key in a SortedList object.

 Public Property Let Item(
      ByRef Key As Variant,
      ByRef Value As Variant )

Parameters

Key
[ByRef] Variant. The key associated with the value to set.
Value
[ByRef] Variant. The value associated with the Key parameter in the SortedList object.

Remarks

You can use the Item property to access a specific element in a collection by specifying the following syntax: myCollection(key).

You can also use this property to add new elements by setting the value of a key that does not exist in the SortedList object (for example, myCollection("myNonexistentKey") = myValue). However, if the specified key already exists in the SortedList, setting the Item property overwrites the old value. In contrast, the Add method does not modify existing elements.

The elements of a SortedList are sorted by the keys either according to a specific IComparer implementation specified when the SortedList is created, or by the default Comparer.

Read/Write.

Exceptions

Exception | Condition
NotSupportedException | The property is set and the SortedList object is read-only. -or- The property is set, Key does not exist in the collection, and the SortedList has a fixed size.
InvalidOperationException | The comparer throws an exception.

See Also

Project CorLib Overview

Class SortedList Overview

Add

Contains

ContainsKey


SortedList: Item (set)

Item

Sets the value associated with a specific key in a SortedList object.

 Public Property Set Item(
      ByRef Key As Variant,
      ByRef Value As Variant )

Parameters

Key
[ByRef] Variant. The key associated with the value to set.
Value
[ByRef] Variant. The value associated with the Key parameter in the SortedList object.

Remarks

You can use the Item property to access a specific element in a collection by specifying the following syntax: myCollection(key).

You can also use this property to add new elements by setting the value of a key that does not exist in the SortedList object (for example, myCollection("myNonexistentKey") = myValue). However, if the specified key already exists in the SortedList, setting the Item property overwrites the old value. In contrast, the Add method does not modify existing elements.

The elements of a SortedList are sorted by the keys either according to a specific IComparer implementation specified when the SortedList is created, or by the default Comparer.

Read/Write.

Exceptions

Exception | Condition
NotSupportedException | The property is set and the SortedList object is read-only. -or- The property is set, Key does not exist in the collection, and the SortedList has a fixed size.
InvalidOperationException | The comparer throws an exception.

See Also

Project CorLib Overview

Class SortedList Overview

Add

Contains

ContainsKey


SortedList: IVersionable

IVersionable

 Implements IVersionable

Return Values

IVersionable -

See Also

Project CorLib Overview

Class SortedList Overview


SortedList: Keys (get)

Keys

Gets the keys in the SortedList object.

 Public Property Get Keys ( ) As ICollection

Return Values

ICollection - An ICollection object containing the keys in the SortedList object.

Remarks

The ICollection object is a read-only view of the keys of the SortedList object. Modifications made to the underlying SortedList are immediately reflected in the ICollection.

The elements of the ICollection are sorted in the same order as the keys of the SortedList.

This property is similar to the GetKeyList method, but returns an ICollection object instead of an IList object.

Read Only.

See Also

Project CorLib Overview

Class SortedList Overview

ICollection

Values

GetKeyList


SortedList: Remove

Remove

Removes the element with the specified key from a SortedList object.

 Public Sub Remove(
      ByRef Key As Variant )

Parameters

Key
[ByRef] Variant. The key of the element to remove.

Remarks

If the SortedList object does not contain an element with the specified key, the SortedList remains unchanged. No exception is thrown.

Exceptions

Exception | Condition
NotSupportedException | The SortedList object is read-only. -or- The SortedList has a fixed size.

Examples

The following code example shows how to remove elements from a SortedList object.

Public Sub Main()
    Dim List As New SortedList

    List.Add "3c", "dog"
    List.Add "2c", "over"
    List.Add "1c", "brown"
    List.Add "1a", "The"
    List.Add "1b", "quick"
    List.Add "3a", "the"
    List.Add "3b", "lazy"
    List.Add "2a", "fox"
    List.Add "2b", "jumped"

    Debug.Print "The SortedList initially contains the following:"
    PrintKeysAndValues List

    List.Remove "3b"

    Debug.Print "After removing ""lazy"":"
    PrintKeysAndValues List

    List.RemoveAt 5

    Debug.Print "After removing the element at index 5:"
    PrintKeysAndValues List
End Sub

Private Sub PrintKeysAndValues(ByVal List As SortedList)
    Dim i As Long

    Debug.Print t("\t-KEY-\t-VALUE-")

    For i = 0 To List.Count - 1
        Debug.Print CorString.Format(t("\t{0}:\t{1}"), List.GetKey(i), List.GetByIndex(i))
    Next

    Debug.Print
End Sub

' The following code produces the following output.
'
'    The SortedList initially contains the following:
'        -KEY-   -VALUE-
'        1a:    the
'        1b:    quick
'        1c:    brown
'        2a:    fox
'        2b:    jumped
'        2c:    over
'        3a:    the
'        3b:    lazy
'        3c:    dog
'
'        After removing "lazy":
'            -KEY-   -VALUE-
'        1a:    the
'        1b:    quick
'        1c:    brown
'        2a:    fox
'        2b:    jumped
'        2c:    over
'        3a:    the
'        3c:    dog
'
'        After removing the element at index 5:
'            -KEY-   -VALUE-
'        1a:    the
'        1b:    quick
'        1c:    brown
'        2a:    fox
'        2b:    jumped
'        3a:    the
'        3c:    do

See Also

Project CorLib Overview

Class SortedList Overview

RemoveAt


SortedList: RemoveAt

RemoveAt

Removes the element at the specified index of a SortedList object.

 Public Sub RemoveAt(
      ByVal Index As Long )

Parameters

Index
[ByVal] Long. The zero-based index of the element to remove.

Remarks

The index sequence is based on the sort sequence. When an element is added, it is inserted into SortedList in the correct sort order, and the indexing adjusts accordingly. When an element is removed, the indexing also adjusts accordingly. Therefore, the index of a specific key/value pair might change as elements are added or removed from the SortedList object.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Index is outside the range of valid indexes for the SortedList object.
NotSupportedException | The SortedList object is read-only. -or- The SortedList has a fixed size.

Examples

The following code example shows how to remove elements from a SortedList object.

Public Sub Main()
    Dim List As New SortedList

    List.Add "3c", "dog"
    List.Add "2c", "over"
    List.Add "1c", "brown"
    List.Add "1a", "The"
    List.Add "1b", "quick"
    List.Add "3a", "the"
    List.Add "3b", "lazy"
    List.Add "2a", "fox"
    List.Add "2b", "jumped"

    Debug.Print "The SortedList initially contains the following:"
    PrintKeysAndValues List

    List.Remove "3b"

    Debug.Print "After removing ""lazy"":"
    PrintKeysAndValues List

    List.RemoveAt 5

    Debug.Print "After removing the element at index 5:"
    PrintKeysAndValues List
End Sub

Private Sub PrintKeysAndValues(ByVal List As SortedList)
    Dim i As Long

    Debug.Print t("\t-KEY-\t-VALUE-")

    For i = 0 To List.Count - 1
        Debug.Print CorString.Format(t("\t{0}:\t{1}"), List.GetKey(i), List.GetByIndex(i))
    Next

    Debug.Print
End Sub

' The following code produces the following output.
'
'    The SortedList initially contains the following:
'        -KEY-   -VALUE-
'        1a:    the
'        1b:    quick
'        1c:    brown
'        2a:    fox
'        2b:    jumped
'        2c:    over
'        3a:    the
'        3b:    lazy
'        3c:    dog
'
'        After removing "lazy":
'            -KEY-   -VALUE-
'        1a:    the
'        1b:    quick
'        1c:    brown
'        2a:    fox
'        2b:    jumped
'        2c:    over
'        3a:    the
'        3c:    dog
'
'        After removing the element at index 5:
'            -KEY-   -VALUE-
'        1a:    the
'        1b:    quick
'        1c:    brown
'        2a:    fox
'        2b:    jumped
'        3a:    the
'        3c:    dog

See Also

Project CorLib Overview

Class SortedList Overview

Remove


SortedList: SetByIndex

SetByIndex

Replaces the value at a specific index in a SortedList object.

 Public Sub SetByIndex(
      ByVal Index As Long,
      ByRef Value As Variant )

Parameters

Index
[ByVal] Long. The zero-based index at which to set the value.
Value
[ByRef] Variant. The value to save into the SortedList object.

Remarks

The index sequence is based on the sort sequence. When an element is added, it is inserted into SortedList in the correct sort order, and the indexing adjusts accordingly. When an element is removed, the indexing also adjusts accordingly. Therefore, the index of a specific key/value pair might change as elements are added or removed from the SortedList object.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | Index is outside the range of valid indexes for the SortedList object.

Examples

The following code example shows how to replace the value of an existing element in a SortedList object.

Public Sub Main()
    Dim List As New SortedList

    List.Add 2, "two"
    List.Add 3, "three"
    List.Add 1, "one"
    List.Add 0, "zero"
    List.Add 4, "four"

    Debug.Print "The SortedList contains the following values:"
    PrintIndexAndKeysAndValues List

    List.SetByIndex 3, "III"
    List.SetByIndex 4, "IV"

    Debug.Print "After replacing the value at index 3 and index 4,"
    PrintIndexAndKeysAndValues List
End Sub

Private Sub PrintIndexAndKeysAndValues(ByVal List As SortedList)
    Dim i As Long

    Debug.Print t("\t-INDEX-\t-KEY-\t-VALUE-")

    For i = 0 To List.Count - 1
        Debug.Print CorString.Format(t("\t[{0}]:\t{1}\t{2}"), i, List.GetKey(i), List.GetByIndex(i))
    Next

    Debug.Print
End Sub

' The following code produces the following output.
'
'    The SortedList contains the following values:
'        -INDEX- -KEY-   -VALUE-
'        [0]:    0   zero
'        [1]:    1   one
'        [2]:    2   two
'        [3]:    3   three
'        [4]:    4   four
'
'    After replacing the value at index 3 and index 4,
'        -INDEX- -KEY-   -VALUE-
'        [0]:    0   zero
'        [1]:    1   one
'        [2]:    2   two
'        [3]:    3   III
'        [4]:    4   IV

See Also

Project CorLib Overview

Class SortedList Overview


SortedList: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class SortedList Overview


SortedList: TrimToSize

TrimToSize

Sets the capacity to the actual number of elements in a SortedList object.

 Public Sub TrimToSize ( )

Remarks

This method can be used to minimize a collections memory overhead if no new elements will be added to the collection.

To reset a SortedList object to its initial state, call the Clear method before calling TrimToSize. Trimming an empty SortedList sets the capacity of the SortedList to the default capacity.

Exceptions

Exception | Condition
NotSupportedException | The SortedList object is read-only. -or- The SortedList is fixed size.

Examples

The following code example shows how to trim the unused portions of a SortedList object and how to clear its values.

Public Sub Main()
    Dim List As New SortedList

    List.Add "one", "The"
    List.Add "two", "quick"
    List.Add "three", "brown"
    List.Add "four", "fox"
    List.Add "five", "jumped"

    Debug.Print "Initially,"
    Debug.Print CorString.Format("   Count    : {0}", List.Count)
    Debug.Print CorString.Format("   Capacity : {0}", List.Capacity)
    Debug.Print CorString.Format("   Values:")
    PrintKeysAndValues List

    List.TrimToSize

    Debug.Print "After TrimToSize,"
    Debug.Print CorString.Format("   Count    : {0}", List.Count)
    Debug.Print CorString.Format("   Capacity : {0}", List.Capacity)
    Debug.Print CorString.Format("   Values:")
    PrintKeysAndValues List

    List.Clear

    Debug.Print "After Clear,"
    Debug.Print CorString.Format("   Count    : {0}", List.Count)
    Debug.Print CorString.Format("   Capacity : {0}", List.Capacity)
    Debug.Print CorString.Format("   Values:")
    PrintKeysAndValues List

    List.TrimToSize

    Debug.Print "After the second TrimToSize,"
    Debug.Print CorString.Format("   Count    : {0}", List.Count)
    Debug.Print CorString.Format("   Capacity : {0}", List.Capacity)
    Debug.Print CorString.Format("   Values:")
    PrintKeysAndValues List
End Sub

Private Sub PrintKeysAndValues(ByVal List As SortedList)
    Dim i As Long

    Debug.Print t("\t-KEY-\t-VALUE-")

    For i = 0 To List.Count - 1
        Debug.Print CorString.Format(t("\t{0}:\t{1}"), List.GetKey(i), List.GetByIndex(i))
    Next

    Debug.Print
End Sub

' The following code produces the following output.
'
'    Initially,
'       Count    : 5
'       Capacity : 256
'    Values:
'        -KEY-   -VALUE-
'    five:                   jumped
'    four:                   fox
'    one:                    the
'    three:                  brown
'    two:                    quick
'
'    After TrimToSize,
'       Count    : 5
'       Capacity : 5
'    Values:
'        -KEY-   -VALUE-
'    five:                   jumped
'    four:                   fox
'    one:                    the
'    three:                  brown
'    two:                    quick
'
'    After Clear,
'       Count    : 0
'       Capacity : 5
'    Values:
'        -KEY-   -VALUE-
'
'    After the second TrimToSize,
'       Count    : 0
'       Capacity : 0
'    Values:
'        -KEY-   -VALUE-

See Also

Project CorLib Overview

Class SortedList Overview

Clear

Capacity

Count


SortedList: Values (get)

Values

Gets the values in the SortedList object.

 Public Property Get Values ( ) As ICollection

Return Values

ICollection - An ICollection object containing the values in the SortedList object.

Remarks

The ICollection object is a read-only view of the values of the SortedList object. Modifications made to the underlying SortedList are immediately reflected in the ICollection.

The elements of the ICollection are sorted in the same order as the values of the SortedList.

This property is similar to the GetValueList method, but returns an ICollection object instead of an IList object.

Read Only.

See Also

Project CorLib Overview

Class SortedList Overview

ICollection

Keys

GetValueList


Stack

Stack

Represents a simple last-in-first-out (LIFO) non-generic collection of items.

Implements:

ICloneable
ICollection
IEnumerable
IObject
IVersionable

Public:

Properties:

Name | Description
Count (get) | Gets the number of elements contained in the Stack.

Methods:

Name | Description
Clear | Removes all items from the Stack.
Clone | Creates a shallow copy of the Stack.
Contains | Determines whether an element is in the Stack.
CopyTo | Copies the Stack to an existing one-dimensional array, starting at the specified array index.
Equals | Determines whether the specified value is equal to the current object.
GetEnumerator | Returns an enumerator to enumerate the colleciton
GetHashCode | Returns a pseudo-unique number identifying this instance.
Peek | Returns the item at the top of the Stack without removing it.
Pop | Removes and returns the item at the top of the Stack.
Push | Inserts an item at the top of the Stack.
ToArray | Copies the Stack to a new array.
ToString | Returns a string representation of this object instance.

Remarks

The capacity of a Stack is the number of elements the Stack can hold. As elements are added to a Stack, the capacity is automatically increased as required through reallocation.

If Count is less than the capacity of the stack, Push is an O(1) operation. If the capacity needs to be increased to accommodate the new element, Push becomes an O(n) operation, where n is Count. Pop is an O(1) operation.

Examples

The following example shows how to create and add values to a Stack and how to print out its values.

Public Sub Main()
    ' Creates an initializes a new Stack.
    Dim MyStack As New Stack
    MyStack.Push "Hello"
    MyStack.Push "World"
    MyStack.Push "!"

    ' Displays the properties and values of the Stack.
    Debug.Print "MyStack"
    Debug.Print vbTab & "Count:    " & MyStack.Count
    Debug.Print vbTab & "Values:";
    PrintValues MyStack
End Sub

Private Sub PrintValues(ByVal MyCollection As IEnumerable)
    Dim Item As Variant

    For Each Item In MyCollection
        Debug.Print "    " & Item;
    Next

    Debug.Print
End Sub

' This example code produce the following output.
'
'    MyStack
'        Count:    3
'        Values:    !    World    Hello

See Also

Project CorLib Overview

Class Stack Overview

Constructors

ICollection

IEnumerable

ICloneable


Stack: Clear

Clear

Removes all items from the Stack.

 Public Sub Clear ( )

Remarks

Count is set to zero, and references to other objects from elements of the collection are also released.

Examples

The following example shows how to clear the values of the Stack.

Public Sub Main()
    ' Creates an initializes a new Stack.
    Dim MyStack As New Stack
    MyStack.Push "The"
    MyStack.Push "quick"
    MyStack.Push "brown"
    MyStack.Push "fox"
    MyStack.Push "jumped"

    ' Displays the count and values of the Stack.
    Debug.Print "Initially,"
    Debug.Print "   Count    : " & MyStack.Count
    Debug.Print "   Values:";
    PrintValues MyStack

    ' Clears the Stack.
    MyStack.Clear

    ' Displays the count and values of the Stack.
    Debug.Print "After Clear,"
    Debug.Print "   Count    : " & MyStack.Count
    Debug.Print "   Values:";
    PrintValues MyStack
End Sub

Private Sub PrintValues(ByVal MyCollection As IEnumerable)
    Dim Item As Variant

    For Each Item In MyCollection
        Debug.Print vbTab & Item;
    Next

    Debug.Print
End Sub

' This example code produce the following output.
'
'    Initially,
'       Count    : 5
'       Values:    jumped    fox    brown    quick    The
'    After Clear,
'       Count    : 0
'    Values:

See Also

Project CorLib Overview

Class Stack Overview


Stack: Clone

Clone

Creates a shallow copy of the Stack.

 Public Function Clone ( ) As Stack

Return Values

Stack - A shallow copy of the Stack.

Remarks

Returns a second stack with the same contents as the original.

A shallow copy of a collection copies only the elements of the collection, whether they are reference types or value types, but it does not copy the objects that the references refer to. The references in the new collection point to the same objects that the references in the original collection point to.

See Also

Project CorLib Overview

Class Stack Overview


Stack: Contains

Contains

Determines whether an element is in the Stack.

 Public Function Contains(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to locate in the Stack.

Return Values

Boolean - True if Value is found in the Stack; otherwise, False.

Remarks

This method determines equality by calling Object.Equals.

This method performs a linear search; therefore, this method is an O(n) operation, where n is Count.

See Also

Project CorLib Overview

Class Stack Overview


Stack: CopyTo

CopyTo

Copies the Stack to an existing one-dimensional array, starting at the specified array index.

 Public Sub CopyTo(
      ByRef Arr As Variant,
      ByVal Index As Long )

Parameters

Arr
[ByRef] Variant. The one-dimensional array that is the destination of the elements copied from Stack.
Index
[ByVal] Long. The lowerbound-based index in array at which copying begins.

Remarks

The elements are copied onto the array in last-in-first-out (LIFO) order, similar to the order of the elements returned by a succession of calls to Pop.

Exceptions

Exception | Condition
ArgumentNullException | Arr is uninitialized.
ArgumentOutOfRangeException | Index is less than lower-bound.
ArgumentException | Arr is multidimensional. -or- The number of elements in the source Stack is greater than the available space from Index to the end of the destination Arr.
ArrayTypeMismatchException | The type of the source Stack cannot be cast automatically to the type of the destination Arr.

Examples

The following example shows how to copy a Stack into a one-dimensional array.

Public Sub Main()
    Dim MySourceQ As New Stack
    Dim MyTargetArray() As String
    Dim MyStandardArray() As Variant

    ' Initializes the source Stack.
    MySourceQ.Push "barn"
    MySourceQ.Push "the"
    MySourceQ.Push "in"
    MySourceQ.Push "cats"
    MySourceQ.Push "napping"
    MySourceQ.Push "three"

    MyTargetArray = NewStrings("The", "quick", "brown", "fox", "jumped", "over", "the", "lazy", "dog")
    ReDim Preserve MyTargetArray(0 To 14)

    ' Displays the values of the target array.
    Debug.Print "The target Array contains the following (before and after copying):"
    PrintValues MyTargetArray

    ' Copies the entire source stack to the target array, starting at index 6.
    MySourceQ.CopyTo MyTargetArray, 6

    ' Displays the values of the target array.
    PrintValues MyTargetArray

    ' Copies the entire source stack to a new standard array.
    MyStandardArray = MySourceQ.ToArray

    ' Displays the values of the new standard array.
    Debug.Print "The new standard array contains the following:"
    PrintValues MyStandardArray
End Sub

Private Sub PrintValues(ByRef MyArr As Variant)
    Dim Item As Variant

    For Each Item In MyArr
        Debug.Print " " & Item;
    Next

    Debug.Print
End Sub

' This example code produces the following output.
'
'    The target Array contains the following (before and after copying):
'     The quick brown fox jumped over the lazy dog
'     The quick brown fox jumped over three napping cats in the barn
'    The new standard array contains the following:
'     three napping cats in the barn

See Also

Project CorLib Overview

Class Stack Overview

ToArray


Stack: Count (get)

Count

Gets the number of elements contained in the Stack.

 Public Property Get Count ( ) As Long

Return Values

Long - The number of elements contained in the Stack.

Remarks

The capacity is the number of elements that the Stack can store. Count is the number of elements that are actually in the Stack.

The capacity is always greater than or equal to Count. If Count exceeds the capacity while adding elements, the capacity is automatically increased by reallocating the internal array before copying the old elements and adding the new elements.

Read Only.

See Also

Project CorLib Overview

Class Stack Overview


Stack: Equals

Equals

Determines whether the specified value is equal to the current object.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare with the current object.

Return Values

Boolean - True if the specified value is equal to the current object; otherwise, False.

See Also

Project CorLib Overview

Class Stack Overview


Stack: GetEnumerator

GetEnumerator

Returns an enumerator to enumerate the colleciton

 Public Function GetEnumerator ( ) As IEnumerator

Return Values

IEnumerator - An enumerator.

See Also

Project CorLib Overview

Class Stack Overview


Stack: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class Stack Overview


Stack: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class Stack Overview


Stack: ICollection

ICollection

 Implements ICollection

Return Values

ICollection -

See Also

Project CorLib Overview

Class Stack Overview


Stack: IEnumerable

IEnumerable

 Implements IEnumerable

Return Values

IEnumerable -

See Also

Project CorLib Overview

Class Stack Overview


Stack: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class Stack Overview


Stack: IVersionable

IVersionable

 Implements IVersionable

Return Values

IVersionable -

See Also

Project CorLib Overview

Class Stack Overview


Stack: Peek

Peek

Returns the item at the top of the Stack without removing it.

 Public Function Peek ( ) As Variant

Return Values

Variant - The item at the top of the Stack.

Remarks

This method is similar to the Pop method, but Peek does not modify the Stack.

Exceptions

Exception | Condition
InvalidOperationException | The Stack is empty.

Examples

The following example shows how to add elements to the Stack, remove elements from the Stack, or view the element at the top of the Stack.

Public Sub Main()
    ' Creates an initializes a new Stack.
    Dim MyStack As New Stack
    MyStack.Push "The"
    MyStack.Push "quick"
    MyStack.Push "brown"
    MyStack.Push "fox"

    ' Displays the Stack.
    Debug.Print "Stack values:";
    PrintValues MyStack

    ' Removes an element from the Stack.
    Debug.Print t("(Pop)\t\t") & MyStack.Pop

    ' Displays the Stack.
    Debug.Print "Stack values:";
    PrintValues MyStack

    ' Removes another element from the Stack.
    Debug.Print t("(Pop)\t\t") & MyStack.Pop

    ' Displays the Stack.
    Debug.Print "Stack values:";
    PrintValues MyStack

    ' Views the first element in the Stack but does not remove it.
    Debug.Print t("(Peek)\t\t") & MyStack.Peek

    ' Displays the Stack.
    Debug.Print "Stack values:";
    PrintValues MyStack
End Sub

Private Sub PrintValues(ByVal MyCollection As IEnumerable)
    Dim Item As Variant

    For Each Item In MyCollection
        Debug.Print vbTab & Item;
    Next

    Debug.Print
End Sub

' This example code produce the following output.
'
'    Stack values:    fox    brown    quick    The
'    (Pop)       fox
'    Stack values:    brown    quick    The
'    (Pop)       brown
'    Stack Values:    quick The
'    (Peek)      quick
'    Stack Values:    quick The

See Also

Project CorLib Overview

Class Stack Overview

Pop

Push


Stack: Pop

Pop

Removes and returns the item at the top of the Stack.

 Public Function Pop ( ) As Variant

Return Values

Variant - The item removed from the top of the Stack.

Remarks

This method is similar to the Peek method, but Peek does not modify the Stack.

Exceptions

Exception | Condition
InvalidOperationException | The Stack is empty.

Examples

The following example shows how to add elements to the Stack, remove elements from the Stack, or view the element at the top of the Stack.

Public Sub Main()
    ' Creates an initializes a new Stack.
    Dim MyStack As New Stack
    MyStack.Push "The"
    MyStack.Push "quick"
    MyStack.Push "brown"
    MyStack.Push "fox"

    ' Displays the Stack.
    Debug.Print "Stack values:";
    PrintValues MyStack

    ' Removes an element from the Stack.
    Debug.Print t("(Pop)\t\t") & MyStack.Pop

    ' Displays the Stack.
    Debug.Print "Stack values:";
    PrintValues MyStack

    ' Removes another element from the Stack.
    Debug.Print t("(Pop)\t\t") & MyStack.Pop

    ' Displays the Stack.
    Debug.Print "Stack values:";
    PrintValues MyStack

    ' Views the first element in the Stack but does not remove it.
    Debug.Print t("(Peek)\t\t") & MyStack.Peek

    ' Displays the Stack.
    Debug.Print "Stack values:";
    PrintValues MyStack
End Sub

Private Sub PrintValues(ByVal MyCollection As IEnumerable)
    Dim Item As Variant

    For Each Item In MyCollection
        Debug.Print vbTab & Item;
    Next

    Debug.Print
End Sub

' This example code produce the following output.
'
'    Stack values:    fox    brown    quick    The
'    (Pop)       fox
'    Stack values:    brown    quick    The
'    (Pop)       brown
'    Stack Values:    quick The
'    (Peek)      quick
'    Stack Values:    quick The

See Also

Project CorLib Overview

Class Stack Overview

Push

Peek


Stack: Push

Push

Inserts an item at the top of the Stack.

 Public Sub Push(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. The item to push onto the Stack.

Remarks

If Count already equals the capacity, the capacity of the Stack is increased by automatically reallocating the internal array, and the existing elements are copied to the new array before the new element is added.

If Count is less than the capacity of the stack, Push is an O(1) operation. If the capacity needs to be increased to accommodate the new element, Push becomes an O(n) operation, where n is Count.

Examples

The following example shows how to add elements to the Stack, remove elements from the Stack, or view the element at the top of the Stack.

Public Sub Main()
    ' Creates an initializes a new Stack.
    Dim MyStack As New Stack
    MyStack.Push "The"
    MyStack.Push "quick"
    MyStack.Push "brown"
    MyStack.Push "fox"

    ' Displays the Stack.
    Debug.Print "Stack values:";
    PrintValues MyStack

    ' Removes an element from the Stack.
    Debug.Print t("(Pop)\t\t") & MyStack.Pop

    ' Displays the Stack.
    Debug.Print "Stack values:";
    PrintValues MyStack

    ' Removes another element from the Stack.
    Debug.Print t("(Pop)\t\t") & MyStack.Pop

    ' Displays the Stack.
    Debug.Print "Stack values:";
    PrintValues MyStack

    ' Views the first element in the Stack but does not remove it.
    Debug.Print t("(Peek)\t\t") & MyStack.Peek

    ' Displays the Stack.
    Debug.Print "Stack values:";
    PrintValues MyStack
End Sub

Private Sub PrintValues(ByVal MyCollection As IEnumerable)
    Dim Item As Variant

    For Each Item In MyCollection
        Debug.Print vbTab & Item;
    Next

    Debug.Print
End Sub

' This example code produce the following output.
'
'    Stack values:    fox    brown    quick    The
'    (Pop)       fox
'    Stack values:    brown    quick    The
'    (Pop)       brown
'    Stack Values:    quick The
'    (Peek)      quick
'    Stack Values:    quick The

See Also

Project CorLib Overview

Class Stack Overview

Pop

Peek


Stack: ToArray

ToArray

Copies the Stack to a new array.

 Public Function ToArray ( ) As Variant ( )

Return Values

Variant() - A new array containing copies of the elements of the Stack.

Remarks

The elements are copied onto the array in last-in-first-out (LIFO) order, similar to the order of the elements returned by a succession of calls to Pop.

Examples

The following example shows how to copy a Stack into a one-dimensional array.

Public Sub Main()
    Dim MySourceQ As New Stack
    Dim MyTargetArray() As String
    Dim MyStandardArray() As Variant

    ' Initializes the source Stack.
    MySourceQ.Push "barn"
    MySourceQ.Push "the"
    MySourceQ.Push "in"
    MySourceQ.Push "cats"
    MySourceQ.Push "napping"
    MySourceQ.Push "three"

    MyTargetArray = NewStrings("The", "quick", "brown", "fox", "jumped", "over", "the", "lazy", "dog")
    ReDim Preserve MyTargetArray(0 To 14)

    ' Displays the values of the target array.
    Debug.Print "The target Array contains the following (before and after copying):"
    PrintValues MyTargetArray

    ' Copies the entire source stack to the target array, starting at index 6.
    MySourceQ.CopyTo MyTargetArray, 6

    ' Displays the values of the target array.
    PrintValues MyTargetArray

    ' Copies the entire source stack to a new standard array.
    MyStandardArray = MySourceQ.ToArray

    ' Displays the values of the new standard array.
    Debug.Print "The new standard array contains the following:"
    PrintValues MyStandardArray
End Sub

Private Sub PrintValues(ByRef MyArr As Variant)
    Dim Item As Variant

    For Each Item In MyArr
        Debug.Print " " & Item
    Next

    Debug.Print
End Sub

' This example code produces the following output.
'
'    The target Array contains the following (before and after copying):
'     The quick brown fox jumped over the lazy dog
'     The quick brown fox jumped over three napping cats in the barn
'    The new standard array contains the following:
'     three napping cats in the barn

See Also

Project CorLib Overview

Class Stack Overview

CopyTo


Stack: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class Stack Overview


StaticClasses

StaticClasses

Provides direct access to static class methods.

Public:

Types:

Name | Description
Sign | Represents the sign values of BigInteger values.

Properties:

Name | Description
ArrayList (get) | Gets an object used to access the ArrayList static methods.
BigInteger (get) | Gets an object used to access the BigInteger static methods.
BitArray (get) | Gets an object used to access the BitArray static methods.
BitConverter (get) | Gets an object used to access the BitConverter static methods.
Buffer (get) | Gets an object used to access the Buffer static methods.
Calendar (get) | Gets an object used to access the Calendar static methods.
CaseInsensitiveComparer (get) | Gets an object used to access the CaseInsensitiveComparer static methods.
Char (get) | Gets a reference used to access the Char static methods.
Comparer (get) | Gets an object used to access the Comparer static methods.
Console (get) | Gets an object used to access the Console static methods.
Convert (get) | Gets an object used to access the Convert static methods.
Cor (get) | Returns a object containing all of the parameterized constructors available within the VBCorLib library.
CorArray (get) | Gets an object used to access the CorArray static methods.
CorDateTime (get) | Gets an object used to access the CorDateTime static methods.
CorMath (get) | Gets an object used to access the CorMath static methods.
CorString (get) | Gets an object used to access the CorString static methods.
CryptoConfig (get) | Gets an object used to access the CryptoConfig static methods.
CultureInfo (get) | Gets an object used to access the CultureInfo static methods.
DateTimeFormatInfo (get) | Gets an object used to access the DateTimeFormatInfo static methods.
DecoderFallback (get) | Gets a reference used to access the DecoderFallback static methods.
DES (get) | Gets an object used to access the DES static methods.
Directory (get) | Gets an object used to access the Directory static methods.
DriveInfo (get) | Gets an object used to access the DriveInfo static methods.
EncoderFallback (get) | Gets a reference used to access the EncoderFallback static methods.
Encoding (get) | Gets an object used to access the Encoding static methods.
Environment (get) | Gets an object used to access the Environment static methods.
EqualityComparer (get) | Gets a reference used to access the EqualityComparer static methods.
File (get) | Gets an object used to access the File static methods.
GregorianCalendar (get) | Gets an object used to access the GregorianCalendar static methods.
Guid (get) | Gets an object used to access the Guid static methods.
HebrewCalendar (get) | Gets an object used to access the HebrewCalendar static methods.
HijriCalendar (get) | Gets an object used to access the HijriCalendar static methods.
HMAC (get) | Gets an object used to access the HMAC static methods.
Int64 (get) | Gets a reference used to access the Int64 static methods.
JulianCalendar (get) | Gets an object used to access the JulianCalendar static methods.
KoreanCalendar (get) | Gets an object used to access the KoreanCalendar static methods.
MACTripleDES (get) | Gets an object used to access the MACTripleDES static methods.
MD5 (get) | Gets an object used to access the MD5 static methods.
MemoryMappedFile (get) | Gets a reference used to access the MemoryMappedFile static methods.
MyBase (get) | Gets a reference used to access the ObjectBase static methods.
NumberFormatInfo (get) | Gets an object used to access the NumberFormatInfo static methods.
Object (get) | Gets an object used to access the ObjectStatic static methods.
Path (get) | Gets an object used to access the Path static methods.
RC2 (get) | Gets an object used to access the RC2 static methods.
Registry (get) | Gets an object used to access the Registry static methods.
RegistryKey (get) | Gets an object used to access the RegistryKey static methods.
ResourceManager (get) | Gets an object used to access the ResourceManager static methods.
Rijndael (get) | Gets an object used to access the Rijndael static methods.
RSA (get) | Gets an object used to access the RSA static methods.
RSACryptoServiceProvider (get) | Gets a reference used to access the RSACryptoServiceProvider static methods.
SecurityElement (get) | Gets an object used to access the SecurityElement static methods.
SHA1 (get) | Gets an object used to access the SHA1 static methods.
SHA256 (get) | Gets an object used to access the SHA256 static methods.
SHA384 (get) | Gets an object used to access the SHA384 static methods.
SHA512 (get) | Gets an object used to access the SHA512 static methods.
StopWatch (get) | Gets an object used to access the StopWatch static methods.
Stream (get) | Gets an object used to access the Stream static methods.
StringComparer (get) | Gets a reference used to access the StringComparer static methods.
TextReader (get) | Gets an object used to access the TextReader static methods.
Thread (get) | Gets an object used to access the Thread static methods.
TimeSpan (get) | Gets an object used to access the TimeSpan static methods.
TimeZone (get) | Gets an object used to access the TimeZone static methods.
TripleDES (get) | Gets an object used to access the TripleDES static methods.
Version (get) | Gets an object used to access the Version static methods.

Remarks

VB6 does not support static class methods. To replicate the syntax of accessing static methods, a Property Get of the same name as the class that is supposed to contain the static methods is defined in this class. This class has instancing of GlobalMultiUse. This means that just the name of these Property Gets can be typed directly without having to instantiate the PublicProperty Gets class. By just typing in any of these Property Get names, the underlying class which contains the static methods is returned, and those methods are then available for calling. This gives the illusion of static methods being called on a class.

When typing in one of these Property Get names, it should be followed immediately by a period to allow access to the static methods of that class.

Example

 '' Print the name of the current user
 Debug.Print Environment.UserName
This example simply refers to the Environment Property Get in this class, then directly calls a method on the returned object from the Environment Property Get. In this case it returns a reference to the Environment class.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: ArrayList (get)

ArrayList

Gets an object used to access the ArrayList static methods.

 Public Property Get ArrayList ( ) As ArrayListStatic

Return Values

ArrayListStatic - A reference to an ArrayListStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

ArrayList

ArrayListStatic


StaticClasses: BigInteger (get)

BigInteger

Gets an object used to access the BigInteger static methods.

 Public Property Get BigInteger ( ) As BigIntegerStatic

Return Values

BigIntegerStatic - A reference to a BigIntegerStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: BitArray (get)

BitArray

Gets an object used to access the BitArray static methods.

 Public Property Get BitArray ( ) As BitArrayStatic

Return Values

BitArrayStatic - A reference to a BitArrayStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

BitArray

BitArrayStatic


StaticClasses: BitConverter (get)

BitConverter

Gets an object used to access the BitConverter static methods.

 Public Property Get BitConverter ( ) As BitConverter

Return Values

BitConverter - A reference to a BitConverter object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

BitConverter

Build on Sunday, October 11, 2020 by VBDOX


StaticClasses: Buffer (get)

Buffer

Gets an object used to access the Buffer static methods.

 Public Property Get Buffer ( ) As Buffer

Return Values

Buffer - A reference to a Buffer object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

Buffer

Build on Sunday, October 11, 2020 by VBDOX


StaticClasses: Calendar (get)

Calendar

Gets an object used to access the Calendar static methods.

 Public Property Get Calendar ( ) As CalendarStatic

Return Values

CalendarStatic - A reference to a CalendarStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

Calendar

CalendarStatic


StaticClasses: CaseInsensitiveComparer (get)

CaseInsensitiveComparer

Gets an object used to access the CaseInsensitiveComparer static methods.

 Public Property Get CaseInsensitiveComparer ( ) As CaseInsensitiveComparerStatic

Return Values

CaseInsensitiveComparerStatic - A reference to a CaseInsensitiveComparerStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

CaseInsensitiveComparer

CaseInsensitiveComparerStatic


StaticClasses: Char (get)

Char

Gets a reference used to access the Char static methods.

 Public Property Get Char ( ) As Char

Return Values

Char - A reference to a Char object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: Comparer (get)

Comparer

Gets an object used to access the Comparer static methods.

 Public Property Get Comparer ( ) As ComparerStatic

Return Values

ComparerStatic - A reference to a ComparerStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

Comparer

ComparerStatic


StaticClasses: Console (get)

Console

Gets an object used to access the Console static methods.

 Public Property Get Console ( ) As Console

Return Values

Console - A reference to a Console object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

Console

Build on Sunday, October 11, 2020 by VBDOX


StaticClasses: Convert (get)

Convert

Gets an object used to access the Convert static methods.

 Public Property Get Convert ( ) As Convert

Return Values

Convert - A reference to a Convert object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

Convert

Build on Sunday, October 11, 2020 by VBDOX


StaticClasses: Cor (get)

Cor

Returns a object containing all of the parameterized constructors available within the VBCorLib library.

 Public Property Get Cor ( ) As Constructors

Return Values

Constructors - A object containing all of the constructors in VBCorLib.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

Constructors


StaticClasses: CorArray (get)

CorArray

Gets an object used to access the CorArray static methods.

 Public Property Get CorArray ( ) As CorArray

Return Values

CorArray - A reference to a CorArray object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

CorArray

Build on Sunday, October 11, 2020 by VBDOX


StaticClasses: CorDateTime (get)

CorDateTime

Gets an object used to access the CorDateTime static methods.

 Public Property Get CorDateTime ( ) As CorDateTimeStatic

Return Values

CorDateTimeStatic - A reference to a CorDateTimeStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

CorDateTime

CorDateTimeStatic


StaticClasses: CorMath (get)

CorMath

Gets an object used to access the CorMath static methods.

 Public Property Get CorMath ( ) As CorMath

Return Values

CorMath - A reference to a CorMath object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: CorString (get)

CorString

Gets an object used to access the CorString static methods.

 Public Property Get CorString ( ) As CorString

Return Values

CorString - A reference to a CorString object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

CorString

Build on Sunday, October 11, 2020 by VBDOX


StaticClasses: CryptoConfig (get)

CryptoConfig

Gets an object used to access the CryptoConfig static methods.

 Public Property Get CryptoConfig ( ) As CryptoConfig

Return Values

CryptoConfig - A reference to a CryptoConfig object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: CultureInfo (get)

CultureInfo

Gets an object used to access the CultureInfo static methods.

 Public Property Get CultureInfo ( ) As CultureInfoStatic

Return Values

CultureInfoStatic - A reference to a CultureInfoStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

CultureInfo

CultureInfoStatic


StaticClasses: DateTimeFormatInfo (get)

DateTimeFormatInfo

Gets an object used to access the DateTimeFormatInfo static methods.

 Public Property Get DateTimeFormatInfo ( ) As DateTimeFormatInfoStatic

Return Values

DateTimeFormatInfoStatic - A reference to a DateTimeFormatInfoStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

DateTimeFormatInfo

DateTimeFormatInfoStatic


StaticClasses: DecoderFallback (get)

DecoderFallback

Gets a reference used to access the DecoderFallback static methods.

 Public Property Get DecoderFallback ( ) As DecoderFallbackStatic

Return Values

DecoderFallbackStatic - A reference to a DecoderFallbackStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: DES (get)

DES

Gets an object used to access the DES static methods.

 Public Property Get DES ( ) As DESStatic

Return Values

DESStatic - A reference to a DESStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: Directory (get)

Directory

Gets an object used to access the Directory static methods.

 Public Property Get Directory ( ) As Directory

Return Values

Directory - A reference to a Directory object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

Directory

DirectoryInfo

File

FileInfo

DriveInfo

DriveInfoStatic


StaticClasses: DriveInfo (get)

DriveInfo

Gets an object used to access the DriveInfo static methods.

 Public Property Get DriveInfo ( ) As DriveInfoStatic

Return Values

DriveInfoStatic - A reference to a DriveInfoStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

DriveInfo

DirectoryInfo

Directory

FileInfo

File


StaticClasses: EncoderFallback (get)

EncoderFallback

Gets a reference used to access the EncoderFallback static methods.

 Public Property Get EncoderFallback ( ) As EncoderFallbackStatic

Return Values

EncoderFallbackStatic - A reference to a EncoderFallbackStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: Encoding (get)

Encoding

Gets an object used to access the Encoding static methods.

 Public Property Get Encoding ( ) As EncodingStatic

Return Values

EncodingStatic - A reference to an EncodingStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

Encoding

EncodingStatic


StaticClasses: Environment (get)

Environment

Gets an object used to access the Environment static methods.

 Public Property Get Environment ( ) As Environment

Return Values

Environment - A reference to an Environment object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

Environment

Build on Sunday, October 11, 2020 by VBDOX


StaticClasses: EqualityComparer (get)

EqualityComparer

Gets a reference used to access the EqualityComparer static methods.

 Public Property Get EqualityComparer ( ) As EqualityComparerStatic

Return Values

EqualityComparerStatic - A reference to an EqualityComparerStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: File (get)

File

Gets an object used to access the File static methods.

 Public Property Get File ( ) As File

Return Values

File - A reference to a File object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

File

FileInfo

Directory

DirectoryInfo

DriveInfo

DriveInfoStatic


StaticClasses: GregorianCalendar (get)

GregorianCalendar

Gets an object used to access the GregorianCalendar static methods.

 Public Property Get GregorianCalendar ( ) As GregorianCalendarStatic

Return Values

GregorianCalendarStatic - A reference to a GregorianCalendarStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

GregorianCalendar

GregorianCalendarStatic


StaticClasses: Guid (get)

Guid

Gets an object used to access the Guid static methods.

 Public Property Get Guid ( ) As GuidStatic

Return Values

GuidStatic - A reference to a GuidStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

GuidStatic

Guid

Build on Sunday, October 11, 2020 by VBDOX


StaticClasses: HebrewCalendar (get)

HebrewCalendar

Gets an object used to access the HebrewCalendar static methods.

 Public Property Get HebrewCalendar ( ) As HebrewCalendarStatic

Return Values

HebrewCalendarStatic - A reference to a HebrewCalendarStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

HebrewCalendar

HebrewCalendarStatic


StaticClasses: HijriCalendar (get)

HijriCalendar

Gets an object used to access the HijriCalendar static methods.

 Public Property Get HijriCalendar ( ) As HijriCalendarStatic

Return Values

HijriCalendarStatic - A reference to a HijriCalendarStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

HijriCalendar

HijriCalendarStatic


StaticClasses: HMAC (get)

HMAC

Gets an object used to access the HMAC static methods.

 Public Property Get HMAC ( ) As HMACStatic

Return Values

HMACStatic - A reference to an HMACStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: Int64 (get)

Int64

Gets a reference used to access the Int64 static methods.

 Public Property Get Int64 ( ) As Int64Static

Return Values

Int64Static - A reference to an Int64Static object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: JulianCalendar (get)

JulianCalendar

Gets an object used to access the JulianCalendar static methods.

 Public Property Get JulianCalendar ( ) As JulianCalendarStatic

Return Values

JulianCalendarStatic - A reference to a JulianCalendarStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

JulianCalendar

JulianCalendarStatic


StaticClasses: KoreanCalendar (get)

KoreanCalendar

Gets an object used to access the KoreanCalendar static methods.

 Public Property Get KoreanCalendar ( ) As KoreanCalendarStatic

Return Values

KoreanCalendarStatic - A reference to a KoreanCalendarStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

KoreanCalendar

KoreanCalendarStatic


StaticClasses: MACTripleDES (get)

MACTripleDES

Gets an object used to access the MACTripleDES static methods.

 Public Property Get MACTripleDES ( ) As MACTripleDESStatic

Return Values

MACTripleDESStatic - A reference to a MACTripleDESStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: MD5 (get)

MD5

Gets an object used to access the MD5 static methods.

 Public Property Get MD5 ( ) As MD5Static

Return Values

MD5Static - A reference to an MD5Static object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: MemoryMappedFile (get)

MemoryMappedFile

Gets a reference used to access the MemoryMappedFile static methods.

 Public Property Get MemoryMappedFile ( ) As MemoryMappedFileStatic

Return Values

MemoryMappedFileStatic - A reference to a MemoryMappedFileStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: MyBase (get)

MyBase

Gets a reference used to access the ObjectBase static methods.

 Public Property Get MyBase ( ) As ObjectBase

Return Values

ObjectBase - A reference to an ObjectBase object.

Remarks

The ObjectBase object provides default implementations of the methods in the IObject interface.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: NumberFormatInfo (get)

NumberFormatInfo

Gets an object used to access the NumberFormatInfo static methods.

 Public Property Get NumberFormatInfo ( ) As NumberFormatInfoStatic

Return Values

NumberFormatInfoStatic - A reference to a NumberFormatInfoStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

NumberFormatInfo

NumberFormatInfoStatic


StaticClasses: Object (get)

Object

Gets an object used to access the ObjectStatic static methods.

 Public Property Get Object ( ) As ObjectStatic

Return Values

ObjectStatic - A reference to ObjectStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: Path (get)

Path

Gets an object used to access the Path static methods.

 Public Property Get Path ( ) As Path

Return Values

Path - A reference to a Path object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

Path

Build on Sunday, October 11, 2020 by VBDOX


StaticClasses: RC2 (get)

RC2

Gets an object used to access the RC2 static methods.

 Public Property Get RC2 ( ) As RC2Static

Return Values

RC2Static - A reference to an RC2Static object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: Registry (get)

Registry

Gets an object used to access the Registry static methods.

 Public Property Get Registry ( ) As Registry

Return Values

Registry - A reference to a Registry object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

Registry

RegistryKey


StaticClasses: RegistryKey (get)

RegistryKey

Gets an object used to access the RegistryKey static methods.

 Public Property Get RegistryKey ( ) As RegistryKeyStatic

Return Values

RegistryKeyStatic - A reference to a RegistryKeyStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

RegistryKey

RegistryKeyStatic

Registry


StaticClasses: ResourceManager (get)

ResourceManager

Gets an object used to access the ResourceManager static methods.

 Public Property Get ResourceManager ( ) As ResourceManagerStatic

Return Values

ResourceManagerStatic - A reference to a ResourceManagerStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

ResourceManagerStatic

ResourceManager

ResourceSet

ResourceReader


StaticClasses: Rijndael (get)

Rijndael

Gets an object used to access the Rijndael static methods.

 Public Property Get Rijndael ( ) As RijndaelStatic

Return Values

RijndaelStatic - A reference to a RijndailStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: RSA (get)

RSA

Gets an object used to access the RSA static methods.

 Public Property Get RSA ( ) As RSAStatic

Return Values

RSAStatic - A reference to a RSAStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: RSACryptoServiceProvider (get)

RSACryptoServiceProvider

Gets a reference used to access the RSACryptoServiceProvider static methods.

 Public Property Get RSACryptoServiceProvider ( ) As RSACryptoServiceProviderStatic

Return Values

RSACryptoServiceProviderStatic - A reference to an RSACryptoServiceProviderStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: SecurityElement (get)

SecurityElement

Gets an object used to access the SecurityElement static methods.

 Public Property Get SecurityElement ( ) As SecurityElementStatic

Return Values

SecurityElementStatic - A reference to a SecurityElementStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: SHA1 (get)

SHA1

Gets an object used to access the SHA1 static methods.

 Public Property Get SHA1 ( ) As SHA1Static

Return Values

SHA1Static - A reference to an SHA1Static object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: SHA256 (get)

SHA256

Gets an object used to access the SHA256 static methods.

 Public Property Get SHA256 ( ) As SHA256Static

Return Values

SHA256Static - A reference to an SHA256Static object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: SHA384 (get)

SHA384

Gets an object used to access the SHA384 static methods.

 Public Property Get SHA384 ( ) As SHA384Static

Return Values

SHA384Static - A reference to an SHA384Static object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: SHA512 (get)

SHA512

Gets an object used to access the SHA512 static methods.

 Public Property Get SHA512 ( ) As SHA512Static

Return Values

SHA512Static - A reference to an SHA512Static object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: Sign

Sign

Represents the sign values of BigInteger values.

 Public Enum Sign

Values

Negative = - 1
The value is a negative number.
Zero = 0
The value is zero.
Positive = 1
The value is a positive number.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: StopWatch (get)

StopWatch

Gets an object used to access the StopWatch static methods.

 Public Property Get StopWatch ( ) As StopWatchStatic

Return Values

StopWatchStatic - A reference to a StopWatchStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: Stream (get)

Stream

Gets an object used to access the Stream static methods.

 Public Property Get Stream ( ) As StreamStatic

Return Values

StreamStatic - A reference to a StreamStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

Stream

StreamStatic


StaticClasses: StringComparer (get)

StringComparer

Gets a reference used to access the StringComparer static methods.

 Public Property Get StringComparer ( ) As StringComparerStatic

Return Values

StringComparerStatic - A reference to a StringComparerStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: TextReader (get)

TextReader

Gets an object used to access the TextReader static methods.

 Public Property Get TextReader ( ) As TextReaderStatic

Return Values

TextReaderStatic - A reference to a TextReaderStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

TextReader

TextReaderStatic

StreamReader


StaticClasses: Thread (get)

Thread

Gets an object used to access the Thread static methods.

 Public Property Get Thread ( ) As ThreadStatic

Return Values

ThreadStatic - A reference to a ThreadStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: TimeSpan (get)

TimeSpan

Gets an object used to access the TimeSpan static methods.

 Public Property Get TimeSpan ( ) As TimeSpanStatic

Return Values

TimeSpanStatic - A reference to a TimeSpanStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

TimeSpan

TimeSpanStatic


StaticClasses: TimeZone (get)

TimeZone

Gets an object used to access the TimeZone static methods.

 Public Property Get TimeZone ( ) As TimeZoneStatic

Return Values

TimeZoneStatic - A reference to a TimeZoneStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

TimeZone

TimeZoneStatic


StaticClasses: TripleDES (get)

TripleDES

Gets an object used to access the TripleDES static methods.

 Public Property Get TripleDES ( ) As TripleDESStatic

Return Values

TripleDESStatic - A reference to a TripleDESStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview


StaticClasses: Version (get)

Version

Gets an object used to access the Version static methods.

 Public Property Get Version ( ) As VersionStatic

Return Values

VersionStatic - A reference to a VersionStatic object.

Read Only.

See Also

Project CorLib Overview

Class StaticClasses Overview

Version

VersionStatic


StopWatch

StopWatch

Provides a timing mechanism using QueryPerformanceCounter if available, otherwise the system time is used.

Implements:

IObject

Public:

Properties:

Name | Description
Elapsed (get) | Returns the elapsed time as a TimeSpan object.
ElapsedMilliseconds (get) | Returns the time elapsed in milliseconds.
ElapsedTicks (get) | Returns the elapsed time in Ticks.
IsRunning (get) | Returns if the StopWatch is currently running.

Methods:

Name | Description
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr.
Reset | Stops the StopWatch object and resets the elapsed time to zero.
Restart | Restarts the StopWatch from zero.
StartCount | Starts the StopWatch object.
StopCount | Halts the StopWatch if it is running, storing the elapsed time so far.
ToString | Returns a string representation of this object.

See Also

Project CorLib Overview

Class StopWatch Overview

StopWatchStatic


StopWatch: Elapsed (get)

Elapsed

Returns the elapsed time as a TimeSpan object.

 Public Property Get Elapsed ( ) As TimeSpan

Return Values

TimeSpan - A TimeSpan object.

Remarks

The elapsed time reflects the sum total of all durations timed when calling the StartCount and StopCount. Each time the StopWatch is started, the elapsed time will accumulate, but it will not reset to zero when the StopWatch is stopped. Calling the Reset method will stop the StopWatch and reset the elapsed time to zero.

If the StopWatch is running when the elapsed time is checked, the current accumulated amount of time will be returned. The StopWatch will not be stopped.

Read Only.

See Also

Project CorLib Overview

Class StopWatch Overview


StopWatch: ElapsedMilliseconds (get)

ElapsedMilliseconds

Returns the time elapsed in milliseconds.

 Public Property Get ElapsedMilliseconds ( ) As Currency

Return Values

Currency - The time elapsed in milliseconds.

Remarks

The elapsed time reflects the sum total of all durations timed when calling the StartCount and StopCount. Each time the StopWatch is started, the elapsed time will accumulate, but it will not reset to zero when the StopWatch is stopped. Calling the Reset method will stop the StopWatch and reset the elapsed time to zero.

If the StopWatch is running when the elapsed time is checked, the current accumulated amount of time will be returned. The StopWatch will not be stopped.

Read Only.

See Also

Project CorLib Overview

Class StopWatch Overview


StopWatch: ElapsedTicks (get)

ElapsedTicks

Returns the elapsed time in Ticks.

 Public Property Get ElapsedTicks ( ) As Variant

Return Values

Variant - The elapsed Ticks is returned.

Remarks

The elapsed time reflects the sum total of all durations timed when calling the StartCount and StopCount. Each time the StopWatch is started, the elapsed time will accumulate, but it will not reset to zero when the StopWatch is stopped. Calling the Reset method will stop the StopWatch and reset the elapsed time to zero.

If the StopWatch is running when the elapsed time is checked, the current accumulated amount of time will be returned. The StopWatch will not be stopped.

Read Only.

See Also

Project CorLib Overview

Class StopWatch Overview


StopWatch: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test for equality against this object instance.

Return Values

Boolean - The result of the equality comparison.

See Also

Project CorLib Overview

Class StopWatch Overview


StopWatch: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr.

 Public Function GetHashCode ( ) As Long

Return Values

Long - The hashcode for this object instance.

See Also

Project CorLib Overview

Class StopWatch Overview


StopWatch: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class StopWatch Overview


StopWatch: IsRunning (get)

IsRunning

Returns if the StopWatch is currently running.

 Public Property Get IsRunning ( ) As Boolean

Return Values

Boolean -

Read Only.

See Also

Project CorLib Overview

Class StopWatch Overview


StopWatch: Reset

Reset

Stops the StopWatch object and resets the elapsed time to zero.

 Public Sub Reset ( )

See Also

Project CorLib Overview

Class StopWatch Overview


StopWatch: Restart

Restart

Restarts the StopWatch from zero.

 Public Sub Restart ( )

See Also

Project CorLib Overview

Class StopWatch Overview


StopWatch: StartCount

StartCount

Starts the StopWatch object.

 Public Sub StartCount ( )

Remarks

If StartCount is called again, the elapsed time is not reset. The elapsed time is increased as normal, but does not reflect the time spent while the StopWatch was not running.

Using the StartCount and StopCount allows for timing of only portions that are prefered and accumulates only those portions. The elapsed time properties will reflect the sum total of those timed portions. Calling Reset will set the elapsed time to zero.

If the StopWatch is already running, then nothing is changed.

See Also

Project CorLib Overview

Class StopWatch Overview


StopWatch: StopCount

StopCount

Halts the StopWatch if it is running, storing the elapsed time so far.

 Public Sub StopCount ( )

Remarks

If StartCount is called again, the elapsed time is not reset. The elapsed time is increased as normal, but does not reflect the time spent while the StopWatch was not running.

Using the StartCount and StopCount allows for timing of only portions that are prefered and accumulates only those portions. The elapsed time properties will reflect the sum total of those timed portions. Calling Reset will set the elapsed time to zero.

See Also

Project CorLib Overview

Class StopWatch Overview


StopWatch: ToString

ToString

Returns a string representation of this object.

 Public Function ToString ( ) As String

Return Values

String - A string representation.

See Also

Project CorLib Overview

Class StopWatch Overview


StopWatchStatic

StopWatchStatic

Provides methods that are related to the StopWatch class.

Public:

Properties:

Name | Description
Frequency (get) | Returns the frequency of the high resolution timer.
IsHighResolution (get) | Returns if the StopWatch class will be using the high resolution timer.

Methods:

Name | Description
GetTimeStamp | Returns the current time of the timer.
StartNew | Returns a new StopWatch object that is then started upon return.

See Also

Project CorLib Overview

Class StopWatchStatic Overview

StopWatch


StopWatchStatic: Frequency (get)

Frequency

Returns the frequency of the high resolution timer.

 Public Property Get Frequency ( ) As Currency

Return Values

Currency - The frequency used by the high resolution timer.

Read Only.

See Also

Project CorLib Overview

Class StopWatchStatic Overview


StopWatchStatic: GetTimeStamp

GetTimeStamp

Returns the current time of the timer.

 Public Function GetTimeStamp ( ) As Currency

Return Values

Currency - The current time from the timer.

Remarks

If the timer is high resolution, then the result from QueryPerformanceCounter is returned, otherwise, the result from timeGetTime is used.

See Also

Project CorLib Overview

Class StopWatchStatic Overview


StopWatchStatic: IsHighResolution (get)

IsHighResolution

Returns if the StopWatch class will be using the high resolution timer.

 Public Property Get IsHighResolution ( ) As Boolean

Return Values

Boolean - Returns True if there is high resolution, False otherwise.

Remarks

High resolution timers are hardward dependant.

Read Only.

See Also

Project CorLib Overview

Class StopWatchStatic Overview


StopWatchStatic: StartNew

StartNew

Returns a new StopWatch object that is then started upon return.

 Public Function StartNew ( ) As StopWatch

Return Values

StopWatch - A new StopWatch object.

See Also

Project CorLib Overview

Class StopWatchStatic Overview


Stream

Stream

Provides a set of standard methods for using a Stream object.

Public:

Types:

Name | Description
SeekOrigin | The reference point in which to begin seeking from.

Properties:

Name | Description
CanRead (get) | Returns if the stream supports reading.
CanSeek (get) | Returns if the stream supports seeking.
CanTimeout (get) | Returns if the Stream object can timeout during a read or write operation.
CanWrite (get) | Returns if the stream supports being written to.
Length (get) | Returns the length of the stream in bytes.
Position (get) | Returns the current position within the stream.
Position (let) | Sets the position in the stream where the next read or write will take place.
ReadTimeout (get) | Returns the duration allowed before a timeout will occur.
ReadTimeout (let) | Sets the duration allowed before a timeout will occur.
WriteTimeout (get) | Returns the duration allowed before a timeout will occur.
WriteTimeout (let) | Sets the duration allowed before a timeout will occur.

Methods:

Name | Description
BeginRead | Begins an Asynchronous reading process.
BeginWrite | Begins an Asynchronous writing process.
CloseStream | Closes the current stream.
CopyTo | Reads the bytes from the current stream and writes them to another stream.
EndRead | Ends an asynchronous read operation returning the total number of bytes read.
EndWrite | Used to end an asynchronous write operation.
Equals | Determines if this instance is equal to the value.
Flush | Flushes any buffers in the object to the underlying stream.
GetHashCode | Returns a semi-unique number representing this instance.
ReadBlock | Reads a block of bytes from the stream.
ReadByte | Reads a single byte from the stream.
SeekPosition | Moves the current stream pointer to a new position.
SetLength | Sets the length of the current stream.
ToString | Returns a string representation of the this instance.
WriteBlock | Writes an array of bytes to the stream.
WriteByte | Writes a single byte to the stream.

Remarks

This interface should be implements on classes that wish to be used as a Stream type object.

See Also

Project CorLib Overview

Class Stream Overview

StreamStatic

FileStream

MemoryStream

CryptoStream


Stream: BeginRead

BeginRead

Begins an Asynchronous reading process.

 Public Function BeginRead(
      ByRef Buffer ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long,
      Optional ByVal Callback As AsyncCallback,
      Optional ByRef State As Variant ) As IAsyncResult

Parameters

Buffer
[ByRef] Byte. The buffer to read into.
Offset
[ByVal] Long. The starting index in Buffer to begin reading into.
Count
[ByVal] Long. The number of bytes to be read into the buffer.
Callback
[ByVal] Optional. AsyncCallback. Object used to receive notification of the finish of the read.
State
[ByRef] Optional. Variant. Information the caller can use to distinguish from other reads.

Return Values

IAsyncResult - Represents the current read state.

See Also

Project CorLib Overview

Class Stream Overview


Stream: BeginWrite

BeginWrite

Begins an Asynchronous writing process.

 Public Function BeginWrite(
      ByRef Buffer ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long,
      Optional ByVal Callback As AsyncCallback,
      Optional ByRef State As Variant ) As IAsyncResult

Parameters

Buffer
[ByRef] Byte. The source of the data to write to the stream.
Offset
[ByVal] Long. The position in the buffer to begin writing from.
Count
[ByVal] Long. The number of bytes to be written to the stream.
Callback
[ByVal] Optional. AsyncCallback. An object used to receive notification of the completion for the writing.
State
[ByRef] Optional. Variant. A user-supplied information used to distinguish this from other writings.

Return Values

IAsyncResult - Represents the current write state.

See Also

Project CorLib Overview

Class Stream Overview


Stream: CanRead (get)

CanRead

Returns if the stream supports reading.

 Public Property Get CanRead ( ) As Boolean

Return Values

Boolean - The indication for the support of reading.

Read Only.

See Also

Project CorLib Overview

Class Stream Overview


Stream: CanSeek (get)

CanSeek

Returns if the stream supports seeking.

 Public Property Get CanSeek ( ) As Boolean

Return Values

Boolean - The indication for the support to seek.

Remarks

Seeking is the ability to change position within the stream from a specified reference point.

Read Only.

See Also

Project CorLib Overview

Class Stream Overview


Stream: CanTimeout (get)

CanTimeout

Returns if the Stream object can timeout during a read or write operation.

 Public Property Get CanTimeout ( ) As Boolean

Return Values

Boolean - Returns True if the Stream can timeout, False otherwise.

Read Only.

See Also

Project CorLib Overview

Class Stream Overview


Stream: CanWrite (get)

CanWrite

Returns if the stream supports being written to.

 Public Property Get CanWrite ( ) As Boolean

Return Values

Boolean - The indication for the support of being written to.

Read Only.

See Also

Project CorLib Overview

Class Stream Overview


Stream: CloseStream

CloseStream

Closes the current stream.

 Public Sub CloseStream ( )

See Also

Project CorLib Overview

Class Stream Overview


Stream: CopyTo

CopyTo

Reads the bytes from the current stream and writes them to another stream.

 Public Sub CopyTo(
      ByVal Destination As Stream,
      Optional ByVal BufferSize As Long = 81920 )

Parameters

Destination
[ByVal] Stream. The stream to which the contents of the current stream will be copied.
BufferSize
[ByVal] Optional. Long. The size of the buffer. This value must be greater than zero. The default size is 81920.

Default: 81920

Remarks

Copying begins at the current position in the current stream, and does not reset the position of the destination stream after the copy operation is complete.

Exceptions

Exception | Condition
ArgumentNullException | Destination is Nothing.
NotSupportedException | The current stream does not support reading. -or- Destination does not support writing.
ObjectDisposedException | Either the current stream or Destination were closed before the CopyTo method was called.
IOException | An I/O error occurred.

See Also

Project CorLib Overview

Class Stream Overview


Stream: EndRead

EndRead

Ends an asynchronous read operation returning the total number of bytes read.

 Public Function EndRead(
      ByVal AsyncResult As IAsyncResult ) As Long

Parameters

AsyncResult
[ByVal] IAsyncResult. The object that represents the read process.

Return Values

Long - The number of bytes actuall read from the stream.

See Also

Project CorLib Overview

Class Stream Overview


Stream: EndWrite

EndWrite

Used to end an asynchronous write operation.

 Public Sub EndWrite(
      ByVal AsyncResult As IAsyncResult )

Parameters

AsyncResult
[ByVal] IAsyncResult. The object that represents the write process.

See Also

Project CorLib Overview

Class Stream Overview


Stream: Equals

Equals

Determines if this instance is equal to the value.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to check this instance against for equality.

Return Values

Boolean - Indication of equality.

See Also

Project CorLib Overview

Class Stream Overview


Stream: Flush

Flush

Flushes any buffers in the object to the underlying stream.

 Public Sub Flush ( )

See Also

Project CorLib Overview

Class Stream Overview


Stream: GetHashCode

GetHashCode

Returns a semi-unique number representing this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long -

See Also

Project CorLib Overview

Class Stream Overview


Stream: Length (get)

Length

Returns the length of the stream in bytes.

 Public Property Get Length ( ) As Currency

Return Values

Currency - The length of the stream.

Remarks

A currency datatype is used to support stream greater than 2gig.
The stream generally needs to support seeking to be able to return the length.

Read Only.

See Also

Project CorLib Overview

Class Stream Overview


Stream: Position (get)

Position

Returns the current position within the stream.

 Public Property Get Position ( ) As Currency

Return Values

Currency - The current position within the stream.

Remarks

A currency datatype is used to support stream greater than 2gig.

Read/Write.

See Also

Project CorLib Overview

Class Stream Overview


Stream: Position (let)

Position

Sets the position in the stream where the next read or write will take place.

 Public Property Let Position(
      ByVal Value As Currency ) :

Parameters

Value
[ByVal] Currency. The position within the stream offset from the beginning of the stream.

Remarks

A currency datatype is used to support stream greater than 2gig.
The stream generally needs to support seeking to be able to return the length.

Read/Write.

See Also

Project CorLib Overview

Class Stream Overview


Stream: ReadBlock

ReadBlock

Reads a block of bytes from the stream.

 Public Function ReadBlock(
      ByRef Buffer ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long ) As Long

Parameters

Buffer
[ByRef] Byte. The array to read the bytes into.
Offset
[ByVal] Long. The starting index in Buffer to begin reading to.
Count
[ByVal] Long. The number of bytes to read from the stream.

Return Values

Long - The number of bytes actually read from the stream.

Remarks

The .NET version of this will block the thread until the requested number of bytes are actually read. This is not supported in this version.

See Also

Project CorLib Overview

Class Stream Overview


Stream: ReadByte

ReadByte

Reads a single byte from the stream.

 Public Function ReadByte ( ) As Long

Return Values

Long - A byte value or -1 if passed the end of the stream.

See Also

Project CorLib Overview

Class Stream Overview


Stream: ReadTimeout (get)

ReadTimeout

Returns the duration allowed before a timeout will occur.

 Public Property Get ReadTimeout ( ) As Long

Return Values

Long - The timeout period in milliseconds.

Remarks

Note to Implementor: If the class does not support timeout capabilities, then this method should return a InvalidOperationException.

Read/Write.

See Also

Project CorLib Overview

Class Stream Overview


Stream: ReadTimeout (let)

ReadTimeout

Sets the duration allowed before a timeout will occur.

 Public Property Let ReadTimeout(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The timeout period in milliseconds.

Remarks

Note to Implementor: If the class does not support timeout capabilities, then this method should return a InvalidOperationException.

Read/Write.

See Also

Project CorLib Overview

Class Stream Overview


Stream: SeekOrigin

SeekOrigin

The reference point in which to begin seeking from.

 Public Enum SeekOrigin

Values

FromBeginning = FILE_BEGIN
The new position will be offset from the beginning of the file. A negative value will cause an exception.
FromCurrent = FILE_CURRENT
The position will be offset from the current file pointer location. The value can be negative to seek backwards from the current position.
FromEnd = FILE_END
The new position will be offset from the end of the file. A positive number will cause an exception. The offset should be 0 or negative.

See Also

Project CorLib Overview

Class Stream Overview


Stream: SeekPosition

SeekPosition

Moves the current stream pointer to a new position.

 Public Function SeekPosition(
      ByVal Offset As Currency,
      ByVal Origin As SeekOrigin ) As Currency

Parameters

Offset
[ByVal] Currency. The number of bytes to move the pointer (can be negative.)
Origin
[ByVal] SeekOrigin. The reference to begin moving from.

Return Values

Currency - The final position the pointer moved to.

See Also

Project CorLib Overview

Class Stream Overview


Stream: SetLength

SetLength

Sets the length of the current stream.

 Public Sub SetLength(
      ByVal Value As Currency )

Parameters

Value
[ByVal] Currency. The new length to set the stream to.

Remarks

Generally the stream must support seeking to set the length.

See Also

Project CorLib Overview

Class Stream Overview


Stream: ToString

ToString

Returns a string representation of the this instance.

 Public Function ToString ( ) As String

Return Values

String - A string representation of the this instance.

See Also

Project CorLib Overview

Class Stream Overview


Stream: WriteBlock

WriteBlock

Writes an array of bytes to the stream.

 Public Sub WriteBlock(
      ByRef Buffer ( ) As Byte,
      ByVal Offset As Long,
      ByVal Count As Long )

Parameters

Buffer
[ByRef] Byte. The array of bytes to be written.
Offset
[ByVal] Long. The starting index in Buffer to begin writing from.
Count
[ByVal] Long. The number of bytes to be written.

See Also

Project CorLib Overview

Class Stream Overview


Stream: WriteByte

WriteByte

Writes a single byte to the stream.

 Public Sub WriteByte(
      ByVal Value As Byte )

Parameters

Value
[ByVal] Byte. The byte to be written.

See Also

Project CorLib Overview

Class Stream Overview


Stream: WriteTimeout (get)

WriteTimeout

Returns the duration allowed before a timeout will occur.

 Public Property Get WriteTimeout ( ) As Long

Return Values

Long - The timeout period in milliseconds.

Remarks

Note to Implementor: If the class does not support timeout capabilities, then this method should return a InvalidOperationException.

Read/Write.

See Also

Project CorLib Overview

Class Stream Overview


Stream: WriteTimeout (let)

WriteTimeout

Sets the duration allowed before a timeout will occur.

 Public Property Let WriteTimeout(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. the timeout period in milliseconds.

Remarks

Note to Implementor: If the class does not support timeout capabilities, then this method should return a InvalidOperationException.

Read/Write.

See Also

Project CorLib Overview

Class Stream Overview


StreamReader

StreamReader

Reads characters from a byte array in a particular encoding.

Implements:

IObject
TextReader

Public:

Properties:

Name | Description
BaseStream (get) | Returns the base stream this reader is reading from.
CurrentEncoding (get) | Returns the current encoding used by the reader.
EndOfStream (get) |

Methods:

Name | Description
CloseReader | Closes the reader.
DiscardBufferedData | Discards the currently buffered data to allow reading from a new position in the underlying stream.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
Peek | Returns the the next char from the reader without consuming it.
Read | Returns the next char from the reader.
ReadBlock | Reads a block of characters from the the stream.
ReadLine | Returns a string of characters to the next new-line character.
ReadToEnd | Returns a string of all remaining characters in the stream.
ToString | Returns a string representation of this object instance.

Remarks

The StreamReader object cannot be created directly. In order to create a new StreamReader, use the Cor.NewStreamReader method.

Unlike the FileStream and MemoryStream classes, the StreamReader reads bytes that are of a particular encoding to be decoded. Instead of reading bytes, the StreamReader returns characters or strings of the decoded bytes.

The default encoding is UTF8Encoding.

Examples

This example attempts to open a text file and read the lines and display them.

Private Sub Main()
    Dim Reader As StreamReader
    Dim Line As String

    On Error GoTo Catch

    ' Create a StreamReader to read in a file.
    Set Reader = NewStreamReader("TestFile.txt")

    ' Read in each line and display it until
    ' the end of the file is reached.
    Do
        ' Read in characters until a carriage-return is reached.
        Line = Reader.ReadLine
        Debug.Print Line
    Loop While Not CorString.IsNull(Line) ' A null string is equal to StrPtr(Line) = 0

    Reader.CloseReader
    Exit Sub

Catch:
    Dim Ex As Exception
    ' Check if an exception was thrown.
    If Catch(Ex) Then
        Debug.Print "The file could not be opened."
        Debug.Print Ex.Message
    End If
End Sub

See Also

Project CorLib Overview

Class StreamReader Overview

Constructors

StreamWriter

TextReader


StreamReader: BaseStream (get)

BaseStream

Returns the base stream this reader is reading from.

 Public Property Get BaseStream ( ) As Stream

Return Values

Stream - The base stream.

Read Only.

See Also

Project CorLib Overview

Class StreamReader Overview


StreamReader: CloseReader

CloseReader

Closes the reader.

 Public Sub CloseReader ( )

See Also

Project CorLib Overview

Class StreamReader Overview


StreamReader: CurrentEncoding (get)

CurrentEncoding

Returns the current encoding used by the reader.

 Public Property Get CurrentEncoding ( ) As Encoding

Return Values

Encoding - The encoding being used by the reader currently.

Read Only.

See Also

Project CorLib Overview

Class StreamReader Overview


StreamReader: DiscardBufferedData

DiscardBufferedData

Discards the currently buffered data to allow reading from a new position in the underlying stream.

 Public Sub DiscardBufferedData ( )

Remarks

The StreamReader buffers more data than is usually read at a single time. If the position of the underlying stream is moved, then the data buffered in the StreamReader needs to be discarded so the reading can begin at the new Stream position.

See Also

Project CorLib Overview

Class StreamReader Overview


StreamReader: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class StreamReader Overview


StreamReader: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class StreamReader Overview


StreamReader: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class StreamReader Overview


StreamReader: Peek

Peek

Returns the the next char from the reader without consuming it.

 Public Function Peek ( ) As Long

Return Values

Long - The next character to be read, or -1 if the end of the stream has been reached.

Remarks

The character that is returned is not removed from the stream. Any characters above &H7FFF will be returned as a positive value.

See Also

Project CorLib Overview

Class StreamReader Overview


StreamReader: Read

Read

Returns the next char from the reader.

 Public Function Read ( ) As Long

Return Values

Long - The next character to be read, or -1 if the end of the stream was reached.

Remarks

Any characters above &H7FFF will be returned as a positive value.

See Also

Project CorLib Overview

Class StreamReader Overview


StreamReader: ReadBlock

ReadBlock

Reads a block of characters from the the stream.

 Public Function ReadBlock(
      ByRef Buffer ( ) As Integer,
      ByVal Index As Long,
      ByVal Count As Long ) As Long

Parameters

Buffer
[ByRef] Integer. The array to read the characters in to.
Index
[ByVal] Long. The starting index in Buffer to begin reading to.
Count
[ByVal] Long. The number of characters to be read.

Return Values

Long - The actual number of characters read.

See Also

Project CorLib Overview

Class StreamReader Overview


StreamReader: ReadLine

ReadLine

Returns a string of characters to the next new-line character.

 Public Function ReadLine ( ) As String

Return Values

String - A string containing the characters up to the next new-line character.

Remarks

If there are no more bytes to in the stream, then a null string is returned. This can be checked for using the CorString.IsNull function.

See Also

Project CorLib Overview

Class StreamReader Overview


StreamReader: ReadToEnd

ReadToEnd

Returns a string of all remaining characters in the stream.

 Public Function ReadToEnd ( ) As String

Return Values

String - A string containing the remaining characters.

See Also

Project CorLib Overview

Class StreamReader Overview


StreamReader: TextReader

TextReader

 Implements TextReader

Return Values

TextReader -

See Also

Project CorLib Overview

Class StreamReader Overview


StreamReader: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class StreamReader Overview


StreamStatic

StreamStatic

Provides static methods for the Stream class.

Public:

Properties:

Name | Description
NullStream (get) | Returns a Stream object with no backing store.

See Also

Project CorLib Overview

Class StreamStatic Overview

Stream

PublicFunctions


StreamStatic: NullStream (get)

NullStream

Returns a Stream object with no backing store.

 Public Property Get NullStream ( ) As Stream

Return Values

Stream - A Stream object that has no backing store.

Read Only.

See Also

Project CorLib Overview

Class StreamStatic Overview


StreamWriter

StreamWriter

Writes characters to a byte stream using the specific encoding.

Implements:

IObject
TextWriter

Public:

Properties:

Name | Description
AutoFlush (get) | Returns if the writer autoflushes after each write.
AutoFlush (let) | Sets if the writer autoflushes after each write.
BaseStream (get) | Returns the stream this writer is using.
Encoding (get) | Returns the encoding being used by this writer.
FormatProvider (get) | Returns the format provider being used by this writer.
NewLine (get) | Returns the new-line string used by this writer.
NewLine (let) | Sets the new-line string used by this writer.

Methods:

Name | Description
CloseWriter | Closes this writer, flushing any buffers needed.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
Flush | Flushes the buffers to the underlying stream.
GetHashCode | Returns a pseudo-unique number identifying this instance.
ToString | Returns a string representation of this object instance.
WriteChars | Writes a subarray of characters to the stream.
WriteLine | Writes the value, then appends the new-line string.
WriteLineChars | Writes a subarray of characters to the text stream, followed by a line terminator.
WriteValue | Writes the encoded string representation of the value to the stream.

Remarks

StreamWriter defaults to using an instance of UTF8Encoding unless specified otherwise. This instance of UTF8Encoding is constructed without a byte order mark (BOM), so its GetPreamble method returns an empty byte array. To create a StreamWriter using UTF-8 encoding and a BOM, consider using a constructor that specifies encoding, such as NewStreamWriter(String, Boolean, Encoding).

See Also

Project CorLib Overview

Class StreamWriter Overview


StreamWriter: AutoFlush (get)

AutoFlush

Returns if the writer autoflushes after each write.

 Public Property Get AutoFlush ( ) As Boolean

Return Values

Boolean - Indication of autoflush.

Read/Write.

See Also

Project CorLib Overview

Class StreamWriter Overview


StreamWriter: AutoFlush (let)

AutoFlush

Sets if the writer autoflushes after each write.

 Public Property Let AutoFlush(
      ByVal Value As Boolean )

Parameters

Value
[ByVal] Boolean. The new value.

Read/Write.

See Also

Project CorLib Overview

Class StreamWriter Overview


StreamWriter: BaseStream (get)

BaseStream

Returns the stream this writer is using.

 Public Property Get BaseStream ( ) As Stream

Return Values

Stream - The stream being used by this writer.

Read Only.

See Also

Project CorLib Overview

Class StreamWriter Overview


StreamWriter: CloseWriter

CloseWriter

Closes this writer, flushing any buffers needed.

 Public Sub CloseWriter ( )

See Also

Project CorLib Overview

Class StreamWriter Overview


StreamWriter: Encoding (get)

Encoding

Returns the encoding being used by this writer.

 Public Property Get Encoding ( ) As Encoding

Return Values

Encoding - The encoding being used by this writer.

Read Only.

See Also

Project CorLib Overview

Class StreamWriter Overview


StreamWriter: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class StreamWriter Overview


StreamWriter: Flush

Flush

Flushes the buffers to the underlying stream.

 Public Sub Flush ( )

See Also

Project CorLib Overview

Class StreamWriter Overview


StreamWriter: FormatProvider (get)

FormatProvider

Returns the format provider being used by this writer.

 Public Property Get FormatProvider ( ) As IFormatProvider

Return Values

IFormatProvider - The format provider used by this writer.

Read Only.

See Also

Project CorLib Overview

Class StreamWriter Overview


StreamWriter: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class StreamWriter Overview


StreamWriter: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class StreamWriter Overview


StreamWriter: NewLine (get)

NewLine

Returns the new-line string used by this writer.

 Public Property Get NewLine ( ) As String

Return Values

String - The new-line string.

Read/Write.

See Also

Project CorLib Overview

Class StreamWriter Overview


StreamWriter: NewLine (let)

NewLine

Sets the new-line string used by this writer.

 Public Property Let NewLine(
      ByVal Value As String )

Parameters

Value
[ByVal] String. The new new-line value.

Read/Write.

See Also

Project CorLib Overview

Class StreamWriter Overview


StreamWriter: TextWriter

TextWriter

 Implements TextWriter

Return Values

TextWriter -

See Also

Project CorLib Overview

Class StreamWriter Overview


StreamWriter: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class StreamWriter Overview


StreamWriter: WriteChars

WriteChars

Writes a subarray of characters to the stream.

 Public Sub WriteChars(
      ByRef Buffer ( ) As Integer,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant )

Parameters

Buffer
[ByRef] Integer. A character array containing the data to write.
Index
[ByRef] Optional. Variant. The character position in Buffer at which to start reading data.
Count
[ByRef] Optional. Variant. The maximum number of characters to write.

Exceptions

Exception | Condition
ArgumentNullException | Buffer is uninitialized.
ObjectDisposedException | The writer is closed.

See Also

Project CorLib Overview

Class StreamWriter Overview


StreamWriter: WriteLine

WriteLine

Writes the value, then appends the new-line string.

 Public Sub WriteLine(
      ParamArray Value ( ) As Variant )

Parameters

Value
[ByRef] Variant. The value to be written.

Remarks

The first argument in Value is the output to the string. Any additional arguments are used as formatting information. An argument can be refered to through formatting indexes. A formatting index is an integer enclosed in curly braces {}. The indexes start at 0.

Exceptions

Exception | Condition
ObjectDisposedException | The writer is closed.
FormatException | The format specification in format is invalid. -or- The number indicating an argument to be formatted is less than zero, or larger than or equal to the number of provided objects to be formatted.

See Also

Project CorLib Overview

Class StreamWriter Overview


StreamWriter: WriteLineChars

WriteLineChars

Writes a subarray of characters to the text stream, followed by a line terminator.

 Public Sub WriteLineChars(
      ByRef Buffer ( ) As Integer,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant )

Parameters

Buffer
[ByRef] Integer. The character array from which data is read.
Index
[ByRef] Optional. Variant. The character position in Buffer at which to start reading data.
Count
[ByRef] Optional. Variant. The maximum number of characters to write.

Exceptions

Exception | Condition
ObjectDisposedException | The writer is closed.

See Also

Project CorLib Overview

Class StreamWriter Overview


StreamWriter: WriteValue

WriteValue

Writes the encoded string representation of the value to the stream.

 Public Sub WriteValue(
      ByRef Value As Variant,
      ParamArray Args ( ) As Variant )

Parameters

Value
[ByRef] Variant. The value to be written to the stream.
Args
[ByRef] Variant. The arguments to be used in formatting the Value.

Remarks

The Args are used when argument indexes are supplied in the value to be written. Indexes are indicated by enclosing the specific index in curly braces {}. The indexes start at 0.

Exceptions

Exception | Condition
ObjectDisposedException | The writer is closed.
FormatException | The format specification in format is invalid. -or- The number indicating an argument to be formatted is less than zero, or larger than or equal to the number of provided objects to be formatted.

See Also

Project CorLib Overview

Class StreamWriter Overview


StringBuilder

StringBuilder

Allows easy manipulation, concatenation and removal of strings and characters.

Implements:

IObject

Public:

Properties:

Name | Description
Capacity (get) | Returns the buffer size of the string value.
Capacity (let) | Sets the amount of memory allocated in characters.
Chars (get) | Returns a character from the string value.
Chars (let) | Sets a character in the string value.
FillCharacter (get) | Returns the fill character used to pad empty space.
FillCharacter (let) | Sets the fill character used to pad empty space.
Length (get) | Returns the length of the current string value.
Length (let) | Sets the length of the current string value.

Methods:

Name | Description
Append | Appends the string representation of the specified value to this instance.
AppendChar | Appends a Unicode character a specified number of times to the end of string value.
AppendFormat | Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a single argument.
AppendFormatArray | Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a corresponding argument in a parameter array.
AppendFormatArrayEx | Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a corresponding argument in a parameter array using a specified format provider.
AppendFormatEx | Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a single argument.
AppendLine | Appends the supplied string and a Carriage-Return/Linefeed to the end of the StringBuilder.
AppendString | This function is designed to append strings quickly.
Clear | Removes all characters from the current StringBuilder instance.
CopyTo | Copies a set of characters from the StringBuilder into a character array.
EnsureCapacity | Ensures that the internal buffer has atleast the requested amount.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
Insert | Inserts a string into the current string value.
InsertChars | Inserts an array of characters into the string value.
Remove | Removes a number of characters from the string value.
Replace | Replaces a substring in the string value with a new string.
ToString | Returns the current version of the string value.

Remarks

This class can be used to quickly minpulate strings. It allows for easy concatenation, removal and modification of the current underlying string value.

See Also

Project CorLib Overview

Class StringBuilder Overview

Constructors

NumberFormatInfo

DateTimeFormatInfo


StringBuilder: Append

Append

Appends the string representation of the specified value to this instance.

 Public Function Append(
      ByRef Value As Variant,
      Optional ByRef StartIndex As Variant,
      Optional ByRef Count As Variant ) As StringBuilder

Parameters

Value
[ByRef] Variant. The value to be appended.
StartIndex
[ByRef] Optional. Variant. A zero-based index of the first character in the string representation to begin appending from.
Count
[ByRef] Optional. Variant. The number of characters from the string representation to append.

Return Values

StringBuilder - A refernece to this instance after the append operation has completed.

Remarks

This version of Append(Value) attempts to convert to the value using Object.ToString(Value). This will allow for objects that implement IObject or IFormattable to be converted to a string value using additional information.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: AppendChar

AppendChar

Appends a Unicode character a specified number of times to the end of string value.

 Public Function AppendChar(
      ByVal Char As Long,
      Optional ByVal Count As Long = 1 ) As StringBuilder

Parameters

Char
[ByVal] Long. The Unicode character code to append.
Count
[ByVal] Optional. Long. The number of times to append the character.

Default: 1

Return Values

StringBuilder - This instance of StringBuilder.

Remarks

The AppendChar(Char) method modifies the existing instance of this class; it does not return a new class instance.

The Char argument accepts a Long datatype, however, it converts the value to an Integer by taking only the lower 16 bits.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: AppendFormat

AppendFormat

Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a single argument.

 Public Function AppendFormat(
      ByRef Format As String,
      ParamArray Args ( ) As Variant ) As StringBuilder

Parameters

Format
[ByRef] String. The composite format string containing formatting information.
Args
[ByRef] Variant. The arguments to be formatted into the string.

Return Values

StringBuilder - This instance of StringBuilder.

Remarks

This method uses the composite formatting feature of VBCorLib to convert the value of an object to its text representation and embed that representation in the current StringBuilder object.

The Format parameter consists of zero or more runs of text intermixed with zero or more indexed placeholders, called format items, that correspond to values in the parameter list of this method. The formatting process replaces each format item with the string representation of the corresponding value.

The syntax of a format item is as follows:

{index[,length][:formatString]}

Elements in square brackets are optional. The following table describes each element.

Element | Description
index | The zero-based position in the parameter list of the object to be formatted. If the object specified by index is Nothing, the format item is replaced by an empty string. If there is no parameter in the index position, a FormatException is thrown.
,length | The minimum number of characters in the string representation of the parameter. If positive, the parameter is right-aligned; if negative, it is left-aligned.
:formatString | A standard or custom format string that is supported by the parameter.

Args represents the objects to be formatted. Each format item in Format is replaced with the string representation of the corresponding object in args. If the format item includes formatString and the corresponding object in Args implements the IFormattable interface, then Args(index).ToString(formatString, provider) defines the formatting. Otherwise, Object.ToString(Args(index)) defines the formatting.

Examples

This example uses the AppendFormat method to insert values into the string with formatting information. The output will show how the formatting information was used to transform the arguments into a formatted output.

Private Sub Main()
    Dim sb As New StringBuilder

    ' Indicates the index of the supplied
    ' arguments to be inserted into the string.
    sb.AppendFormat "My name {0}.", "Kelly"
    sb.AppendLine

    ' Insert an integer value that is 5 digits
    ' in length, prepending leading zeros if necessary.
    sb.AppendFormat "A number with leading zeros: {0:d5}.", 23
    sb.AppendLine

    ' Inserts the value into a column of 10 characters
    ' with alignment to the right of the column.
    sb.AppendFormat "Right aligned 10 character column: '{0,10}'.", "right"
    sb.AppendLine

    ' Inserts the value into a column of 10 characters
    ' with alignment fo the left of the column.
    sb.AppendFormat "Left aligned 10 character column: '{0,-10}'.", "left"
    sb.AppendLine

    ' To prevent the insertion of an argument and allow
    ' for curly braces to be inserted into the string, two
    ' braces must be placed together to cause an escape from
    ' the formatting sequence.
    sb.AppendFormat "Use two braces to put a single brace in the output without formatting. {{0}}", "Not Used"

    ' Display the contents of the StringBuilder
    Debug.Print sb.ToString
End Sub

' This code produces the following output.
'
' My name Kelly.
' A number with leading zeros: 00023.
' Right aligned 10 character column: '     right'.
' Left aligned 10 character column: 'left      '.
' Use two braces to put a single brace in the output without formatting. {0}

See Also

Project CorLib Overview

Class StringBuilder Overview

NumberFormatInfo

DateTimeFormatInfo


StringBuilder: AppendFormatArray

AppendFormatArray

Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a corresponding argument in a parameter array.

 Public Function AppendFormatArray(
      ByRef Format As String,
      ByRef Args ( ) As Variant ) As StringBuilder

Parameters

Format
[ByRef] String. A composite format string (see Remarks).
Args
[ByRef] Variant. An array of values to format.

Return Values

StringBuilder - A reference to this instance after the append operation has completed. After the append operation, this instance contains any data that existed before the operation, suffixed by a copy of Format where any format specification is replaced by the string representation of the corresponding object argument.

Remarks

This method uses the composite formatting feature of VBCorLib to convert the value of an object to its text representation and embed that representation in the current StringBuilder object.

The Format parameter consists of zero or more runs of text intermixed with zero or more indexed placeholders, called format items, that correspond to values in the parameter list of this method. The formatting process replaces each format item with the string representation of the corresponding value.

The syntax of a format item is as follows:

{index[,length][:formatString]}

Elements in square brackets are optional. The following table describes each element.

Element | Description
index | The zero-based position in the parameter list of the object to be formatted. If the object specified by index is Nothing, the format item is replaced by an empty string. If there is no parameter in the index position, a FormatException is thrown.
,length | The minimum number of characters in the string representation of the parameter. If positive, the parameter is right-aligned; if negative, it is left-aligned.
:formatString | A standard or custom format string that is supported by the parameter.

Args represents the objects to be formatted. Each format item in Format is replaced with the string representation of the corresponding object in args. If the format item includes formatString and the corresponding object in Args implements the IFormattable interface, then Args(index).ToString(formatString, provider) defines the formatting. Otherwise, Object.ToString(Args(index)) defines the formatting.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: AppendFormatArrayEx

AppendFormatArrayEx

Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a corresponding argument in a parameter array using a specified format provider.

 Public Function AppendFormatArrayEx(
      ByVal Provider As IFormatProvider,
      ByRef Format As String,
      ByRef Args ( ) As Variant ) As StringBuilder

Parameters

Provider
[ByVal] IFormatProvider. An object that supplies culture-specific formatting information.
Format
[ByRef] String. A composite format string (see Remarks).
Args
[ByRef] Variant. An array of values to format.

Return Values

StringBuilder - A reference to this instance after the append operation has completed. After the append operation, this instance contains any data that existed before the operation, suffixed by a copy of Format where any format specification is replaced by the string representation of the corresponding object argument.

Remarks

This method uses the composite formatting feature of VBCorLib to convert the value of an object to its text representation and embed that representation in the current StringBuilder object.

The Format parameter consists of zero or more runs of text intermixed with zero or more indexed placeholders, called format items, that correspond to values in the parameter list of this method. The formatting process replaces each format item with the string representation of the corresponding value.

The syntax of a format item is as follows:

{index[,length][:formatString]}

Elements in square brackets are optional. The following table describes each element.

Element | Description
index | The zero-based position in the parameter list of the object to be formatted. If the object specified by index is Nothing, the format item is replaced by an empty string. If there is no parameter in the index position, a FormatException is thrown.
,length | The minimum number of characters in the string representation of the parameter. If positive, the parameter is right-aligned; if negative, it is left-aligned.
:formatString | A standard or custom format string that is supported by the parameter.

The provider parameter specifies an IFormatProvider implementation that can provide formatting information for the objects in args. provider can be any of the following:

  • A CultureInfo object that provides culture-specific formatting information.
  • A NumberFormatInfo object that provides culture-specific formatting information for numeric values in Args.
  • A DateTimeFormatInfo object that provides culture-specific formatting information for date and time values in Args.
  • A custom IFormatProvider implementation that provides formatting information for one or more of the objects in Args. Typically, such an implementation also implements the ICustomFormatter interface.

If the Provider parameter is Nothing, format provider information is obtained from the current culture.

Args represents the objects to be formatted. Each format item in Format is replaced with the string representation of the corresponding object in args. If the format item includes formatString and the corresponding object in Args implements the IFormattable interface, then Args(index).ToString(formatString, provider) defines the formatting. Otherwise, Object.ToString(Args(index)) defines the formatting.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: AppendFormatEx

AppendFormatEx

Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a single argument.

 Public Function AppendFormatEx(
      ByRef Provider As IFormatProvider,
      ByRef Format As String,
      ParamArray Args ( ) As Variant ) As StringBuilder

Parameters

Provider
[ByRef] IFormatProvider. A custom formatting object that formats the arguments.
Format
[ByRef] String. The composite format string containing formatting information.
Args
[ByRef] Variant. The arguments to be formatted into the string.

Return Values

StringBuilder - This instance of StringBuilder.

Remarks

This method uses the composite formatting feature of VBCorLib to convert the value of an object to its text representation and embed that representation in the current StringBuilder object.

The Format parameter consists of zero or more runs of text intermixed with zero or more indexed placeholders, called format items, that correspond to values in the parameter list of this method. The formatting process replaces each format item with the string representation of the corresponding value.

The syntax of a format item is as follows:

{index[,length][:formatString]}

Elements in square brackets are optional. The following table describes each element.

Element | Description
index | The zero-based position in the parameter list of the object to be formatted. If the object specified by index is Nothing, the format item is replaced by an empty string. If there is no parameter in the index position, a FormatException is thrown.
,length | The minimum number of characters in the string representation of the parameter. If positive, the parameter is right-aligned; if negative, it is left-aligned.
:formatString | A standard or custom format string that is supported by the parameter.

The provider parameter specifies an IFormatProvider implementation that can provide formatting information for the objects in args. provider can be any of the following:

  • A CultureInfo object that provides culture-specific formatting information.
  • A NumberFormatInfo object that provides culture-specific formatting information for numeric values in Args.
  • A DateTimeFormatInfo object that provides culture-specific formatting information for date and time values in Args.
  • A custom IFormatProvider implementation that provides formatting information for one or more of the objects in Args. Typically, such an implementation also implements the ICustomFormatter interface.

If the Provider parameter is Nothing, format provider information is obtained from the current culture.

Args represents the objects to be formatted. Each format item in Format is replaced with the string representation of the corresponding object in args. If the format item includes formatString and the corresponding object in Args implements the IFormattable interface, then Args(index).ToString(formatString, provider) defines the formatting. Otherwise, Object.ToString(Args(index)) defines the formatting.

See Also

Project CorLib Overview

Class StringBuilder Overview

NumberFormatInfo

DateTimeFormatInfo


StringBuilder: AppendLine

AppendLine

Appends the supplied string and a Carriage-Return/Linefeed to the end of the StringBuilder.

 Public Function AppendLine(
      Optional ByRef s As String ) As StringBuilder

Parameters

s
[ByRef] Optional. String. The string to append to the builder, followed by a Carraige-Return/Linefeed.

Return Values

StringBuilder - A reference to this instance of StringBuilder.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: AppendString

AppendString

This function is designed to append strings quickly.

 Public Sub AppendString(
      ByRef s As String )

Parameters

s
[ByRef] String. The string value to be appended.

Remarks

This method appends the entire string to the end of the StringBuilder. There is no instance returned.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: Capacity (get)

Capacity

Returns the buffer size of the string value.

 Public Property Get Capacity ( ) As Long

Return Values

Long - Value indicating the amount of memory allocated in characters.

Remarks

The capacity of the current instance is how much memory is currently allocated for containing the current string representation. It is not the length of the string itself.

Read/Write.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: Capacity (let)

Capacity

Sets the amount of memory allocated in characters.

 Public Property Let Capacity(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The number of characters to allocate.

Remarks

The capacity of the current instance is how much memory is currently allocated for containing the current string representation. It is not the length of the string itself.

Read/Write.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: Chars (get)

Chars

Returns a character from the string value.

 Public Property Get Chars(
      ByVal Index As Long ) As Integer

Parameters

Index
[ByVal] Long. The index from the string value to return the character.

Return Values

Integer - The character in the string at the specified index.

Remarks

Index is zero-base.

Read/Write.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: Chars (let)

Chars

Sets a character in the string value.

 Public Property Let Chars(
      ByVal Index As Long,
      ByVal Char As Integer )

Parameters

Index
[ByVal] Long. The index into the string value to set the character.
Char
[ByVal] Integer. The character to set.

Remarks

Index is zero-based.

Setting a character can only replace an existing character. A character cannot be appended using this method. To append a character use StringBuilder.AppendChar.

Read/Write.

See Also

Project CorLib Overview

Class StringBuilder Overview

AppendChar


StringBuilder: Clear

Clear

Removes all characters from the current StringBuilder instance.

 Public Function Clear ( ) As StringBuilder

Return Values

StringBuilder - An object whose Length is 0 (zero).

Remarks

Clear is a convenience method that is equivalent to setting the Length property of the current instance to 0 (zero).

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: CopyTo

CopyTo

Copies a set of characters from the StringBuilder into a character array.

 Public Sub CopyTo(
      ByVal SourceIndex As Long,
      ByRef Destination ( ) As Integer,
      ByVal DestinationIndex As Long,
      ByVal Count As Long )

Parameters

SourceIndex
[ByVal] Long. The starting index in the StringBuilder to be copying from (0-based).
Destination
[ByRef] Integer. The character array to copy to.
DestinationIndex
[ByVal] Long. The start index to begin placing characters in to.
Count
[ByVal] Long. The number of characters to copy.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: EnsureCapacity

EnsureCapacity

Ensures that the internal buffer has atleast the requested amount.

 Public Function EnsureCapacity(
      ByVal RequiredCapacity As Long ) As Long

Parameters

RequiredCapacity
[ByVal] Long. The minimum amount of characters to be allocated.

Return Values

Long - The capacity after the call is complete.

Remarks

When RequiredCapacity is larger than the current capacity, The new capacity is calculated as double the current capacity. If the new capacity is still smaller than RequiredCapacity, RequiredCapacity becomes the new capacity.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to test equality on.

Return Values

Boolean - Boolean indicating equality.

Remarks

This implementation simply delegates to Object.Equals.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: FillCharacter (get)

FillCharacter

Returns the fill character used to pad empty space.

 Public Property Get FillCharacter ( ) As Variant

Return Values

Variant - An Integer representing the AscW of the character.

Remarks

The return type is a Variant with a sub-type Integer.

Read/Write.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: FillCharacter (let)

FillCharacter

Sets the fill character used to pad empty space.

 Public Property Let FillCharacter(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. The character used to as padding of empty space.

Remarks

The property accepts String, Long, Integer, and Byte datatypes.

The datatypes are converted using the following methods:

Datatype | Method
String | AscW(Value)
Long,Integer,Byte | AscW(ChrW$(Value))

Read/Write.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

Remarks

This implementation simply delegates to Object.GetHashCode.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: Insert

Insert

Inserts a string into the current string value.

 Public Function Insert(
      ByVal Index As Long,
      ByRef Value As Variant,
      Optional ByVal Count As Long = 1 ) As StringBuilder

Parameters

Index
[ByVal] Long. The index in the string value to start inserting the new string.
Value
[ByRef] Variant. The string to be inserted.
Count
[ByVal] Optional. Long. The number of times to insert the string.

Default: 1

Return Values

StringBuilder - This instance of StringBuilder

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: InsertChars

InsertChars

Inserts an array of characters into the string value.

 Public Function InsertChars(
      ByVal Index As Long,
      ByRef Chars ( ) As Integer,
      Optional ByRef StartIndex As Variant,
      Optional ByRef CharCount As Variant ) As StringBuilder

Parameters

Index
[ByVal] Long. The index in the string value to start inserting.
Chars
[ByRef] Integer. The characters to be inserted.
StartIndex
[ByRef] Optional. Variant. The index in the Characters to start inserting from.
CharCount
[ByRef] Optional. Variant. The number of characters to be inserted.

Return Values

StringBuilder - This instance of StringBuilder.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: Length (get)

Length

Returns the length of the current string value.

 Public Property Get Length ( ) As Long

Return Values

Long - The length of the string value.

Read/Write.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: Length (let)

Length

Sets the length of the current string value.

 Public Property Let Length(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The length of the string value.

Remarks

If the new value is longer than the current length, then the new space is padded with FillCharacter (default 32).

Read/Write.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: Remove

Remove

Removes a number of characters from the string value.

 Public Function Remove(
      ByVal StartIndex As Long,
      ByVal Length As Long ) As StringBuilder

Parameters

StartIndex
[ByVal] Long. The index in the string value to start removing from.
Length
[ByVal] Long. The number of characters to remove from the string value.

Return Values

StringBuilder - This instance of StringBuilder.

Remarks

StartIndex is zero-based.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: Replace

Replace

Replaces a substring in the string value with a new string.

 Public Function Replace(
      ByRef OldValue As String,
      ByRef NewValue As String,
      Optional ByRef StartIndex As Variant,
      Optional ByRef Count As Variant ) As StringBuilder

Parameters

OldValue
[ByRef] String. The substring to be replaced.
NewValue
[ByRef] String. The string to replace the old string with.
StartIndex
[ByRef] Optional. Variant. The index of the start of the substring in the StringBuilder object.
Count
[ByRef] Optional. Variant. The number of characters in the StringBuilder object substring.

Return Values

StringBuilder - This instance of StringBuilder.

Remarks

Use StartIndex and Count to replace the old value with a substring of the new value. StartIndex is zero-based.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringBuilder: ToString

ToString

Returns the current version of the string value.

 Public Function ToString(
      Optional ByRef StartIndex As Variant,
      Optional ByRef Length As Variant ) As String

Parameters

StartIndex
[ByRef] Optional. Variant. The index to start the return substring from.
Length
[ByRef] Optional. Variant. The number of characters to return in the string.

Return Values

String - A string or substring representing the internal string of StringBuilder.

Remarks

StartIndex is zero-based.

See Also

Project CorLib Overview

Class StringBuilder Overview


StringComparer

StringComparer

Represents string comparison operations based on a specific case and culture-based or ordinal comparison rules.

Public:

Methods:

Name | Description
Compare | Compares two values relative to each other in an ordered set.
Equals | Compares two values for equality.
GetHashCode | Returns a partially unique numeric representation of the value.

Remarks

Implement this interface when a specific string comparison rule is necessary. The implementation should still allow the default processing of other value types other than string.

See Also

Project CorLib Overview

Class StringComparer Overview

StringComparerStatic


StringComparer: Compare

Compare

Compares two values relative to each other in an ordered set.

 Public Function Compare(
      ByRef x As Variant,
      ByRef y As Variant ) As Long

Parameters

x
[ByRef] Variant. A value used in the comparison.
y
[ByRef] Variant. A value used in the comparison.

Return Values

Long - Returns a numeric value indicating the relative order of the x parameter in relation to the y parameter.

Remarks

If the x and y parameter values are considered equal then zero should be returned. If the x parameter is considered less than the y parameter in relative order then a negative value should be returned. Otherwise, the x parameter is considered greater than the y parameter and should return a positive value. There is no specific positive or negative value that is defined as the expected value, only the sign of the value is regarded.

The example is the implementation used by the StringComparer.Ordinal and StringComparer.OrdinalIgnoreCase implementation.

    Private Function StringComparer_Compare(x As Variant, y As Variant) As Long
        If VarType(x) = vbString Then
            If VarType(y) = vbString Then
                StringComparer_Compare = CorString.Compare(x, y, mComparisonType)
                Exit Function
            End If
        End If

        StringComparer_Compare = Comparer.Default.Compare(x, y)
    End Function

See Also

Project CorLib Overview

Class StringComparer Overview


StringComparer: Equals

Equals

Compares two values for equality.

 Public Function Equals(
      ByRef x As Variant,
      ByRef y As Variant ) As Boolean

Parameters

x
[ByRef] Variant. A value to be compared for equality.
y
[ByRef] Variant. A value to be compared for equality.

Return Values

Boolean - Returns true if x and y are equal; otherwise false.

Remarks

When implementing this method, any custom logic should be applied to only type String. All other value types should be passed to the default comparer for consistent behavior.

The example is the implementation used by the StringComparer.Ordinal and StringComparer.OrdinalIgnoreCase implementation.

    Private mStringComparison As StringComparison

    Private Function StringComparer_Equals(x As Variant, y As Variant) As Boolean
        If VarType(x) = vbString Then
            If VarType(y) = vbString Then
                StringComparer_Equals = CorString.Equals(x, y, mStringComparison)
                Exit Function
            End If
        End If

        StringComparer_Equals = Object.Equals(x, y)
    End Function

See Also

Project CorLib Overview

Class StringComparer Overview


StringComparer: GetHashCode

GetHashCode

Returns a partially unique numeric representation of the value.

 Public Function GetHashCode(
      ByRef Obj As Variant ) As Long

Parameters

Obj
[ByRef] Variant. The value to generate a hash code for.

Return Values

Long - A partially unique number representing the value.

Remarks

Two values could generate the same hash code, but still not be equal. If two values generate the same hash code then additional comparisons should be done to check for equality.

The example is the implementation used by the StringComparer.Ordinal and StringComparer.OrdinalIgnoreCase implementation.

    Private Function StringComparer_GetHashCode(Obj As Variant) As Long
        If VarType(Obj) = vbString Then
            If mStringComparison = OrdinalIgnoreCase Then
                StringComparer_GetHashCode = Object.GetHashCode(UCase$(Obj))
                Exit Function
            End If
        End If

        StringComparer_GetHashCode = Object.GetHashCode(Obj)
    End Function

See Also

Project CorLib Overview

Class StringComparer Overview


StringComparerStatic

StringComparerStatic

Provides a set of StringComparer objects implementing different string comparison rules.

Public:

Properties:

Name | Description
BinaryCompare (get) | Gets a StringComparer object that provides case-sensitive string comparisons.
CurrentCulture (get) | Gets a StringComparer object that performs a case-sensitive string comparison using the word comparison rules of the current culture.
CurrentCultureIgnoreCase (get) | Gets a StringComparer object that performs a case-insensitive string comparison using the word comparison rules of the current culture.
InvariantCulture (get) | Gets a StringComparer object that performs a case-sensitive string comparison using the word comparison rules of the invariant culture.
InvariantCultureIgnoreCase (get) | Gets a StringComparer object that performs a case-insensitive string comparison using the word comparison rules of the invariant culture.
Ordinal (get) | Gets a StringComparer object that provides case-sensitive string comparisons.
OrdinalIgnoreCase (get) | Gets a StringComparer object that provides case-insensitive string comparisons.
TextCompare (get) | Gets a StringComparer object that provides case-insensitive string comparisons.

Methods:

Name | Description
Create | Creates a StringComparer object that compares strings according to the rules of a specified culture.

See Also

Project CorLib Overview

Class StringComparerStatic Overview

StringComparer


StringComparerStatic: BinaryCompare (get)

BinaryCompare

Gets a StringComparer object that provides case-sensitive string comparisons.

 Public Property Get BinaryCompare ( ) As StringComparer

Return Values

StringComparer - A StringComparer object that is case-sensitive.

Remarks

The comparison is done using the Visual Basic StrComp function with vbBinaryCompare option.

The StringComparer object can be retrieved using the following code.

   Dim c As StringComparer
   Set c = StringComparer.BinaryCompare

The instance of the StringComparer object returned is a private class and simply implements the StringComparer interface.

Read Only.

See Also

Project CorLib Overview

Class StringComparerStatic Overview


StringComparerStatic: Create

Create

Creates a StringComparer object that compares strings according to the rules of a specified culture.

 Public Function Create(
      ByVal Culture As CultureInfo,
      ByVal IgnoreCase As Boolean ) As StringComparer

Parameters

Culture
[ByVal] CultureInfo. A culture whose linguistic rules are used to perform a string comparison.
IgnoreCase
[ByVal] Boolean. True to specify that comparison operations be case-insensitive; False to specify that comparison operations be case-sensitive.

Return Values

StringComparer - A new StringComparer object that performs string comparisons according to the comparison rules used by the culture parameter and the case rule specified by the IgnoreCase parameter.

Exceptions

Exception | Condition
ArgumentNullException | Culture is Nothing.

See Also

Project CorLib Overview

Class StringComparerStatic Overview


StringComparerStatic: CurrentCulture (get)

CurrentCulture

Gets a StringComparer object that performs a case-sensitive string comparison using the word comparison rules of the current culture.

 Public Property Get CurrentCulture ( ) As StringComparer

Return Values

StringComparer - A new StringComparer object.

Remarks

The StringComparer returned by the CurrentCulture property can be used when strings are linguistically relevant. For example, if strings are displayed to the user, or if strings are the result of user interaction, culture-sensitive string comparison should be used to order the string data.

The current culture is the CultureInfo object associated with the current thread.

The StringComparer can be accessed using the following code.

Set c = StringComparer.CurrentCulture

Each call to the CurrentCulture property get accessor returns a new StringComparer object.

Read Only.

See Also

Project CorLib Overview

Class StringComparerStatic Overview


StringComparerStatic: CurrentCultureIgnoreCase (get)

CurrentCultureIgnoreCase

Gets a StringComparer object that performs a case-insensitive string comparison using the word comparison rules of the current culture.

 Public Property Get CurrentCultureIgnoreCase ( ) As StringComparer

Return Values

StringComparer - A new StringComparer object.

Remarks

The current culture is the CultureInfo object associated with the current thread.

The StringComparer returned by the CurrentCultureIgnoreCase property can be used when strings are linguistically relevant but their case is not. For example, if strings are displayed to the user but case is unimportant, culture-sensitive, case-insensitive string comparison should be used to order the string data.

Set c = StringComparer.CurrentCultureIgnoreCase

Each call to the CurrentCultureIgnoreCase property get accessor returns a new StringComparer object.

Read Only.

See Also

Project CorLib Overview

Class StringComparerStatic Overview


StringComparerStatic: InvariantCulture (get)

InvariantCulture

Gets a StringComparer object that performs a case-sensitive string comparison using the word comparison rules of the invariant culture.

 Public Property Get InvariantCulture ( ) As StringComparer

Return Values

StringComparer - A new StringComparer object.

Remarks

The StringComparer returned by the InvariantCulture property compares strings in a linguistically relevant manner, but it is not suitable for display in any particular culture. Its major application is to order strings in a way that will be identical across cultures.

The invariant culture is the CultureInfo object returned by the CultureInfo.InvariantCulture property.

The StringComparer can be accessed using the following code.

Set c = StringComparer.InvariantCulture

Read Only.

See Also

Project CorLib Overview

Class StringComparerStatic Overview


StringComparerStatic: InvariantCultureIgnoreCase (get)

InvariantCultureIgnoreCase

Gets a StringComparer object that performs a case-insensitive string comparison using the word comparison rules of the invariant culture.

 Public Property Get InvariantCultureIgnoreCase ( ) As StringComparer

Return Values

StringComparer - A new StringComparer object.

Remarks

The StringComparer returned by the InvariantCultureIgnoreCase property compares strings in a linguistically relevant manner that ignores case, but it is not suitable for display in any particular culture. Its major application is to order strings in a way that will be identical across cultures.

The invariant culture is the CultureInfo object returned by the CultureInfo.InvariantCulture property.

The StringComparer can be accessed using the following code.

Set c = StringComparer.InvariantCultureIgnoreCase

Read Only.

See Also

Project CorLib Overview

Class StringComparerStatic Overview


StringComparerStatic: Ordinal (get)

Ordinal

Gets a StringComparer object that provides case-sensitive string comparisons.

 Public Property Get Ordinal ( ) As StringComparer

Return Values

StringComparer - A StringComparer object that is case-sensitive.

Remarks

The comparison is done in a similar fashion as using the standard equality check of two VisualBasic strings in a variant culture manner.

The StringComparer object can be retrieved using the following code.

   Dim c As StringComparer
   Set c = StringComparer.Ordinal

The instance of the StringComparer object returned is a private class and simply implements the StringComparer interface.

Read Only.

See Also

Project CorLib Overview

Class StringComparerStatic Overview


StringComparerStatic: OrdinalIgnoreCase (get)

OrdinalIgnoreCase

Gets a StringComparer object that provides case-insensitive string comparisons.

 Public Property Get OrdinalIgnoreCase ( ) As StringComparer

Return Values

StringComparer - A StringComparer that is case-insensitive.

Remarks

The comparison is done like using the StrComp function to check two VisualBasic strings in a variant culture manner.

The StringComparer object can be retrieved using the following code.

   Dim c As StringComparer
   Set c = StringComparer.OrdinalIgnoreCase

The instance of the StringComparer object returned is a private class and simply implements the StringComparer interface.

Read Only.

See Also

Project CorLib Overview

Class StringComparerStatic Overview


StringComparerStatic: TextCompare (get)

TextCompare

Gets a StringComparer object that provides case-insensitive string comparisons.

 Public Property Get TextCompare ( ) As StringComparer

Return Values

StringComparer - A StringComparer object that is case-insensitive.

Remarks

The comparison is done using the Visual Basic StrComp function with vbTextCompare option.

The StringComparer object can be retrieved using the following code.

   Dim c As StringComparer
   Set c = StringComparer.TextCompare

The instance of the StringComparer object returned is a private class and simply implements the StringComparer interface.

Read Only.

See Also

Project CorLib Overview

Class StringComparerStatic Overview


StringReader

StringReader

Provides methods to read portions of a string.

Implements:

IObject
TextReader

Public:

Methods:

Name | Description
CloseReader | Closes the reader
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
Peek | Returns the next character in the string without consuming that character. The character is still the next to be read.
Read | Returns the next character in the string, moving the current position to the next character.
ReadBlock | Fills an array with a block of characters from the string.
ReadLine | Reads a line terminated by a CarriageReturn or LineFeed from the string.
ReadToEnd | Returns from the current position in the string to the end.
ToString | Returns a string representation of this object instance.

See Also

Project CorLib Overview

Class StringReader Overview

Constructors

TextReader


StringReader: CloseReader

CloseReader

Closes the reader

 Public Sub CloseReader ( )

See Also

Project CorLib Overview

Class StringReader Overview


StringReader: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class StringReader Overview


StringReader: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class StringReader Overview


StringReader: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class StringReader Overview


StringReader: Peek

Peek

Returns the next character in the string without consuming that character. The character is still the next to be read.

 Public Function Peek ( ) As Long

Return Values

Long - The character Unicode value, or -1 if the end of the string was reached.

Remarks

For characters from &H8000 and above, the value will be positive still, even though the underlying Integer is negative. This is to allow for a -1 to be returned without being confused with an actual character in the string.

See Also

Project CorLib Overview

Class StringReader Overview


StringReader: Read

Read

Returns the next character in the string, moving the current position to the next character.

 Public Function Read ( ) As Long

Return Values

Long - For characters from &H8000 and above, the value will be positive still, even though the underlying Integer is negative. This is to allow for a -1 to be returned without being confused with an actual character in the string.

See Also

Project CorLib Overview

Class StringReader Overview


StringReader: ReadBlock

ReadBlock

Fills an array with a block of characters from the string.

 Public Function ReadBlock(
      ByRef Buffer ( ) As Integer,
      ByVal Index As Long,
      ByVal Count As Long ) As Long

Parameters

Buffer
[ByRef] Integer. The array to receive the characters read from the string.
Index
[ByVal] Long. The starting index in Chars to begin writing.
Count
[ByVal] Long. The maximum number of characters to be read from the string.

Return Values

Long - The actual number of characters read from the string.

Remarks

If not enough characters exist to fill Count characters, then fewer characters will be returned than Count.

See Also

Project CorLib Overview

Class StringReader Overview


StringReader: ReadLine

ReadLine

Reads a line terminated by a CarriageReturn or LineFeed from the string.

 Public Function ReadLine ( ) As String

Return Values

String - A line from the string or a null string.

Remarks

The returned line does not contain the termination character. If the character is a CarriageReturn followed immediately by a LineFeed, then the LineFeed character is also consumed.

If there are no more characters to be read, then vbNullString is returned.

See Also

Project CorLib Overview

Class StringReader Overview


StringReader: ReadToEnd

ReadToEnd

Returns from the current position in the string to the end.

 Public Function ReadToEnd ( ) As String

Return Values

String - If there are no more characters to be read, then vbNullString is returned.

See Also

Project CorLib Overview

Class StringReader Overview


StringReader: TextReader

TextReader

 Implements TextReader

Return Values

TextReader -

See Also

Project CorLib Overview

Class StringReader Overview


StringReader: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class StringReader Overview


StringResourceDecoder

StringResourceDecoder

Decodes a resource String table containing up to 16 strings.

Implements:

IResourceDecoder

Public:

Methods:

Name | Description
Decode | Decodes an array of bytes into a string table containing up to 16 strings.
GetDecodeType | Returns the type of resource that can be decoded with this decoder.
GetResource | Returns the next available resource in the decoder.

See Also

Project CorLib Overview

Class StringResourceDecoder Overview

IResourceDecoder


StringResourceDecoder: Decode

Decode

Decodes an array of bytes into a string table containing up to 16 strings.

 Public Function Decode(
      ByVal Key As ResourceKey,
      ByRef Bytes ( ) As Byte ) As Long

Parameters

Key
[ByVal] ResourceKey. The resource identifier for the specific string table.
Bytes
[ByRef] Byte. The byte data that is decoded to a string table.

Return Values

Long - The number of strings decoded from the byte array.

Remarks

Up to 16 strings can be decoded from a resource string table.

See Also

Project CorLib Overview

Class StringResourceDecoder Overview

ResourceKey


StringResourceDecoder: GetDecodeType

GetDecodeType

Returns the type of resource that can be decoded with this decoder.

 Public Function GetDecodeType ( ) As Variant

Return Values

Variant - The type of resource that can be decoded.

See Also

Project CorLib Overview

Class StringResourceDecoder Overview

ResourceTypes


StringResourceDecoder: GetResource

GetResource

Returns the next available resource in the decoder.

 Public Function GetResource(
      ByRef ReturnKey As ResourceKey,
      ByRef ReturnValue As Variant ) As Boolean

Parameters

ReturnKey
[ByRef] ResourceKey. This is set to the key that identifies the resource being returned.
ReturnValue
[ByRef] Variant. This is set to the resource value being returned.

Return Values

Boolean - If a resource has been returned, this returns True, otherwise False is returned.

Remarks

Once a resource has been returned, that resource is never returned again.

See Also

Project CorLib Overview

Class StringResourceDecoder Overview

ResourceKey


StringResourceDecoder: IResourceDecoder

IResourceDecoder

 Implements IResourceDecoder

Return Values

IResourceDecoder -

See Also

Project CorLib Overview

Class StringResourceDecoder Overview


StringResourceEncoder

StringResourceEncoder

Encodes strings into string tables.

Implements:

IResourceEncoder

Public:

Methods:

Name | Description
Encode | Encodes a string into a string table.
GetEncodedResource | Returns the next resource entry byte array.
Reset | Releases all currently encoded values.

Remarks

In a .RES file strings are stored into tables of up to 16 strings per table. Each table is uniquely identified based on the range of string IDs.

See Also

Project CorLib Overview

Class StringResourceEncoder Overview


StringResourceEncoder: Encode

Encode

Encodes a string into a string table.

 Public Function Encode(
      ByRef Value As Variant,
      ByRef ResourceName As Variant,
      Optional ByRef ResourceType As Variant,
      Optional ByRef LanguageID As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The string to be encoded.
ResourceName
[ByRef] Variant. The name of the string. This must be a numeric value.
ResourceType
[ByRef] Optional. Variant. The type of resource to be encoded.
LanguageID
[ByRef] Optional. Variant. The Locale ID this resource is associated with.

Return Values

Boolean - Returns True if the encoder was able to encode the value, False otherwise.

Remarks

Any value can be passed in. No exception is thrown. If the value is not a string then the function returns False.

The ResourceName should be a numeric value.

The LanguageID can be a CultureInfo object, a culture name, or an LCID. If the LanguageID is not supplied, then the current culture is used.

See Also

Project CorLib Overview

Class StringResourceEncoder Overview


StringResourceEncoder: GetEncodedResource

GetEncodedResource

Returns the next resource entry byte array.

 Public Function GetEncodedResource(
      ByRef ReturnKey As ResourceKey,
      ByRef ReturnValue ( ) As Byte ) As Boolean

Parameters

ReturnKey
[ByRef] ResourceKey. Our own key for the resource entry.
ReturnValue
[ByRef] Byte. The next byte array of a ResStringResource.

Return Values

Boolean - If we have returned something, Return True, otherwise return False.

Remarks

Each resource can contain up to 16 of the strings previously encoded.

See Also

Project CorLib Overview

Class StringResourceEncoder Overview


StringResourceEncoder: IResourceEncoder

IResourceEncoder

 Implements IResourceEncoder

Return Values

IResourceEncoder -

See Also

Project CorLib Overview

Class StringResourceEncoder Overview


StringResourceEncoder: Reset

Reset

Releases all currently encoded values.

 Public Sub Reset ( )

See Also

Project CorLib Overview

Class StringResourceEncoder Overview


StringWriter

StringWriter

Provides a set of functions for writing to a string.

Implements:

IObject
TextWriter

Public:

Properties:

Name | Description
Encoding (get) | Returns the encoding in which the output is written.
FormatProvider (get) | Returns the format provider the writer uses for formatting values.
NewLine (get) | Returns the string currently used to represent a new-line set of characters.
NewLine (let) | Sets the string to be used as the new-line set of characters.

Methods:

Name | Description
CloseWriter | Closes the writer
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
Flush | Writes any buffered data to the underlying string.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetStringBuilder | Returns the underlying stringbuilder being used to write to the string.
ToString | Returns a string representation of this object instance.
WriteChars | Writes the string representation of the characters to the stream using both the format provider and encoding objects.
WriteLine | Writes a text representation of the value followed by a NewLine to the underlying stream using both the format provider and encoding objects.
WriteLineChars | Writes the string representation of the characters followed by a NewLine to the stream using both the format provider and encoding objects.
WriteValue | Writes a text representation of the value to the underlying stream using both the format provider and encoding objects.

See Also

Project CorLib Overview

Class StringWriter Overview

Constructors

TextWriter


StringWriter: CloseWriter

CloseWriter

Closes the writer

 Public Sub CloseWriter ( )

See Also

Project CorLib Overview

Class StringWriter Overview


StringWriter: Encoding (get)

Encoding

Returns the encoding in which the output is written.

 Public Property Get Encoding ( ) As Encoding

Return Values

Encoding - The encoding of the output string.

Read Only.

See Also

Project CorLib Overview

Class StringWriter Overview


StringWriter: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class StringWriter Overview


StringWriter: Flush

Flush

Writes any buffered data to the underlying string.

 Public Sub Flush ( )

Remarks

Since the data is directly written to the underlying string, this function does nothing. It is here to maintain interface consistency.

See Also

Project CorLib Overview

Class StringWriter Overview


StringWriter: FormatProvider (get)

FormatProvider

Returns the format provider the writer uses for formatting values.

 Public Property Get FormatProvider ( ) As IFormatProvider

Return Values

IFormatProvider - The format provider used by the writer.

Remarks

The format provider used is the returned by the current culture.

Read Only.

See Also

Project CorLib Overview

Class StringWriter Overview


StringWriter: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class StringWriter Overview


StringWriter: GetStringBuilder

GetStringBuilder

Returns the underlying stringbuilder being used to write to the string.

 Public Function GetStringBuilder ( ) As StringBuilder

Return Values

StringBuilder - The StringBuilder being used to write to the string.

See Also

Project CorLib Overview

Class StringWriter Overview


StringWriter: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class StringWriter Overview


StringWriter: NewLine (get)

NewLine

Returns the string currently used to represent a new-line set of characters.

 Public Property Get NewLine ( ) As String

Return Values

String - The new-line set of characters.

Remarks

The default is CarriageReturn-LineFeed.

Read/Write.

See Also

Project CorLib Overview

Class StringWriter Overview


StringWriter: NewLine (let)

NewLine

Sets the string to be used as the new-line set of characters.

 Public Property Let NewLine(
      ByRef Value As String )

Parameters

Value
[ByRef] String. The new-line set of characters.

Remarks

The default is CarriageReturn-LineFeed.

Read/Write.

See Also

Project CorLib Overview

Class StringWriter Overview


StringWriter: TextWriter

TextWriter

 Implements TextWriter

Return Values

TextWriter -

See Also

Project CorLib Overview

Class StringWriter Overview


StringWriter: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class StringWriter Overview


StringWriter: WriteChars

WriteChars

Writes the string representation of the characters to the stream using both the format provider and encoding objects.

 Public Sub WriteChars(
      ByRef Chars ( ) As Integer,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant )

Parameters

Chars
[ByRef] Integer. The characters to be written.
Index
[ByRef] Optional. Variant. The beginning index within the Chars array to begin writing to the stream.
Count
[ByRef] Optional. Variant. The number of characters to write to the stream.

Remarks

This method uses the composite formatting feature to convert the value to its text representation and embed it in a string.

See Also

Project CorLib Overview

Class StringWriter Overview


StringWriter: WriteLine

WriteLine

Writes a text representation of the value followed by a NewLine to the underlying stream using both the format provider and encoding objects.

 Public Sub WriteLine(
      ParamArray Values ( ) As Variant )

Parameters

Values
[ByRef] Variant. An array of args containing a value or composite formatting string and a list of args to be formatted.

Remarks

This method uses the composite formatting feature to convert the value to its text representation and embed it in a string.

See Also

Project CorLib Overview

Class StringWriter Overview


StringWriter: WriteLineChars

WriteLineChars

Writes the string representation of the characters followed by a NewLine to the stream using both the format provider and encoding objects.

 Public Sub WriteLineChars(
      ByRef Chars ( ) As Integer,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant )

Parameters

Chars
[ByRef] Integer. The characters to be written.
Index
[ByRef] Optional. Variant. The beginning index within the Chars array to begin writing to the stream.
Count
[ByRef] Optional. Variant. The number of characters to write to the stream.

Remarks

Both Index and Count must be excluded or included. Neither argument can be supplied individually.

See Also

Project CorLib Overview

Class StringWriter Overview


StringWriter: WriteValue

WriteValue

Writes a text representation of the value to the underlying stream using both the format provider and encoding objects.

 Public Sub WriteValue(
      ByRef Value As Variant,
      ParamArray Args ( ) As Variant )

Parameters

Value
[ByRef] Variant. The value to be written to the stream.
Args
[ByRef] Variant. An array of zero or more values to be formatted and written.

Remarks

This method uses the composite formatting feature to convert the value to its text representation and embed it in a string.

See Also

Project CorLib Overview

Class StringWriter Overview


SymmetricAlgorithm

SymmetricAlgorithm

Provides a standard interface for utilizing symmetric algorithms.

Public:

Types:

Name | Description
CipherMode | A defined set of cipher modes the algorithms can use.
PaddingMode | A defined set of padding modes used to fill the end of non-blocksize length data blocks. For example if an algorithm has a blocksize of 8 bytes and the data is 3 bytes in length, then 5 bytes of padding must be applied.

Properties:

Name | Description
BlockSize (get) | Gets the block size, in bits, used by the cryptographic operation.
BlockSize (let) | Sets the block size, in bits, used by the cryptographic operation.
FeedbackSize (get) | Gets the feedback size, in bits, used by the cryptographic operation.
FeedbackSize (let) | Sets the feedback size, in bits, used by the cryptographic operation.
IV (get) | Gets the initialization vector (IV) for the symmetric algorithm.
IV (let) | Sets the initialization vector (IV) for the symmetric algorithm.
Key (get) | Gets the secret key for the symmetric algorithm.
Key (let) | Gets the secret key for the symmetric algorithm.
KeySize (get) | Gets the size of the key, in bits, used by the symmetric algorithm.
KeySize (let) | Gets the size of the key, in bits, used by the symmetric algorithm.
LegalBlockSizes (get) | Gets the block sizes, in bits, that are supported by the symmetric algorithm.
LegalKeySizes (get) | Gets the key sizes, in bits, that are supported by the symmetric algorithm.
Mode (get) | Gets the mode for operation of the symmetric algorithm.
Mode (let) | Sets the mode for operation of the symmetric algorithm.
Padding (get) | Gets the padding mode used in the symmetric algorithm.
Padding (let) | Gets the padding mode used in the symmetric algorithm.

Methods:

Name | Description
Clear | Releases all resources used by the SymmetricAlgorithm class.
CreateDecryptor | When implemented by a class, creates a symmetric decryptor object with the specified Key property and initialization vector (IV).
CreateEncryptor | When implemented by a class, creates a symmetric encryptor object with the specified Key property and initialization vector (IV).
Equals | Returns if this instance and the value are equal.
GenerateIV | When implemented by a class, generates a random initialization vector (IV) to use for the algorithm.
GenerateKey | When implemented ba a class, generates a random key (Key) to use for the algorithm.
GetHashCode | Returns a semi-unique value that represents this instance.
ToString | Returns a string representation of this instance.
ValidKeySize | Determines whether the specified key size is valid for the current algorithm.

Remarks

A symmetric algorithm is one that uses the same Key and Initialization Vector to both encrypt and decrypt data.

For one of the symmetric algorithms to work, a Key and Initialization Vector needs to be supplied to the Crypto Service Provider.

RijndaelManaged, DESCryptoServiceProvider, RC2CryptoServiceProvider, and TripleDESCryptoServiceProvider are implementations of symmetric algorithms.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview

SymmetricAlgorithmBase


SymmetricAlgorithm: BlockSize (get)

BlockSize

Gets the block size, in bits, used by the cryptographic operation.

 Public Property Get BlockSize ( ) As Long

Return Values

Long - The block size in bits.

Remarks

The block size is the basic unit of data that can be encrypted or decrypted in one operation. Messages longer than the block size are handled as successive blocks; messages shorter than the block size must be padded with extra bits to reach the size of a block. Valid block sizes are determined by the symmetric algorithm used.

A list of valid block sizes can be obtained through the LegalBlockSizes property.

Read/Write.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview

LegalBlockSizes


SymmetricAlgorithm: BlockSize (let)

BlockSize

Sets the block size, in bits, used by the cryptographic operation.

 Public Property Let BlockSize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The block size in bits.

Remarks

The block size is the basic unit of data that can be encrypted or decrypted in one operation. Messages longer than the block size are handled as successive blocks; messages shorter than the block size must be padded with extra bits to reach the size of a block. Valid block sizes are determined by the symmetric algorithm used.

A list of valid block sizes can be obtained through the LegalBlockSizes property.

Read/Write.

Exceptions

Exception | Condition
CryptographicException | The block size is invalid.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview

LegalBlockSizes


SymmetricAlgorithm: CipherMode

CipherMode

A defined set of cipher modes the algorithms can use.

 Public Enum CipherMode

Values

CBC = 1
The Cipher Block Chaining (CBC) uses a feedback mechanism by Exclusive ORing the previously encrypted block of data with the current block being processed. This is to prevent two identical blocks from encrypting into the same to encrypted blocks of data, making it more difficult to break the encryption. An Initialization Vector array is also used by Exclusive ORing the vector with the current block before encryption.
ECB = 2
The Electronic Codebook (ECB) processes blocks individually and does not alter identical blocks of data. If two or more blocks of data are the same then their encrypted blocks will also be the same. A message with several identical blocks could become easier to decrypt.
OFB = 3
The Output Feedback (OFB) method processes small increments of blocks into ciphered text instead of the entire block at one time. This works similar to the Cipher Feedback method, except if a ciphered bit is corrupted, then all plain text data following the bit will be corrupted.
CFB = 4
The Cipher Feedback (CFB) method processes small increments of plain text into ciphered text instead of the entire block at one time. The method uses a shift register that is one block in length. If one bit of ciphered data is corrupted, then the corrisponding plain text bit is also corrupted until the corrupted bit is finally shifted out of the register.
CTS = 5
The Cipher Text Stealing (CTS) mode handles any length of plain text and produces cipher text whose length matches the plain text length. This mode behaves like the CBC mode for all but the last two blocks of the plain text.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: Clear

Clear

Releases all resources used by the SymmetricAlgorithm class.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: CreateDecryptor

CreateDecryptor

When implemented by a class, creates a symmetric decryptor object with the specified Key property and initialization vector (IV).

 Public Function CreateDecryptor(
      Optional ByRef RgbKey As Variant,
      Optional ByRef RgbIV As Variant ) As ICryptoTransform

Parameters

RgbKey
[ByRef] Optional. Variant. The secret key to use for the symmetric algorithm.
RgbIV
[ByRef] Optional. Variant. The initialization vector to use for the symmetric algorithm.

Return Values

ICryptoTransform - A symmetric decryptor object.

Remarks

This method decrypts an encrypted message created using the CreateEncryptor with the same parameters.

Exceptions

Exception | Condition
ArgumentException | Only RgbKey or RgbIV was specified.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview

CreateEncryptor


SymmetricAlgorithm: CreateEncryptor

CreateEncryptor

When implemented by a class, creates a symmetric encryptor object with the specified Key property and initialization vector (IV).

 Public Function CreateEncryptor(
      Optional ByRef RgbKey As Variant,
      Optional ByRef RgbIV As Variant ) As ICryptoTransform

Parameters

RgbKey
[ByRef] Optional. Variant. The secret key to use for the symmetric algorithm.
RgbIV
[ByRef] Optional. Variant. The initialization vector to use for the symmetric algorithm.

Return Values

ICryptoTransform - A symmetric encryptor object.

Remarks

Use the CreateDecryptor overload with the same parameters to decrypt the result of this method.

Exceptions

Exception | Condition
ArgumentException | Only RgbKey or RgbIV was specified.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview

CreateDecryptor


SymmetricAlgorithm: Equals

Equals

Returns if this instance and the value are equal.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare for equality.

Return Values

Boolean - Returns if the value and this instance are equal.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: FeedbackSize (get)

FeedbackSize

Gets the feedback size, in bits, used by the cryptographic operation.

 Public Property Get FeedbackSize ( ) As Long

Return Values

Long - The feedback size in bits.

Remarks

The feedback size determines the amount of data that is fed back to successive encryption or decryption operations. The feedback size cannot be greater than the block size.

Read/Write.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: FeedbackSize (let)

FeedbackSize

Sets the feedback size, in bits, used by the cryptographic operation.

 Public Property Let FeedbackSize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The feedback size in bits.

Remarks

The feedback size determines the amount of data that is fed back to successive encryption or decryption operations. The feedback size cannot be greater than the block size.

Read/Write.

Exceptions

Exception | Condition
CryptographicException | The feedback size is larger than the block size.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: GenerateIV

GenerateIV

When implemented by a class, generates a random initialization vector (IV) to use for the algorithm.

 Public Sub GenerateIV ( )

Remarks

In general, there is no reason to use this method, because CreateEncryptor() automatically generates both an initialization vector and a key. However, you may want to use the GenerateIV() method to reuse a symmetric algorithm instance with a different initialization vector.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: GenerateKey

GenerateKey

When implemented ba a class, generates a random key (Key) to use for the algorithm.

 Public Sub GenerateKey ( )

Remarks

In general, there is no reason to use this method, because CreateEncryptor() automatically generates both an initialization vector and a key. However, you may want to use the GenerateKey() method to reuse a symmetric algorithm instance with a different key.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: GetHashCode

GetHashCode

Returns a semi-unique value that represents this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns the semi-unique value.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: IV (get)

IV

Gets the initialization vector (IV) for the symmetric algorithm.

 Public Property Get IV ( ) As Byte ( ) :

Return Values

Byte() - The initialization vector.

Remarks

If several blocks of same plain text are encrypted, the ciphered data could all be the same aswell. Using an Initialization Vector can prevent same plain text blocks to reproduce the same ciphered blocks.

This can be generated using GenerateIV, or a new one will be generated if one hasnt been set when this property is accessed.

This must be set to an array the same size as the block size divided by 8.

Read/Write.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: IV (let)

IV

Sets the initialization vector (IV) for the symmetric algorithm.

 Public Property Let IV(
      ByRef Value ( ) As Byte ) :

Parameters

Value
[ByRef] Byte. The initialization vector.

Remarks

If several blocks of same plain text are encrypted, the ciphered data could all be the same aswell. Using an Initialization Vector can prevent same plain text blocks to reproduce the same ciphered blocks.

This can be generated using the GenerateIV method, or a new one will be generated if one hasnt been set when this property is accessed.

This must be set to an array the same size as the block size divided by 8.

Read/Write.

Exceptions

Exception | Condition
ArgumentNullException | An attempt was made to set the initialization vector to an unitialized array.
CryptographicException | An attempt was made to set the initialization vector to an invalid size.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: Key (get)

Key

Gets the secret key for the symmetric algorithm.

 Public Property Get Key ( ) As Byte ( ) :

Return Values

Byte() - The secret key to use for the symmetric algorithm.

Remarks

The secret key is used both for encryption and for decryption. For a symmetric algorithm to be successful, the secret key must be known only to the sender and the receiver. The valid key sizes are specified by the particular symmetric algorithm implementation and are listed in the LegalKeySizes property.

If a key has not been set, the GenerateKey method will be called to create a new random value.

Read/Write.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: Key (let)

Key

Gets the secret key for the symmetric algorithm.

 Public Property Let Key(
      ByRef Value ( ) As Byte ) :

Parameters

Value
[ByRef] Byte. The secret key to use for the symmetric algorithm.

Remarks

The secret key is used both for encryption and for decryption. For a symmetric algorithm to be successful, the secret key must be known only to the sender and the receiver. The valid key sizes are specified by the particular symmetric algorithm implementation and are listed in the LegalKeySizes property.

If a key has not been set, the GenerateKey method will be called to create a new random value.

Read/Write.

Exceptions

Exception | Condition
ArgumentNullException | An attempt was made to set the key to an uninitialized array.
CryptographicException | The key size is invalid.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: KeySize (get)

KeySize

Gets the size of the key, in bits, used by the symmetric algorithm.

 Public Property Get KeySize ( ) As Long

Return Values

Long - The size, in bits, of the secret key used by the symmetric algorithm.

Remarks

The valid key sizes are specified by the particular symmetric algorithm implementation and are listed in the LegalKeySizes property.

Read/Write.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: KeySize (let)

KeySize

Gets the size of the key, in bits, used by the symmetric algorithm.

 Public Property Let KeySize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The size, in bits, of the secret key used by the symmetric algorithm.

Remarks

The valid key sizes are specified by the particular symmetric algorithm implementation and are listed in the LegalKeySizes property.

Read/Write.

Exceptions

Exception | Condition
CryptographicException | The key size is not valid.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: LegalBlockSizes (get)

LegalBlockSizes

Gets the block sizes, in bits, that are supported by the symmetric algorithm.

 Public Property Get LegalBlockSizes ( ) As KeySizes ( ) :

Return Values

KeySizes() - An array that contains the block sizes supported by the algorithm.

Remarks

The symmetric algorithm supports only block sizes that match an entry in this array.

Read Only.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: LegalKeySizes (get)

LegalKeySizes

Gets the key sizes, in bits, that are supported by the symmetric algorithm.

 Public Property Get LegalKeySizes ( ) As KeySizes ( ) :

Return Values

KeySizes() - An array that contains the key sizes supported by the algorithm.

Remarks

The symmetric algorithm supports only key sizes that match an entry in this array.

Read Only.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: Mode (get)

Mode

Gets the mode for operation of the symmetric algorithm.

 Public Property Get Mode ( ) As CipherMode

Return Values

CipherMode - The mode for operation of the symmetric algorithm. The default is CipherMode.CBC.

Remarks

See CipherMode enumeration for a description of specific modes.

Read/Write.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: Mode (let)

Mode

Sets the mode for operation of the symmetric algorithm.

 Public Property Let Mode(
      ByVal Value As CipherMode ) :

Parameters

Value
[ByVal] CipherMode. The mode for operation of the symmetric algorithm. The default is CipherMode.CBC.

Remarks

See CipherMode enumeration for a description of specific modes.

Read/Write.

Exceptions

Exception | Condition
CryptographicException | The cipher mode is not one of the CipherMode values.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: Padding (get)

Padding

Gets the padding mode used in the symmetric algorithm.

 Public Property Get Padding ( ) As PaddingMode

Return Values

PaddingMode - The padding mode used in the symmetric algorithm. The default is PaddingMode.PKCS7.

Remarks

Most plain text messages do not consist of a number of bytes that completely fill blocks. Often, there are not enough bytes to fill the last block. When this happens, a padding string is added to the text. For example, if the block length is 64 bits and the last block contains only 40 bits, 24 bits of padding are added. See the PaddingMode enumeration for a description of specific modes.

Read/Write.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: Padding (let)

Padding

Gets the padding mode used in the symmetric algorithm.

 Public Property Let Padding(
      ByVal Value As PaddingMode ) :

Parameters

Value
[ByVal] PaddingMode. The padding mode used in the symmetric algorithm. The default is PaddingMode.PKCS7.

Remarks

Most plain text messages do not consist of a number of bytes that completely fill blocks. Often, there are not enough bytes to fill the last block. When this happens, a padding string is added to the text. For example, if the block length is 64 bits and the last block contains only 40 bits, 24 bits of padding are added. See the PaddingMode enumeration for a description of specific modes.

Read/Write.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: PaddingMode

PaddingMode

A defined set of padding modes used to fill the end of non-blocksize length data blocks. For example if an algorithm has a blocksize of 8 bytes and the data is 3 bytes in length, then 5 bytes of padding must be applied.

 Public Enum PaddingMode

Values

None = 1
No padding is applied to the data.
PKCS7 = 2
The padding that is used is defined by a pattern of filling the remaining bytes with the numeric value of the padding bytes needed. If 5 bytes of padding are needed, then the 5 bytes would be 05 05 05 05 05.
Zeros = 3
The padded bytes are all equal to zero.
ANSIX923 = 4
The padding that is used is defined by a pattern of bytes set to zero with the last byte having the value of the number of padded bytes added. If 5 bytes of padding are needed, then the 5 bytes would be 00 00 00 00 05.
ISO10126 = 5
The padded bytes are random in value with the last byte being the number of padding bytes. If 5 bytes of padding are needed, then the 5 bytes might be 23 9A 48 7C 05.

Remarks

Most plain text messages do not have an length that is a multiple of the block size to be processed by the cipher. There is usually not enough bytes to completely fill the last block to be processed. In these cases, additional bytes need to be appended to make the final block the same size as the block size being processed.

The reverse is done when decrypting ciphered data back to plain text. The padded bytes are removed.

If a plain text message is 9 bytes long and the block size to be processed is 8 bytes, then two blocks will need to be processed. However, the second block will only have 1 byte, so 7 additional bytes are added for padding.

Data: FF FF FF FF FF FF FF FF FF

None: FF FF FF FF FF FF FF FF FF

PKCS7: FF FF FF FF FF FF FF FF FF 07 07 07 07 07 07 07

ANSIX923: FF FF FF FF FF FF FF FF FF 00 00 00 00 00 00 07

ISO10126: FF FF FF FF FF FF FF FF FF 7D 2A 75 EF F8 EF 07

Zeros: FF FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: ToString

ToString

Returns a string representation of this instance.

 Public Function ToString ( ) As String

Return Values

String - A string that represents this instance.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithm: ValidKeySize

ValidKeySize

Determines whether the specified key size is valid for the current algorithm.

 Public Function ValidKeySize(
      ByVal BitLength As Long ) As Boolean

Parameters

BitLength
[ByVal] Long. The length, in bits, to check for a valid key size.

Return Values

Boolean - True if the specified key size is valid for the current algorithm; otherwise, False.

See Also

Project CorLib Overview

Class SymmetricAlgorithm Overview


SymmetricAlgorithmBase

SymmetricAlgorithmBase

Provides a common base of functionality for SymmetricAlgorithm derived classes.

Public:

Properties:

Name | Description
BlockSize (get) | Returns the currently set block size in bits.
BlockSize (let) | Sets the current block size to be used.
FeedbackSize (get) | Returns the current feedback size in bits.
FeedbackSize (let) | Sets the current feedback size in bits to be used.
KeySize (get) | Returns the currently set key size to be used.
KeySize (let) | Sets the new key size value to be used.
LegalBlockSizes (get) | Returns a list of legal block sizes.
LegalKeySizes (get) | Returns a list of legal key sizes.
Mode (get) | Returns the current cipher mode to be used.
Mode (let) | Sets the cipher mode to be used.
Padding (get) | Returns the current padding to be used.
Padding (let) | Sets the padding mode to be used.

Methods:

Name | Description
AddLegalBlockSize | Adds a new KeySizes object with the specified values to the list of legal block sizes.
AddLegalKeySize | Adds a new KeySizes object with the supplied values to the list of legal key sizes.
Clear | Clears the IV and Key values.
CloneRgbIV | Returns a clone of an IV.
CloneRgbKey | Returns a clone of a key.
GenerateIV | Generates a random IV value.
GenerateKey | Generates a new random key.
GetIV | Returns the current IV value.
GetKey | Returns the current secret key.
SetIV | Sets the current IV value.
SetKey | Sets the current secret key.
ValidKeySize | Checks if a bit length is a valid key size in bits.

Events:

Name | Description
CheckForWeakKey | Used for implementations that must check for some kind of weak or semi-weak key.

Remarks

The base class implements many of the details necessary for implementing a Symmetric Cryptographic Algorithm. By utilizing the base class the implementor can quickly provide a new implementation that is consistent with the existing implementations without the need to manage lower level details.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview

SymmetricAlgorithm


SymmetricAlgorithmBase: AddLegalBlockSize

AddLegalBlockSize

Adds a new KeySizes object with the specified values to the list of legal block sizes.

 Public Sub AddLegalBlockSize(
      ByVal MinSize As Long,
      ByVal MaxSize As Long,
      ByVal SkipSize As Long )

Parameters

MinSize
[ByVal] Long. The mininum block size in bits the algorithm can process.
MaxSize
[ByVal] Long. The maximum block size in bits the algorithm can process.
SkipSize
[ByVal] Long. The number of bits the block size can change from minimum to maximum.

Remarks

A derived class uses this to add the set of legal block sizes the implementing algorithm can process.

As an example, the RijndaelManaged class calls this method in Class_Initialize.

 mBase.AddLegalBlockSize 128, 256, 64

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: AddLegalKeySize

AddLegalKeySize

Adds a new KeySizes object with the supplied values to the list of legal key sizes.

 Public Sub AddLegalKeySize(
      ByVal MinSize As Long,
      ByVal MaxSize As Long,
      ByVal SkipSize As Long )

Parameters

MinSize
[ByVal] Long. The mininum key size in bits the algorithm can use.
MaxSize
[ByVal] Long. The maximum key size in bits the algorithm can use.
SkipSize
[ByVal] Long. The number of bits used to step from the minimum to maximum key size. All intermediate sizes are also legal sizes.

Remarks

A derived class uses this to add the set of legal block sizes the implementing algorithm can process.

As an example, the RijndaelManaged class calls this method in Class_Initialize.

 mBase.AddLegalKeySize 128, 256, 64

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: BlockSize (get)

BlockSize

Returns the currently set block size in bits.

 Public Property Get BlockSize ( ) As Long

Return Values

Long - The currently block size in bits.

Read/Write.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: BlockSize (let)

BlockSize

Sets the current block size to be used.

 Public Property Let BlockSize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new current block size to be used.

Remarks

The block size is in bits and must be one of the legal block sizes.

Read/Write.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: CheckForWeakKey

CheckForWeakKey

Used for implementations that must check for some kind of weak or semi-weak key.

 Public Event CheckForWeakKey(
      ByRef RgbKey ( ) As Byte,
      ByRef Ex As Exception )

Parameters

RgbKey
[ByRef] Byte. The key to be checked for weakness.
Ex
[ByRef] Exception. The exception indicating the key is weak and should be thrown.

Remarks

If the RgbKey is considered weak by the current symmetric algorithm, it should set Ex to an appropriate Exception object. Typically a CryptographicException is set.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: Clear

Clear

Clears the IV and Key values.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: CloneRgbIV

CloneRgbIV

Returns a clone of an IV.

 Public Function CloneRgbIV(
      ByRef RgbIV As Variant ) As Byte ( )

Parameters

RgbIV
[ByRef] Variant. The IV to return a clone of.

Return Values

Byte() - The newly cloned IV.

Remarks

If a missing parameter is passed in, then the IV from the GetIV function will be returned.

The cloned IV will be zero-based regardless of the base of the passed in IV array.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: CloneRgbKey

CloneRgbKey

Returns a clone of a key.

 Public Function CloneRgbKey(
      ByRef RgbKey As Variant ) As Byte ( )

Parameters

RgbKey
[ByRef] Variant. The key to return the clone of.

Return Values

Byte() - The newly cloned key.

Remarks

If a missing parameter is passed in, then the key from the GetKey function will be returned.

The cloned key will be zero-based regardless of the base of the passed in key array.

If a key is passed in, then the "CheckForWeakKey" event will be raised.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: FeedbackSize (get)

FeedbackSize

Returns the current feedback size in bits.

 Public Property Get FeedbackSize ( ) As Long

Return Values

Long - The current feedback size in bits.

Read/Write.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: FeedbackSize (let)

FeedbackSize

Sets the current feedback size in bits to be used.

 Public Property Let FeedbackSize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new feedback size.

Remarks

The feedback size must be greater than zero and evenly divisible by 8. The size cannot be greater than the current block size.

Read/Write.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: GenerateIV

GenerateIV

Generates a random IV value.

 Public Sub GenerateIV ( )

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: GenerateKey

GenerateKey

Generates a new random key.

 Public Sub GenerateKey ( )

Remarks

The "CheckForWeakKey" event is raised.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: GetIV

GetIV

Returns the current IV value.

 Public Function GetIV ( ) As Byte ( )

Return Values

Byte() - The current IV value.

Remarks

If no IV has been set, then a random IV will be generated.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: GetKey

GetKey

Returns the current secret key.

 Public Function GetKey ( ) As Byte ( )

Return Values

Byte() - The current secret key is returned.

Remarks

If no key has been set, then a random key will be generated.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: KeySize (get)

KeySize

Returns the currently set key size to be used.

 Public Property Get KeySize ( ) As Long

Return Values

Long - The currently set key size in bits to be used.

Read/Write.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: KeySize (let)

KeySize

Sets the new key size value to be used.

 Public Property Let KeySize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new key size in bits.

Remarks

The new value must be of a legal size.

Read/Write.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: LegalBlockSizes (get)

LegalBlockSizes

Returns a list of legal block sizes.

 Public Property Get LegalBlockSizes ( ) As KeySizes ( )

Return Values

KeySizes() - Returns an array of KeySize objects containing all the legal block sizes.

Read Only.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: LegalKeySizes (get)

LegalKeySizes

Returns a list of legal key sizes.

 Public Property Get LegalKeySizes ( ) As KeySizes ( )

Return Values

KeySizes() - An array of KeySize objects containing all the legal key sizes in bits.

Read Only.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: Mode (get)

Mode

Returns the current cipher mode to be used.

 Public Property Get Mode ( ) As CipherMode

Return Values

CipherMode - The current cipher mode to be used.

Read/Write.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview

CipherMode


SymmetricAlgorithmBase: Mode (let)

Mode

Sets the cipher mode to be used.

 Public Property Let Mode(
      ByVal Value As CipherMode )

Parameters

Value
[ByVal] CipherMode. The new cipher mode.

Read/Write.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview

CipherMode


SymmetricAlgorithmBase: Padding (get)

Padding

Returns the current padding to be used.

 Public Property Get Padding ( ) As PaddingMode

Return Values

PaddingMode - The currnet padding.

Read/Write.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview

PaddingMode


SymmetricAlgorithmBase: Padding (let)

Padding

Sets the padding mode to be used.

 Public Property Let Padding(
      ByVal Value As PaddingMode )

Parameters

Value
[ByVal] PaddingMode. The new padding mode to be used.

Read/Write.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview

PaddingMode


SymmetricAlgorithmBase: SetIV

SetIV

Sets the current IV value.

 Public Sub SetIV(
      ByRef RgbIV ( ) As Byte )

Parameters

RgbIV
[ByRef] Byte. The new IV value.

Remarks

The bit length of the IV value must equal the block size.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: SetKey

SetKey

Sets the current secret key.

 Public Sub SetKey(
      ByRef RgbKey ( ) As Byte )

Parameters

RgbKey
[ByRef] Byte. The new secret key.

Remarks

The bit length of the new value must be of a legal key size.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SymmetricAlgorithmBase: ValidKeySize

ValidKeySize

Checks if a bit length is a valid key size in bits.

 Public Function ValidKeySize(
      ByVal BitLength As Long ) As Boolean

Parameters

BitLength
[ByVal] Long. The value to check.

Return Values

Boolean - Returns True if the value is a valid key size, False otherwise.

See Also

Project CorLib Overview

Class SymmetricAlgorithmBase Overview


SystemException

SystemException

Defines the base class for predefined exceptions in the VBCorLib library.

Implements:

Exception
IObject

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

Remarks

This class is used to differenciate between exceptions raised by VBCorLib and the executing application. In most cases, an instance of this class should not be thrown.

See Also

Project CorLib Overview

Class SystemException Overview

Constructors

ExceptionMethods

Exception


SystemException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Read Only.

See Also

Project CorLib Overview

Class SystemException Overview


SystemException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class SystemException Overview


SystemException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class SystemException Overview


SystemException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class SystemException Overview


SystemException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class SystemException Overview


SystemException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class SystemException Overview


SystemException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class SystemException Overview


SystemException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class SystemException Overview


SystemException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class SystemException Overview

Exception


SystemException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class SystemException Overview


SystemException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class SystemException Overview


SystemException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewSystemException.

Read Only.

See Also

Project CorLib Overview

Class SystemException Overview


SystemException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class SystemException Overview


SystemException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class SystemException Overview


SystemException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class SystemException Overview


TaiwanCalendar

TaiwanCalendar

Provides functions for manipulating Taiwanese dates.

Implements:

Calendar
ICloneable
IObject

Public:

Properties:

Name | Description
AlgorithmType (get) | Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.
Eras (get) | Gets a list of eras in the TaiwanCalendar.
IsReadOnly (get) | Gets a value indicating whether this TaiwanCalendar object is read-only.
MaxSupportedDateTime (get) | Gets the latest date and time supported by the TaiwanCalendar class.
MinSupportedDateTime (get) | Gets the earliest date and time supported by the TaiwanCalendar class.
TwoDigitYearMax (get) | Gets the last year of a 100-year range that can be represented by a 2-digit year.
TwoDigitYearMax (let) | Sets the last year of a 100-year range that can be represented by a 2-digit year.

Methods:

Name | Description
AddDays | Returns a CorDateTime that is the specified number of days away from the specified CorDateTime.
AddHours | Returns a CorDateTime this is the specified number of hours from the original Time.
AddMilliseconds | Returns a CorDateTime this is the specified number of Milliseconds from the original Time.
AddMinutes | Returns a CorDateTime this is the specified number of Minutes from the original Time.
AddMonths | Returns a CorDateTime this is the specified number of Months from the original Time.
AddSeconds | Returns a CorDateTime this is the specified number of Seconds from the original Time.
AddWeeks | Returns a CorDateTime this is the specified number of Weeks from the original Time.
AddYears | Returns a CorDateTime this is the specified number of Years from the original Time.
Clone | Creates a new object that is a copy of the current TaiwanCalendar object.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetDayOfMonth | Returns the day of the months for the specified date.
GetDayOfWeek | Returns the DayOfWeek enum of the specified date.
GetDayOfYear | Returns the day of the year for the specified date.
GetDaysInMonth | Returns the number of days in the specified month.
GetDaysInYear | Returns the number of days in the specified year.
GetEra | Returns the era in the specified CorDateTime.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetHour | Returns the hour of the specified time.
GetLeapMonth | Calculates the leap month for a specified year and era.
GetMilliseconds | Returns the milliseconds of the specified time.
GetMinute | Returns the minute of the specified time.
GetMonth | Returns the month of the specified time.
GetMonthsInYear | Returns the number of months in the specified year in the specified era.
GetSecond | Returns the second of the specified time.
GetWeekOfYear | Returns the week of the year that includes the date in the specified Date or CorDateTime.
GetYear | Returns the year of the specified time.
IsLeapDay | Returns a boolean indicating if the specific day is a leap day.
IsLeapMonth | Returns a boolean indicating if the specific month is a leap month.
IsLeapYear | Returns a boolean indicating if the specific year is a leap year.
ToDateTime | Returns a Gregorian CorDateTime computed using the specific calendar rules.
ToFourDigitYear | Returns a 4-digit year from a 2-digit number.
ToString | Returns a string representation of this object instance.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview

Calendar


TaiwanCalendar: AddDays

AddDays

Returns a CorDateTime that is the specified number of days away from the specified CorDateTime.

 Public Function AddDays(
      ByRef Time As Variant,
      ByVal Days As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to add days to.
Days
[ByVal] Long. The number of days to add.

Return Values

CorDateTime - The CorDateTime that results from adding the specified number of days to the specified CorDateTime.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: AddHours

AddHours

Returns a CorDateTime this is the specified number of hours from the original Time.

 Public Function AddHours(
      ByRef Time As Variant,
      ByVal Hours As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of hours to.
Hours
[ByVal] Long. The number of hours to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of hours added.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: AddMilliseconds

AddMilliseconds

Returns a CorDateTime this is the specified number of Milliseconds from the original Time.

 Public Function AddMilliseconds(
      ByRef Time As Variant,
      ByVal Milliseconds As Double ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Milliseconds to.
Milliseconds
[ByVal] Double. The number of Milliseconds to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Milliseconds added.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: AddMinutes

AddMinutes

Returns a CorDateTime this is the specified number of Minutes from the original Time.

 Public Function AddMinutes(
      ByRef Time As Variant,
      ByVal Minutes As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Minutes to.
Minutes
[ByVal] Long. The number of Minutes to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Minutes added.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: AddMonths

AddMonths

Returns a CorDateTime this is the specified number of Months from the original Time.

 Public Function AddMonths(
      ByRef Time As Variant,
      ByVal Months As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Months to.
Months
[ByVal] Long. The number of Months to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Months added.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: AddSeconds

AddSeconds

Returns a CorDateTime this is the specified number of Seconds from the original Time.

 Public Function AddSeconds(
      ByRef Time As Variant,
      ByVal Seconds As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Seconds to.
Seconds
[ByVal] Long. The number of Seconds to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Seconds added.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: AddWeeks

AddWeeks

Returns a CorDateTime this is the specified number of Weeks from the original Time.

 Public Function AddWeeks(
      ByRef Time As Variant,
      ByVal Weeks As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Weeks to.
Weeks
[ByVal] Long. The number of Weeks to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Weeks added.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: AddYears

AddYears

Returns a CorDateTime this is the specified number of Years from the original Time.

 Public Function AddYears(
      ByRef Time As Variant,
      ByVal Years As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Years to.
Years
[ByVal] Long. The number of Years to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Years added.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: AlgorithmType (get)

AlgorithmType

Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.

 Public Property Get AlgorithmType ( ) As CalendarAlgorithmType

Return Values

CalendarAlgorithmType - Always returns CalendarAlgorithmType.SolarCalendar.

Read Only.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: Calendar

Calendar

 Implements Calendar

Return Values

Calendar -

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: Clone

Clone

Creates a new object that is a copy of the current TaiwanCalendar object.

 Public Function Clone ( ) As TaiwanCalendar

Return Values

TaiwanCalendar - A copy of the TaiwanCalendar object.

Remarks

The clone will always be a non-readonly version.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: Eras (get)

Eras

Gets a list of eras in the TaiwanCalendar.

 Public Property Get Eras ( ) As Long ( )

Return Values

Long() - An array of integers that represents the eras in the TaiwanCalendar.

Remarks

The TaiwanCalendar class recognizes only the current era. This property always returns an array with only one element.

Read Only.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: GetDayOfMonth

GetDayOfMonth

Returns the day of the months for the specified date.

 Public Function GetDayOfMonth(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The date inwhich to retrieve the day of the month.

Return Values

Long - An integer from 1 to 31 that represents the day of the month in the specified Date or CorDateTime.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: GetDayOfWeek

GetDayOfWeek

Returns the DayOfWeek enum of the specified date.

 Public Function GetDayOfWeek(
      ByRef Time As Variant ) As DayOfWeek

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to read the day of the week from.

Return Values

DayOfWeek - A DayOfWeek enum representing the day of the week.

Remarks

The DayOfWeek is Sunday and is 0-based. The Visual Basic enum vbDayOfWeek is 1-based.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: GetDayOfYear

GetDayOfYear

Returns the day of the year for the specified date.

 Public Function GetDayOfYear(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to read the day of the year from.

Return Values

Long - An integer from 1 to 366 that represents the day of the year in the specified Date or CorDateTime.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: GetDaysInMonth

GetDaysInMonth

Returns the number of days in the specified month.

 Public Function GetDaysInMonth(
      ByVal Year As Long,
      ByVal Month As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year inwhich the month exists. This is used by calendars that have months that change based on the year, such as leap years.
Month
[ByVal] Long. The month to retrieve the number of days of.
Era
[ByRef] Optional. Variant. The time period inwhich the year exists.

Return Values

Long -

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: GetDaysInYear

GetDaysInYear

Returns the number of days in the specified year.

 Public Function GetDaysInYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year to retrieve the number of days of.
Era
[ByRef] Optional. Variant. The era the year exists in.

Return Values

Long - The number of days in the year.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: GetEra

GetEra

Returns the era in the specified CorDateTime.

 Public Function GetEra(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The CorDateTime to read.

Return Values

Long - An integer that represents the era in the specified CorDateTime.

Remarks

The TaiwanCalendar class recognizes only the current era.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: GetHour

GetHour

Returns the hour of the specified time.

 Public Function GetHour(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the hour from.

Return Values

Long - The hour portion of the time.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: GetLeapMonth

GetLeapMonth

Calculates the leap month for a specified year and era.

 Public Function GetLeapMonth(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. A year.
Era
[ByRef] Optional. Variant. An era.

Return Values

Long - Always 0 because the TaiwanCalendar calendar does not recognize leap months.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: GetMilliseconds

GetMilliseconds

Returns the milliseconds of the specified time.

 Public Function GetMilliseconds(
      ByRef Time As Variant ) As Double

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the milliseconds from.

Return Values

Double - The millisecond portion of the time.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: GetMinute

GetMinute

Returns the minute of the specified time.

 Public Function GetMinute(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the minute from.

Return Values

Long - The minute portion of the time.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: GetMonth

GetMonth

Returns the month of the specified time.

 Public Function GetMonth(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the month from.

Return Values

Long - The month portion of the time.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: GetMonthsInYear

GetMonthsInYear

Returns the number of months in the specified year in the specified era.

 Public Function GetMonthsInYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. An integer that represents the year.
Era
[ByRef] Optional. Variant. An integer that represents the era.

Return Values

Long - The number of months in the specified year in the specified era.

Remarks

This calendar will always return 12.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: GetSecond

GetSecond

Returns the second of the specified time.

 Public Function GetSecond(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the second from.

Return Values

Long - The second portion of the time.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: GetWeekOfYear

GetWeekOfYear

Returns the week of the year that includes the date in the specified Date or CorDateTime.

 Public Function GetWeekOfYear(
      ByRef Time As Variant,
      ByVal Rule As CalendarWeekRule,
      ByVal FirstDayOfWeek As DayOfWeek ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to read.
Rule
[ByVal] CalendarWeekRule. One of the CalendarWeekRule values that defines a calendar week.
FirstDayOfWeek
[ByVal] DayOfWeek. One of the DayOfWeek enumeration values that represents the first day of the week.

Return Values

Long - A 1-based positive integer that represents the week of the year that includes the date in the Time parameter.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: GetYear

GetYear

Returns the year of the specified time.

 Public Function GetYear(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the year from.

Return Values

Long - The year portion of the time.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: IsLeapDay

IsLeapDay

Returns a boolean indicating if the specific day is a leap day.

 Public Function IsLeapDay(
      ByVal Year As Long,
      ByVal Month As Long,
      ByVal Day As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year the day is in.
Month
[ByVal] Long. The month the day is in.
Day
[ByVal] Long. The day to check if is a leap day.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the day is a leap day.

Remarks

A leap day only exists in a leap year, such as February 29th in the Taiwan calendar.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: IsLeapMonth

IsLeapMonth

Returns a boolean indicating if the specific month is a leap month.

 Public Function IsLeapMonth(
      ByVal Year As Long,
      ByVal Month As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year the month is in.
Month
[ByVal] Long. The month to check if it is a leap month.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the month is a leap month.

Remarks

A leap month only exists in a leap year, such as Adar II in the Hebrew calendar. This always returns False.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: IsLeapYear

IsLeapYear

Returns a boolean indicating if the specific year is a leap year.

 Public Function IsLeapYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year to check if is a leap year.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the year is a leap year.

Remarks

A leap year in the Korean calendar occurs when the year is evenly divisible by 4, but not by 100, unless it is divisible by 400.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: IsReadOnly (get)

IsReadOnly

Gets a value indicating whether this TaiwanCalendar object is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - True if this TaiwanCalendar object is read-only; otherwise, False.

Read Only.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: MaxSupportedDateTime (get)

MaxSupportedDateTime

Gets the latest date and time supported by the TaiwanCalendar class.

 Public Property Get MaxSupportedDateTime ( ) As CorDateTime

Return Values

CorDateTime - The latest date and time supported by the TaiwanCalendar class, which is equivalent to the last moment of December 31, 9999 C.E. in the Gregorian calendar.

Read Only.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: MinSupportedDateTime (get)

MinSupportedDateTime

Gets the earliest date and time supported by the TaiwanCalendar class.

 Public Property Get MinSupportedDateTime ( ) As CorDateTime

Return Values

CorDateTime - The earliest date and time supported by the TaiwanCalendar class, which is equivalent to the first moment of January 1, 1912 C.E. in the Gregorian calendar.

Read Only.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: ToDateTime

ToDateTime

Returns a Gregorian CorDateTime computed using the specific calendar rules.

 Public Function ToDateTime(
      ByVal Year As Long,
      ByVal Month As Long,
      ByVal Day As Long,
      ByVal Hour As Long,
      ByVal Minute As Long,
      ByVal Second As Long,
      ByVal Millisecond As Long,
      Optional ByRef Era As Variant ) As CorDateTime

Parameters

Year
[ByVal] Long. The Year in the specific calendar type.
Month
[ByVal] Long. The Month in the specific calendar type.
Day
[ByVal] Long. The Day in the specific calendar type.
Hour
[ByVal] Long. The hour for the new time.
Minute
[ByVal] Long. The minute for the new time.
Second
[ByVal] Long. The second for the new time.
Millisecond
[ByVal] Long. The milliseconds for the new time.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

CorDateTime - A Gregorian version of the date specified.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: ToFourDigitYear

ToFourDigitYear

Returns a 4-digit year from a 2-digit number.

 Public Function ToFourDigitYear(
      ByVal Year As Long ) As Long

Parameters

Year
[ByVal] Long. The year to be converted to 4-digits.

Return Values

Long - A 4-digit year in the specific calendar.

Remarks

Because the year in the Taiwan calendar is typically less than four digits long, this implementation always returns the value of the year parameter.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: TwoDigitYearMax (get)

TwoDigitYearMax

Gets the last year of a 100-year range that can be represented by a 2-digit year.

 Public Property Get TwoDigitYearMax ( ) As Long

Return Values

Long - The last year of a 100-year range that can be represented by a 2-digit year.

Remarks

Because the year in the Taiwan calendar is typically less than four digits long, this implementation returns 99 by default and does not affect the return value of ToFourDigitYear.

Read/Write.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TaiwanCalendar: TwoDigitYearMax (let)

TwoDigitYearMax

Sets the last year of a 100-year range that can be represented by a 2-digit year.

 Public Property Let TwoDigitYearMax(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. An integer representing the last year of a 100-year range.

Remarks

Exception | Condition
ArgumentOutOfRangeException | The value specified in a set operation is less than 99. -or- The value specified in a set operation is greater than MaxSupportedDateTime.Year.
InvalidOperationException | In a set operation, the current instance is read-only.

Because the year in the Taiwan calendar is typically less than four digits long, this implementation returns 99 by default and does not affect the return value of ToFourDigitYear.

Read/Write.

See Also

Project CorLib Overview

Class TaiwanCalendar Overview


TextReader

TextReader

Provides an interface to read text characters from a stream.

Public:

Methods:

Name | Description
CloseReader | Closes the current reader.
Equals | Returns if the value is equal to this instance of TextReader
GetHashCode | Returns a pseudo-unique number that identifies this object instance.
Peek | Returns the next character from the stream without advancing to the next characters.
Read | Reads the next character from the input stream and advances the character position by one character.
ReadBlock | Reads a maximum of Count characters from the current stream, and writes the data to Chars, beginning at Index.
ReadLine | Reads a line of characters from the current stream and returns the data as a string.
ReadToEnd | Reads all characters from the current position to the end of the TextReader and returns them as one string.
ToString | Returns a string representation of this instance.

See Also

Project CorLib Overview

Class TextReader Overview

TextReaderStatic

StreamReader

StringReader


TextReader: CloseReader

CloseReader

Closes the current reader.

 Public Sub CloseReader ( )

See Also

Project CorLib Overview

Class TextReader Overview


TextReader: Equals

Equals

Returns if the value is equal to this instance of TextReader

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to campare equality with.

Return Values

Boolean - True if Value equals this class instance, else False.

See Also

Project CorLib Overview

Class TextReader Overview


TextReader: GetHashCode

GetHashCode

Returns a pseudo-unique number that identifies this object instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Value that identifies this instance.

See Also

Project CorLib Overview

Class TextReader Overview


TextReader: Peek

Peek

Returns the next character from the stream without advancing to the next characters.

 Public Function Peek ( ) As Long

Return Values

Long - The next character in the stream, or -1 if no characters remain in the stream.

Remarks

The Peek method returns an integer value in order to determine whether the end of the file, or another error has occurred. This allows a user to first check if the returned value is -1 before casting it to a Integer type.

The current position of the TextReader is not changed by this operation. The returned value is -1 if no more characters are available.

If the returned value is not -1 then use the Char.ConvertFromInt32 method to convert to an Integer character.

Exceptions

Exception | Condition
ObjectDisposedException | The TextReader is closed.

See Also

Project CorLib Overview

Class TextReader Overview


TextReader: Read

Read

Reads the next character from the input stream and advances the character position by one character.

 Public Function Read ( ) As Long

Return Values

Long - The next character from the input stream, or -1 if no more characters are available.

Remarks

If the returned value is not -1 then use the Char.ConvertFromInt32 method to convert to an Integer character.

Exceptions

Exception | Condition
ObjectDisposedException | The TextReader is closed.

See Also

Project CorLib Overview

Class TextReader Overview


TextReader: ReadBlock

ReadBlock

Reads a maximum of Count characters from the current stream, and writes the data to Chars, beginning at Index.

 Public Function ReadBlock(
      ByRef Chars ( ) As Integer,
      ByVal Index As Long,
      ByVal Count As Long ) As Long

Parameters

Chars
[ByRef] Integer. The character array to receive Count characters from the stream.
Index
[ByVal] Long. The starting index in Chars to begin storing characters.
Count
[ByVal] Long. The maximum number of characters to be read from the stream.

Return Values

Long - The number of characters that have been read. The number will be less than or equal to Count, depending on whether all input characters have been read.

Remarks

Characters are encoded within the stream. A single character may require more that one byte to represent it. This may result in fewer characters read than there are bytes in the stream.

Exceptions

Exception | Condition
ArgumentNullException | Chars is uninitialized.
ArgumentException | The Char length minus Index is less than Count.
ArgumentOutOfRangeException | Index or Count is negative.
ObjectDisposedException | The TextReader is closed.

See Also

Project CorLib Overview

Class TextReader Overview


TextReader: ReadLine

ReadLine

Reads a line of characters from the current stream and returns the data as a string.

 Public Function ReadLine ( ) As String

Return Values

String - The next line from the input stream, or vbNullString if all characters have been read.

Remarks

A line is defined as a sequence of characters followed by a carriage return (0x000d), a line feed (0x000a), a carriage return followed by a line feed, Environment.NewLine, or the end of stream marker. The string that is returned does not contain the terminating carriage return and/or line feed. The returned value is vbNullString if the end of the input stream has been reached.

Exceptions

Exception | Condition
ObjectDisposedException | The TextReader is closed.

See Also

Project CorLib Overview

Class TextReader Overview


TextReader: ReadToEnd

ReadToEnd

Reads all characters from the current position to the end of the TextReader and returns them as one string.

 Public Function ReadToEnd ( ) As String

Return Values

String - A string containing all characters from the current position to the end of the TextReader.

Exceptions

Exception | Condition
ObjectDisposedException | The TextReader is closed.

See Also

Project CorLib Overview

Class TextReader Overview


TextReader: ToString

ToString

Returns a string representation of this instance.

 Public Function ToString ( ) As String

Return Values

String - A string representation of this instance.

See Also

Project CorLib Overview

Class TextReader Overview


TextReaderStatic

TextReaderStatic

Provides static methods and properties for the TextReader class.

Public:

Properties:

Name | Description
NullReader (get) | Returns a TextReader with no data to read from.

See Also

Project CorLib Overview

Class TextReaderStatic Overview

TextReader


TextReaderStatic: NullReader (get)

NullReader

Returns a TextReader with no data to read from.

 Public Property Get NullReader ( ) As TextReader

Return Values

TextReader - The Null text reader.

Remarks

Reader from the NullReader text reader is similar to reading from the end of a stream:

  • The Read and Peek methods return -1.
  • The ReadBlock method returns zero.
  • The ReadLine method returns vbNullString.
  • The ReadToEnd method returns vbNullString.

Access this property using TextReader.NullReader.

Read Only.

See Also

Project CorLib Overview

Class TextReaderStatic Overview


TextWriter

TextWriter

Provides an interface used to write text characters to a stream.

Public:

Properties:

Name | Description
Encoding (get) | When implemented in a derived class, returns the Encoding in which the output is written.
FormatProvider (get) | Gets an object that controls formatting.
NewLine (get) | Gets the line terminator string used by the current TextWriter.
NewLine (let) | Sets the line terminator string used by the current TextWriter.

Methods:

Name | Description
CloseWriter | Closes this writer instance.
Equals | Returns if the value is equal to this instance of TextWriter
Flush | Forces any data being cached to be written to the stream immediately.
GetHashCode | Returns a pseudo-unique number that identifies this object instance.
ToString | Returns a string representation of this instance.
WriteChars | Writes the string representation of the characters to the stream using both the format provider and encoding objects.
WriteLine | Writes the string representation of the value followed by a NewLine to the stream using both the format provider and encoding objects.
WriteLineChars | Writes the string representation of the characters followed by a NewLine to the stream using both the format provider and encoding objects.
WriteValue | Writes the string representation of the value to the stream using both the format provider and encoding objects.

Remarks

The specific writer will use the supplied or default Encoding scheme to convert text characters to byte arrays to be written to the stream.

See Also

Project CorLib Overview

Class TextWriter Overview

StreamWriter

StringWriter


TextWriter: CloseWriter

CloseWriter

Closes this writer instance.

 Public Sub CloseWriter ( )

See Also

Project CorLib Overview

Class TextWriter Overview


TextWriter: Encoding (get)

Encoding

When implemented in a derived class, returns the Encoding in which the output is written.

 Public Property Get Encoding ( ) As Encoding

Return Values

Encoding - The Encoding in which the output is written.

Remarks

This property is necessary for some XML scenarios where a header must be written containing the encoding used by the TextWriter. This allows the XML code to consume an arbitrary TextWriter and generate the correct XML header.

Read Only.

See Also

Project CorLib Overview

Class TextWriter Overview


TextWriter: Equals

Equals

Returns if the value is equal to this instance of TextWriter

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to campare equality with.

Return Values

Boolean - True if Value equals this class instance, else False.

See Also

Project CorLib Overview

Class TextWriter Overview


TextWriter: Flush

Flush

Forces any data being cached to be written to the stream immediately.

 Public Sub Flush ( )

See Also

Project CorLib Overview

Class TextWriter Overview


TextWriter: FormatProvider (get)

FormatProvider

Gets an object that controls formatting.

 Public Property Get FormatProvider ( ) As IFormatProvider

Return Values

IFormatProvider - An IFormatProvider object for a specific culture, or the formatting of the current culture if no other culture is specified.

Remarks

The value of the FormatProvider property specifies the culture-specific formatting that is used when you call the WriteValue and WriteLine methods.

Read Only.

See Also

Project CorLib Overview

Class TextWriter Overview


TextWriter: GetHashCode

GetHashCode

Returns a pseudo-unique number that identifies this object instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Value that identifies this instance.

See Also

Project CorLib Overview

Class TextWriter Overview


TextWriter: NewLine (get)

NewLine

Gets the line terminator string used by the current TextWriter.

 Public Property Get NewLine ( ) As String

Return Values

String - The line terminator string for the current TextWriter.

Remarks

The default line terminator string is a carriage return followed by a line feed (vbCrLf).

The line terminator string is written to the text stream whenever one of the WriteLine methods is called. In order for text written by the TextWriter to be readable by a TextReader, only "\n" or "\r\n" should be used as terminator strings. If NewLine is set to vbNullString, the default newline character is used instead.

Read/Write.

See Also

Project CorLib Overview

Class TextWriter Overview


TextWriter: NewLine (let)

NewLine

Sets the line terminator string used by the current TextWriter.

 Public Property Let NewLine(
      ByVal Value As String ) :

Parameters

Value
[ByVal] String. The line terminator string for the current TextWriter.

Remarks

The default line terminator string is a carriage return followed by a line feed (vbCrLf).

The line terminator string is written to the text stream whenever one of the WriteLine methods is called. In order for text written by the TextWriter to be readable by a TextReader, only "\n" or "\r\n" should be used as terminator strings. If NewLine is set to vbNullString, the default newline character is used instead.

Read/Write.

See Also

Project CorLib Overview

Class TextWriter Overview


TextWriter: ToString

ToString

Returns a string representation of this instance.

 Public Function ToString ( ) As String

Return Values

String - A string representation of this instance.

See Also

Project CorLib Overview

Class TextWriter Overview


TextWriter: WriteChars

WriteChars

Writes the string representation of the characters to the stream using both the format provider and encoding objects.

 Public Sub WriteChars(
      ByRef Chars ( ) As Integer,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant )

Parameters

Chars
[ByRef] Integer. The characters to be written.
Index
[ByRef] Optional. Variant. The beginning index within the Chars array to begin writing to the stream.
Count
[ByRef] Optional. Variant. The number of characters to write to the stream.

Remarks

Both Index and Count must be excluded or included. Neither argument can be supplied individually.

See Also

Project CorLib Overview

Class TextWriter Overview


TextWriter: WriteLine

WriteLine

Writes the string representation of the value followed by a NewLine to the stream using both the format provider and encoding objects.

 Public Sub WriteLine(
      ParamArray Value ( ) As Variant )

Parameters

Value
[ByRef] Variant. The value to be written.

See Also

Project CorLib Overview

Class TextWriter Overview


TextWriter: WriteLineChars

WriteLineChars

Writes the string representation of the characters followed by a NewLine to the stream using both the format provider and encoding objects.

 Public Sub WriteLineChars(
      ByRef Chars ( ) As Integer,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant )

Parameters

Chars
[ByRef] Integer. The characters to be written.
Index
[ByRef] Optional. Variant. The beginning index within the Chars array to begin writing to the stream.
Count
[ByRef] Optional. Variant. The number of characters to write to the stream.

Remarks

Both Index and Count must be excluded or included. Neither argument can be supplied individually.

See Also

Project CorLib Overview

Class TextWriter Overview


TextWriter: WriteValue

WriteValue

Writes the string representation of the value to the stream using both the format provider and encoding objects.

 Public Sub WriteValue(
      ByRef Value As Variant,
      ParamArray Args ( ) As Variant )

Parameters

Value
[ByRef] Variant. The value to be written.
Args
[ByRef] Variant. Formatting arguments used in formating the Value.

See Also

Project CorLib Overview

Class TextWriter Overview


ThaiBuddhistCalendar

ThaiBuddhistCalendar

Provides methods for manipulating ThaiBuddhist dates.

Implements:

Calendar
ICloneable
IObject

Public:

Properties:

Name | Description
AlgorithmType (get) | Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.
Eras (get) | Returns an array of eras this calendar represents.
IsReadOnly (get) | Gets a value indicating whether this ThaiBuddhistCalendar object is read-only.
MaxSupportedDateTime (get) | Gets the latest date and time supported by the ThaiBuddhistCalendar class.
MinSupportedDateTime (get) | Gets the earliest date and time supported by the ThaiBuddhistCalendar class.
TwoDigitYearMax (get) | Gets the last year of a 100-year range that can be represented by a 2-digit year.
TwoDigitYearMax (let) | Gets the last year of a 100-year range that can be represented by a 2-digit year.

Methods:

Name | Description
AddDays | Returns a CorDateTime that is the specified number of days away from the specified CorDateTime.
AddHours | Returns a CorDateTime this is the specified number of hours from the original Time.
AddMilliseconds | Returns a CorDateTime this is the specified number of Milliseconds from the original Time.
AddMinutes | Returns a CorDateTime this is the specified number of Minutes from the original Time.
AddMonths | Returns a CorDateTime this is the specified number of Months from the original Time.
AddSeconds | Returns a CorDateTime this is the specified number of Seconds from the original Time.
AddWeeks | Returns a CorDateTime this is the specified number of Weeks from the original Time.
AddYears | Returns a CorDateTime this is the specified number of Years from the original Time.
Clone | Creates a new object that is a copy of the current ThaiBuddhistCalendar object.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetDayOfMonth | Returns the day of the months for the specified date.
GetDayOfWeek | Returns the DayOfWeek enum of the specified date.
GetDayOfYear | Returns the day of the year for the specified date.
GetDaysInMonth | Returns the number of days in the specified month.
GetDaysInYear | Returns the number of days in the specified year.
GetEra |
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetHour | Returns the hour of the specified time.
GetLeapMonth | Calculates the leap month for a specified year and era.
GetMilliseconds | Returns the milliseconds of the specified time.
GetMinute | Returns the minute of the specified time.
GetMonth | Returns the month of the specified time.
GetMonthsInYear | Returns the number of months in the specified year in the specified era.
GetSecond | Returns the second of the specified time.
GetWeekOfYear | Returns the week of the year that includes the date in the specified Date or CorDateTime.
GetYear | Returns the year of the specified time.
IsLeapDay | Returns a boolean indicating if the specific day is a leap day.
IsLeapMonth | Returns a boolean indicating if the specific month is a leap month.
IsLeapYear | Returns a boolean indicating if the specific year is a leap year.
ToDateTime | Returns a Gregorian CorDateTime computed using the specific calendar rules.
ToFourDigitYear | Converts the specified year to a four-digit year by using the TwoDigitYearMax property to determine the appropriate century.
ToString | Returns a string representation of this object instance.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview

ThaiBuddhistCalendarStatic

Calendar


ThaiBuddhistCalendar: AddDays

AddDays

Returns a CorDateTime that is the specified number of days away from the specified CorDateTime.

 Public Function AddDays(
      ByRef Time As Variant,
      ByVal Days As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to add days to.
Days
[ByVal] Long. The number of days to add.

Return Values

CorDateTime - The CorDateTime that results from adding the specified number of days to the specified CorDateTime.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: AddHours

AddHours

Returns a CorDateTime this is the specified number of hours from the original Time.

 Public Function AddHours(
      ByRef Time As Variant,
      ByVal Hours As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of hours to.
Hours
[ByVal] Long. The number of hours to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of hours added.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: AddMilliseconds

AddMilliseconds

Returns a CorDateTime this is the specified number of Milliseconds from the original Time.

 Public Function AddMilliseconds(
      ByRef Time As Variant,
      ByVal Milliseconds As Double ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Milliseconds to.
Milliseconds
[ByVal] Double. The number of Milliseconds to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Milliseconds added.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: AddMinutes

AddMinutes

Returns a CorDateTime this is the specified number of Minutes from the original Time.

 Public Function AddMinutes(
      ByRef Time As Variant,
      ByVal Minutes As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Minutes to.
Minutes
[ByVal] Long. The number of Minutes to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Minutes added.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: AddMonths

AddMonths

Returns a CorDateTime this is the specified number of Months from the original Time.

 Public Function AddMonths(
      ByRef Time As Variant,
      ByVal Months As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Months to.
Months
[ByVal] Long. The number of Months to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Months added.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: AddSeconds

AddSeconds

Returns a CorDateTime this is the specified number of Seconds from the original Time.

 Public Function AddSeconds(
      ByRef Time As Variant,
      ByVal Seconds As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Seconds to.
Seconds
[ByVal] Long. The number of Seconds to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Seconds added.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: AddWeeks

AddWeeks

Returns a CorDateTime this is the specified number of Weeks from the original Time.

 Public Function AddWeeks(
      ByRef Time As Variant,
      ByVal Weeks As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Weeks to.
Weeks
[ByVal] Long. The number of Weeks to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Weeks added.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: AddYears

AddYears

Returns a CorDateTime this is the specified number of Years from the original Time.

 Public Function AddYears(
      ByRef Time As Variant,
      ByVal Years As Long ) As CorDateTime

Parameters

Time
[ByRef] Variant. The time to add the specified number of Years to.
Years
[ByVal] Long. The number of Years to be added to Time. This can be negative.

Return Values

CorDateTime - Returns a CorDateTime with the specified number of Years added.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: AlgorithmType (get)

AlgorithmType

Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.

 Public Property Get AlgorithmType ( ) As CalendarAlgorithmType

Return Values

CalendarAlgorithmType - Always returns CalendarAlgorithmType.SolarCalendar.

Read Only.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: Calendar

Calendar

 Implements Calendar

Return Values

Calendar -

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: Clone

Clone

Creates a new object that is a copy of the current ThaiBuddhistCalendar object.

 Public Function Clone ( ) As ThaiBuddhistCalendar

Return Values

ThaiBuddhistCalendar - A copy of the ThaiBuddhistCalendar object.

Remarks

The clone will always be a non-readonly version.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: Eras (get)

Eras

Returns an array of eras this calendar represents.

 Public Property Get Eras ( ) As Long ( )

Return Values

Long() - An array of eras.

Remarks

The calendar only recognizes the current era. The array only contains one element.

Read Only.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: GetDayOfMonth

GetDayOfMonth

Returns the day of the months for the specified date.

 Public Function GetDayOfMonth(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The date inwhich to retrieve the day of the month.

Return Values

Long - An integer from 1 to 31 that represents the day of the month in the specified Date or CorDateTime.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: GetDayOfWeek

GetDayOfWeek

Returns the DayOfWeek enum of the specified date.

 Public Function GetDayOfWeek(
      ByRef Time As Variant ) As DayOfWeek

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to read the day of the week from.

Return Values

DayOfWeek - A DayOfWeek enum representing the day of the week.

Remarks

The DayOfWeek is Sunday and is 0-based. The Visual Basic enum vbDayOfWeek is 1-based.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: GetDayOfYear

GetDayOfYear

Returns the day of the year for the specified date.

 Public Function GetDayOfYear(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to read the day of the year from.

Return Values

Long - An integer from 1 to 366 that represents the day of the year in the specified Date or CorDateTime.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: GetDaysInMonth

GetDaysInMonth

Returns the number of days in the specified month.

 Public Function GetDaysInMonth(
      ByVal Year As Long,
      ByVal Month As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year inwhich the month exists. This is used by calendars that have months that change based on the year, such as leap years.
Month
[ByVal] Long. The month to retrieve the number of days of.
Era
[ByRef] Optional. Variant. The time period inwhich the year exists.

Return Values

Long -

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: GetDaysInYear

GetDaysInYear

Returns the number of days in the specified year.

 Public Function GetDaysInYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. The year to retrieve the number of days of.
Era
[ByRef] Optional. Variant. The era the year exists in.

Return Values

Long - The number of days in the year.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: GetHour

GetHour

Returns the hour of the specified time.

 Public Function GetHour(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the hour from.

Return Values

Long - The hour portion of the time.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: GetLeapMonth

GetLeapMonth

Calculates the leap month for a specified year and era.

 Public Function GetLeapMonth(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. A year.
Era
[ByRef] Optional. Variant. An era.

Return Values

Long - Always 0 because the ThaiBuddhistCalendar calendar does not recognize leap months.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: GetMilliseconds

GetMilliseconds

Returns the milliseconds of the specified time.

 Public Function GetMilliseconds(
      ByRef Time As Variant ) As Double

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the milliseconds from.

Return Values

Double - The millisecond portion of the time.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: GetMinute

GetMinute

Returns the minute of the specified time.

 Public Function GetMinute(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the minute from.

Return Values

Long - The minute portion of the time.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: GetMonth

GetMonth

Returns the month of the specified time.

 Public Function GetMonth(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the month from.

Return Values

Long - The month portion of the time.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: GetMonthsInYear

GetMonthsInYear

Returns the number of months in the specified year in the specified era.

 Public Function GetMonthsInYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Long

Parameters

Year
[ByVal] Long. An integer that represents the year.
Era
[ByRef] Optional. Variant. An integer that represents the era.

Return Values

Long - The number of months in the specified year in the specified era.

Remarks

This calendar will always return 12.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: GetSecond

GetSecond

Returns the second of the specified time.

 Public Function GetSecond(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to retrieve the second from.

Return Values

Long - The second portion of the time.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: GetWeekOfYear

GetWeekOfYear

Returns the week of the year that includes the date in the specified Date or CorDateTime.

 Public Function GetWeekOfYear(
      ByRef Time As Variant,
      ByVal Rule As CalendarWeekRule,
      ByVal FirstDayOfWeek As DayOfWeek ) As Long

Parameters

Time
[ByRef] Variant. The Date or CorDateTime to read.
Rule
[ByVal] CalendarWeekRule. One of the CalendarWeekRule values that defines a calendar week.
FirstDayOfWeek
[ByVal] DayOfWeek. One of the DayOfWeek values that represents the first day of the week.

Return Values

Long - A 1-based positive integer that represents the week of the year that includes the date in the time parameter.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: GetYear

GetYear

Returns the year of the specified time.

 Public Function GetYear(
      ByRef Time As Variant ) As Long

Parameters

Time
[ByRef] Variant. The time to retrieve the year from.

Return Values

Long - The year portion of the time.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: IsLeapDay

IsLeapDay

Returns a boolean indicating if the specific day is a leap day.

 Public Function IsLeapDay(
      ByVal Year As Long,
      ByVal Month As Long,
      ByVal Day As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year the day is in.
Month
[ByVal] Long. The month the day is in.
Day
[ByVal] Long. The day to check if is a leap day.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the day is a leap day.

Remarks

A leap day only exists in a leap year, such as February 29th in the ThaiBuddhist calendar.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: IsLeapMonth

IsLeapMonth

Returns a boolean indicating if the specific month is a leap month.

 Public Function IsLeapMonth(
      ByVal Year As Long,
      ByVal Month As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year the month is in.
Month
[ByVal] Long. The month to check if it is a leap month.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the month is a leap month.

Remarks

A leap month only exists in a leap year, such as Adar II in the Hebrew calendar. This always returns False.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: IsLeapYear

IsLeapYear

Returns a boolean indicating if the specific year is a leap year.

 Public Function IsLeapYear(
      ByVal Year As Long,
      Optional ByRef Era As Variant ) As Boolean

Parameters

Year
[ByVal] Long. The year to check if is a leap year.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

Boolean - Boolean indication if the year is a leap year.

Remarks

A leap year in the Korean calendar occurs when the year is evenly divisible by 4, but not by 100, unless it is divisible by 400.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: IsReadOnly (get)

IsReadOnly

Gets a value indicating whether this ThaiBuddhistCalendar object is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - True if this ThaiBuddhistCalendar object is read-only; otherwise, False.

Read Only.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: MaxSupportedDateTime (get)

MaxSupportedDateTime

Gets the latest date and time supported by the ThaiBuddhistCalendar class.

 Public Property Get MaxSupportedDateTime ( ) As CorDateTime

Return Values

CorDateTime - The latest date and time supported by the ThaiBuddhistCalendar class, which is equivalent to the last moment of December 31, 9999 C.E. in the Gregorian calendar.

Read Only.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: MinSupportedDateTime (get)

MinSupportedDateTime

Gets the earliest date and time supported by the ThaiBuddhistCalendar class.

 Public Property Get MinSupportedDateTime ( ) As CorDateTime

Return Values

CorDateTime - The earliest date and time supported by the ThaiBuddhistCalendar class, which is equivalent to the first moment of January 1, 0001 C.E. in the Gregorian calendar.

Read Only.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: ToDateTime

ToDateTime

Returns a Gregorian CorDateTime computed using the specific calendar rules.

 Public Function ToDateTime(
      ByVal Year As Long,
      ByVal Month As Long,
      ByVal Day As Long,
      ByVal Hour As Long,
      ByVal Minute As Long,
      ByVal Second As Long,
      ByVal Millisecond As Long,
      Optional ByRef Era As Variant ) As CorDateTime

Parameters

Year
[ByVal] Long. The Year in the specific calendar type.
Month
[ByVal] Long. The Month in the specific calendar type.
Day
[ByVal] Long. The Day in the specific calendar type.
Hour
[ByVal] Long. The hour for the new time.
Minute
[ByVal] Long. The minute for the new time.
Second
[ByVal] Long. The second for the new time.
Millisecond
[ByVal] Long. The milliseconds for the new time.
Era
[ByRef] Optional. Variant. The era the year is in.

Return Values

CorDateTime - A Gregorian version of the date specified.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: ToFourDigitYear

ToFourDigitYear

Converts the specified year to a four-digit year by using the TwoDigitYearMax property to determine the appropriate century.

 Public Function ToFourDigitYear(
      ByVal Year As Long ) As Long

Parameters

Year
[ByVal] Long. A two-digit or four-digit integer that represents the year to convert.

Return Values

Long - An integer that contains the four-digit representation of year.

Remarks

TwoDigitYearMax is the last year in the 100-year range that can be represented by a two-digit year. The century is determined by finding the sole occurrence of the two-digit year within that 100-year range. For example, if TwoDigitYearMax is set to 2029, the 100-year range is from 1930 to 2029. Therefore, a 2-digit value of 30 is interpreted as 1930, while a 2-digit value of 29 is interpreted as 2029.

ToFourDigitYear supports either a two-digit year or a four-digit year. Passing a two-digit year value (less than 100) causes the method to convert the value to a four-digit value according to the TwoDigitYearMax value representing the appropriate century. If the application supplies a four-digit year value that is within the supported calendar range to ToFourDigitYear, the method returns the actual input value. If the application supplies a four-digit value that is outside the supported calendar range, or if it supplies a negative value, the method throws an exception.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: TwoDigitYearMax (get)

TwoDigitYearMax

Gets the last year of a 100-year range that can be represented by a 2-digit year.

 Public Property Get TwoDigitYearMax ( ) As Long

Return Values

Long - The last year of a 100-year range that can be represented by a 2-digit year.

Remarks

This property allows a 2-digit year to be properly translated to a 4-digit year. For example, in the Gregorian calendar, if this property is set to 2029, the 100-year range is from 1930 to 2029. Therefore, a 2-digit value of 30 is interpreted as 1930, while a 2-digit value of 29 is interpreted as 2029.

The initial value of this property is derived from the settings in the regional and language options portion of Control Panel. However, that information can change during the life of the application. The ThaiBuddhistCalendar class does not detect changes in the system settings automatically.

The application should set this value to 99 to indicate that 2-digit years are to be taken literally. For example, if this property is set to 99, the 100-year range is from 0 (not a valid value for most calendars) to 99. Therefore, a 2-digit value of 30 is interpreted as 30.

Read/Write.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendar: TwoDigitYearMax (let)

TwoDigitYearMax

Gets the last year of a 100-year range that can be represented by a 2-digit year.

 Public Property Let TwoDigitYearMax(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The last year of a 100-year range that can be represented by a 2-digit year.

Remarks

Exception | Condition
ArgumentOutOfRangeException | The value specified in a set operation is less than 99 or greater than 10542.
InvalidOperationException | In a set operation, the current instance is read-only.

This property allows a 2-digit year to be properly translated to a 4-digit year. For example, in the Gregorian calendar, if this property is set to 2029, the 100-year range is from 1930 to 2029. Therefore, a 2-digit value of 30 is interpreted as 1930, while a 2-digit value of 29 is interpreted as 2029.

The initial value of this property is derived from the settings in the regional and language options portion of Control Panel. However, that information can change during the life of the application. The ThaiBuddhistCalendar class does not detect changes in the system settings automatically.

The application should set this value to 99 to indicate that 2-digit years are to be taken literally. For example, if this property is set to 99, the 100-year range is from 0 (not a valid value for most calendars) to 99. Therefore, a 2-digit value of 30 is interpreted as 30.

Read/Write.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendar Overview


ThaiBuddhistCalendarStatic

ThaiBuddhistCalendarStatic

Provides static methods of the ThaiBuddhistCalendar class.

Public:

Properties:

Name | Description
ThaiBuddhistEra (get) | Returns the current era of the ThaiBuddhist calendar.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendarStatic Overview

ThaiBuddhistCalendar


ThaiBuddhistCalendarStatic: ThaiBuddhistEra (get)

ThaiBuddhistEra

Returns the current era of the ThaiBuddhist calendar.

 Public Property Get ThaiBuddhistEra ( ) As Long

Return Values

Long - Returns a constant of 1.

Read Only.

See Also

Project CorLib Overview

Class ThaiBuddhistCalendarStatic Overview


Thread

Thread

Creates and controls a thread, sets its priority, and gets its status.

Public:

Properties:

Name | Description
CurrentCulture (get) | Gets the culture for the current thread.
CurrentCulture (set) | Sets the culture for the current thread.

See Also

Project CorLib Overview

Class Thread Overview


Thread: CurrentCulture (get)

CurrentCulture

Gets the culture for the current thread.

 Public Property Get CurrentCulture ( ) As CultureInfo

Return Values

CultureInfo - An object that represents the culture for the current thread.

Remarks

The CultureInfo object that is returned by this property, together with its associated objects, determine the default format for dates, times, numbers, and currency values.

Read/Write.

See Also

Project CorLib Overview

Class Thread Overview


Thread: CurrentCulture (set)

CurrentCulture

Sets the culture for the current thread.

 Public Property Set CurrentCulture(
      ByVal Value As CultureInfo )

Parameters

Value
[ByVal] CultureInfo. An object that represents the culture for the current thread.

Remarks

The CultureInfo object that is returned by this property, together with its associated objects, determine the default format for dates, times, numbers, and currency values.

Exceptions

Exception | Condition
ArgumentNullException | The property is set to Nothing.

Read/Write.

See Also

Project CorLib Overview

Class Thread Overview


ThreadStatic

ThreadStatic

Gets the currently running thread.

Public:

Properties:

Name | Description
CurrentThread (get) |

See Also

Project CorLib Overview

Class ThreadStatic Overview


Ticker

Ticker

Provides a recurring timer event.

Implements:

IObject

Public:

Properties:

Name | Description
AutoReset (get) | Returns if the Ticker event will be recurring.
AutoReset (let) | Sets if the Ticker event will be recurring or not.
Data (get) | Returns custom data associated with this Ticker instance.
Data (let) | Sets custom data associated with this Ticker instance.
Data (set) | Sets custom data associated with this Ticker instance.
Enabled (get) | Returns if the Ticker is currently running.
Enabled (let) | Sets the Ticker to be stopped or running.
Interval (get) | Returns the duration between Ticker events in milliseconds.
Interval (let) | Sets the duration between Ticker events in milliseconds.

Methods:

Name | Description
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetHashCode | Returns a pseudo-unique number identifying this instance.
StartTicker | Starts the Ticker.
StopTicker | Stops the Ticker if it is running.
ToString | Returns a string representation of this object instance.

Events:

Name | Description
Elapsed | This event is raised when the Ticker interval has been reached.

Remarks

To create new Ticker using the constructor, call the NewTicker method.

 Private WithEvents mTicker As Ticker

 Private Sub Class_Initialize()
     Set mTicker = NewTicker(2000)
     mTicker.StartTicker
 End Sub

 Private Sub mTicker_Elapsed()
     ' occurs every 2000 milliseconds (2 seconds.)
 End Sub
The Ticker can also use a callback function when the time has elapsed instead of only raising an event. The event is still raised, however, a callback function is called as well.
 Private mTicker As Ticker  ' declared without using WithEvents

 Private Sub Main()
     Set mTicker = NewTicker(2000,,, AddressOf TimerCallback)
     mTicker.StartTicker

     ' Application Code
 End Sub

 Private Sub TickerCallback(ByRef Ticker As Ticker, ByRef Data As Variant)
     ' occurs every 2000 milliseconds (2 seconds.)
 End Sub

See Also

Project CorLib Overview

Class Ticker Overview

Constructors


Ticker: AutoReset (get)

AutoReset

Returns if the Ticker event will be recurring.

 Public Property Get AutoReset ( ) As Boolean

Return Values

Boolean - AutoReset flag.

Remarks

If AutoReset is set to false, then the Ticker event will happen only once. The Ticker will need to be restarted for another event to occur.

The default is True.

Read/Write.

See Also

Project CorLib Overview

Class Ticker Overview


Ticker: AutoReset (let)

AutoReset

Sets if the Ticker event will be recurring or not.

 Public Property Let AutoReset(
      ByVal Value As Boolean )

Parameters

Value
[ByVal] Boolean. Flag indicating if the Ticker will be recurring.

Remarks

If AutoReset is set to false, then the Ticker event will happen only once. The Ticker will need to be restarted for another event to occur.

The default is True.

Read/Write.

See Also

Project CorLib Overview

Class Ticker Overview


Ticker: Data (get)

Data

Returns custom data associated with this Ticker instance.

 Public Property Get Data ( ) As Variant

Return Values

Variant - Custom data.

Remarks

The data is not used by the Ticker. It is to allow a developer to associate values to the Ticker if needed.

Read/Write.

See Also

Project CorLib Overview

Class Ticker Overview


Ticker: Data (let)

Data

Sets custom data associated with this Ticker instance.

 Public Property Let Data(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. The data to associate with this Ticker instance.

Remarks

The data is not used by the Ticker. It is to allow a developer to associate values to the Ticker if needed.

Read/Write.

See Also

Project CorLib Overview

Class Ticker Overview


Ticker: Data (set)

Data

Sets custom data associated with this Ticker instance.

 Public Property Set Data(
      ByRef Value As Variant )

Parameters

Value
[ByRef] Variant. The data to associate with this Ticker instance.

Remarks

The data is not used by the Ticker. It is to allow a developer to associate values to the Ticker if needed.

Read/Write.

See Also

Project CorLib Overview

Class Ticker Overview


Ticker: Elapsed

Elapsed

This event is raised when the Ticker interval has been reached.

 Public Event Elapsed(
      ByRef Data As Variant )

Parameters

Data
[ByRef] Variant. A user-defined value associated with the Ticker.

See Also

Project CorLib Overview

Class Ticker Overview


Ticker: Enabled (get)

Enabled

Returns if the Ticker is currently running.

 Public Property Get Enabled ( ) As Boolean

Return Values

Boolean - If the Ticker is running.

Read/Write.

See Also

Project CorLib Overview

Class Ticker Overview


Ticker: Enabled (let)

Enabled

Sets the Ticker to be stopped or running.

 Public Property Let Enabled(
      ByVal Value As Boolean )

Parameters

Value
[ByVal] Boolean. Value indicating if the Ticker is stopped or running.

Remarks

If setting Enabled to True and the Ticker is already running, then the Ticker will be stopped and restarted.

Read/Write.

See Also

Project CorLib Overview

Class Ticker Overview


Ticker: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class Ticker Overview


Ticker: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class Ticker Overview


Ticker: Interval (get)

Interval

Returns the duration between Ticker events in milliseconds.

 Public Property Get Interval ( ) As Long

Return Values

Long - Duration between events in milliseconds

Remarks

If the Ticker is already running, it will be reset and begin a new duration with the new interval.

Read/Write.

See Also

Project CorLib Overview

Class Ticker Overview


Ticker: Interval (let)

Interval

Sets the duration between Ticker events in milliseconds.

 Public Property Let Interval(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. Duration between events in milliseconds.

Remarks

If the Ticker is already running, it will be reset and begin a new duration with the new interval.

Read/Write.

See Also

Project CorLib Overview

Class Ticker Overview


Ticker: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class Ticker Overview


Ticker: StartTicker

StartTicker

Starts the Ticker.

 Public Sub StartTicker ( )

Remarks

If the Ticker is already running, it will be stopped and restarted. A new full interval will be elapsed before the next event occurs.

See Also

Project CorLib Overview

Class Ticker Overview


Ticker: StopTicker

StopTicker

Stops the Ticker if it is running.

 Public Sub StopTicker ( )

See Also

Project CorLib Overview

Class Ticker Overview


Ticker: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class Ticker Overview


TimeSpan

TimeSpan

This class represents an amount of time.

Implements:

IComparable
IFormattable
IObject

Public:

Properties:

Name | Description
Days (get) | Returns the Days portion of the duration.
Hours (get) | Returns the Hours portion of the duration.
Milliseconds (get) | Returns the Milliseconds portion of the duration.
Minutes (get) | Returns the Minutes portion of the duration.
Seconds (get) | Returns the Seconds portion of the duration.
Ticks (get) | Returns the duration in ticks.
TotalDays (get) | Returns the duration of this instance in days.
TotalHours (get) | Returns the duration of this instance in hours.
TotalMilliseconds (get) | Returns the duration of this instance in milliseconds.
TotalMinutes (get) | Returns the duration of this instance in minutes.
TotalSeconds (get) | Returns the duration of this instance in seconds.

Methods:

Name | Description
Add | Adds a timespan to this instance.
CompareTo | Compares this TimeSpan with another timespan.
Duration | Returns the absolute value of this instance.
Equals | Returns a boolean indicating if the value and this TimeSpan instance are the same value.
GetHashCode | Returns a pseudo-unique number identifying this instance.
Negate | Returns a TimeSpan with the opposite sign of this instance.
Subtract | Subtracts a timespan from this instance.
ToString | Converts the value of the current TimeSpan object to its equivalent string representation by using the specified format and culture-specific formatting information.

Remarks

The time is represented internally in milliseconds, with a fractional portion to represent ticks. A tick is defined as 100 nanoseconds, or 1/10000 of a millisecond. TimeSpans are displayed in a [-][d.]hh:mm:ss[.ff] format. Bracketed fields are only displayed if they are not zero. A negative sign is displayed if the timespan is negative.

See Also

Project CorLib Overview

Class TimeSpan Overview

Constructors

TimeSpanStatic

CorDateTime


TimeSpan: Add

Add

Adds a timespan to this instance.

 Public Function Add(
      ByRef ts As TimeSpan ) As TimeSpan

Parameters

ts
[ByRef] TimeSpan. TimeSpan to be added.

Return Values

TimeSpan - A TimeSpan that represents the sum of the two timespans.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: CompareTo

CompareTo

Compares this TimeSpan with another timespan.

 Public Function CompareTo(
      ByRef Value As TimeSpan ) As Long

Parameters

Value
[ByRef] TimeSpan. The TimeSpan to compare this instance against.

Return Values

Long - Value indicating the relation between the two timespans.

Remarks

The return value indicates how the two timespans are in relation to eachother.
1 = This instance is greater than the passed in timespan.
0 = This instance is equal to the passed in timespan.
-1 = This instance is less than the passed in timespan.

If Nothing is passed in 1 is returned.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: Days (get)

Days

Returns the Days portion of the duration.

 Public Property Get Days ( ) As Long

Return Values

Long - The Days portion of the duration.

Remarks

This does not represent the entire duration of the timespan, only the specified portion of it.

Read Only.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: Duration

Duration

Returns the absolute value of this instance.

 Public Function Duration ( ) As TimeSpan

Return Values

TimeSpan - TimeSpan that represents the absolute value of the original TimeSpan.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: Equals

Equals

Returns a boolean indicating if the value and this TimeSpan instance are the same value.

 Public Function Equals(
      ByRef Value As TimeSpan ) As Boolean

Parameters

Value
[ByRef] TimeSpan. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: Hours (get)

Hours

Returns the Hours portion of the duration.

 Public Property Get Hours ( ) As Long

Return Values

Long - The Hours portion of the duration.

Remarks

This does not represent the entire duration of the timespan, only the specified portion of it.

Read Only.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: IComparable

IComparable

 Implements IComparable

Return Values

IComparable -

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: IFormattable

IFormattable

 Implements IFormattable

Return Values

IFormattable -

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: Milliseconds (get)

Milliseconds

Returns the Milliseconds portion of the duration.

 Public Property Get Milliseconds ( ) As Long

Return Values

Long - The Milliseconds portion of the duration.

Remarks

This does not represent the entire duration of the timespan, only the specified portion of it.

Read Only.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: Minutes (get)

Minutes

Returns the Minutes portion of the duration.

 Public Property Get Minutes ( ) As Long

Return Values

Long - The Minutes portion of the duration.

Remarks

This does not represent the entire duration of the timespan, only the specified portion of it.

Read Only.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: Negate

Negate

Returns a TimeSpan with the opposite sign of this instance.

 Public Function Negate ( ) As TimeSpan

Return Values

TimeSpan - The timespan with the opposite sign as this duration.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: Seconds (get)

Seconds

Returns the Seconds portion of the duration.

 Public Property Get Seconds ( ) As Long

Return Values

Long - The Seconds portion of the duration.

Remarks

This does not represent the entire duration of the timespan, only the specified portion of it.

Read Only.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: Subtract

Subtract

Subtracts a timespan from this instance.

 Public Function Subtract(
      ByRef ts As TimeSpan ) As TimeSpan

Parameters

ts
[ByRef] TimeSpan. TimeSpan to be subtracted.

Return Values

TimeSpan - TimeSpan with the subtracted value.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: Ticks (get)

Ticks

Returns the duration in ticks.

 Public Property Get Ticks ( ) As Variant

Return Values

Variant - The duration in ticks

Remarks

A tick is defined as 100 nanoseconds, or 1/10000 of a millisecond.

Read Only.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: ToString

ToString

Converts the value of the current TimeSpan object to its equivalent string representation by using the specified format and culture-specific formatting information.

 Public Function ToString(
      Optional ByRef Format As String,
      Optional ByVal FormatProvider As IFormatProvider ) As String

Parameters

Format
[ByRef] Optional. String. A standard or custom TimeSpan format string.
FormatProvider
[ByVal] Optional. IFormatProvider. An object that supplies culture-specific formatting information.

Return Values

String - The string representation of the current TimeSpan value, as specified by Format and FormatProvider.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: TotalDays (get)

TotalDays

Returns the duration of this instance in days.

 Public Property Get TotalDays ( ) As Double

Return Values

Double - This timespan in days.

Remarks

The returned duration can contain a fractional part if necessary to represent the duration.

Read Only.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: TotalHours (get)

TotalHours

Returns the duration of this instance in hours.

 Public Property Get TotalHours ( ) As Double

Return Values

Double - This timespan in hours.

Read Only.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: TotalMilliseconds (get)

TotalMilliseconds

Returns the duration of this instance in milliseconds.

 Public Property Get TotalMilliseconds ( ) As Currency

Return Values

Currency - This timespan in milliseconds.

Remarks

The returned duration can contain a fractional part if necessary to represent the duration.

Read Only.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: TotalMinutes (get)

TotalMinutes

Returns the duration of this instance in minutes.

 Public Property Get TotalMinutes ( ) As Double

Return Values

Double - This timespan in minutes.

Remarks

The returned duration can contain a fractional part if necessary to represent the duration.

Read Only.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpan: TotalSeconds (get)

TotalSeconds

Returns the duration of this instance in seconds.

 Public Property Get TotalSeconds ( ) As Double

Return Values

Double - This timespan in seconds.

Remarks

The returned duration can contain a fractional part if necessary to represent the duration.

Read Only.

See Also

Project CorLib Overview

Class TimeSpan Overview


TimeSpanStatic

TimeSpanStatic

Provides severs static functions to help in creating TimeSpan objects.

Public:

Properties:

Name | Description
MaxValue (get) | Gets a TimeSpan with a maximum value.
MinValue (get) | Gets a TimeSpan with a minimum value.
Zero (get) | Gets a TimeSpan with a value of zero.

Methods:

Name | Description
Add | Returns a new TimeSpan object whose value is the sum of two TimeSpan objects.
Compare | Compares two TimeSpan values and returns an integer that indicates whether the first value is shorter than, equal to, or longer than the second value.
Equals | Returns a boolean indicating if the Left TimeSpan instance is equal to the Right instance.
FromDate | Returns a TimeSpan object representing the time of day of the date.
FromDays | Returns a TimeSpan that represents a specified time, where the specification is in units of days.
FromHours | Returns a TimeSpan that represents a specified time, where the specification is in units of hours.
FromMilliseconds | Returns a TimeSpan that represents a specified time, where the specification is in units of milliseconds.
FromMinutes | Returns a TimeSpan that represents a specified time, where the specification is in units of minutes.
FromSeconds | Returns a TimeSpan that represents a specified time, where the specification is in units of seconds.
FromTicks | Returns a TimeSpan that represents a specified time, where the specification is in units of ticks.
GreaterThan | Returns a boolean indicating if the Left TimeSpan instance is greater-than the Right instance.
LessThan | Returns a boolean indicating if the Left TimeSpan instance is less-than the Right instance.
Parse | Parses a string in the format of [d.]h:mm:ss[.ff] into a TimeSpan.
Subtract | Returns a new TimeSpan object whose value is the difference between the two TimeSpan objects.
ToString | Converts the value of the current TimeSpan object to its equivalent string representation by using the specified format and culture-specific formatting information.
TryParse | Attempts to parse the string into a TimeSpan object.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview

TimeSpan


TimeSpanStatic: Add

Add

Returns a new TimeSpan object whose value is the sum of two TimeSpan objects.

 Public Function Add(
      ByRef Left As TimeSpan,
      ByRef Right As TimeSpan ) As TimeSpan

Parameters

Left
[ByRef] TimeSpan. The time interval to be added to.
Right
[ByRef] TimeSpan. The time interval to add.

Return Values

TimeSpan - A new object that represents the value of Left plus the value of Right.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeSpanStatic: Compare

Compare

Compares two TimeSpan values and returns an integer that indicates whether the first value is shorter than, equal to, or longer than the second value.

 Public Function Compare(
      ByRef t1 As TimeSpan,
      ByRef t2 As TimeSpan ) As Long

Parameters

t1
[ByRef] TimeSpan. The first time interval to compare.
t2
[ByRef] TimeSpan. The second time interval to compare.

Return Values

Long - One of the following values.
Value | Description
-1 | t1 is shorter than t2.
0 | t1 is equal to t2.
1 | t1 is longer than t2.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeSpanStatic: Equals

Equals

Returns a boolean indicating if the Left TimeSpan instance is equal to the Right instance.

 Public Function Equals(
      ByRef Left As TimeSpan,
      ByRef Right As TimeSpan ) As Boolean

Parameters

Left
[ByRef] TimeSpan. The TimeSpan on the left-hand side of the equality.
Right
[ByRef] TimeSpan. The TimeSpan on the right-hand side of the equality.

Return Values

Boolean - Returns True if the Left instance is equal to the Right instance, False otherwise.

Remarks

This method will treat a value of Nothing as zero.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeSpanStatic: FromDate

FromDate

Returns a TimeSpan object representing the time of day of the date.

 Public Function FromDate(
      ByRef Value As Variant ) As TimeSpan

Parameters

Value
[ByRef] Variant. The date to retrieve the time-of-day from.

Return Values

TimeSpan - An object representing the time-of-day.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeSpanStatic: FromDays

FromDays

Returns a TimeSpan that represents a specified time, where the specification is in units of days.

 Public Function FromDays(
      ByVal Value As Double ) As TimeSpan

Parameters

Value
[ByVal] Double. The number of days the TimeSpan will represent.

Return Values

TimeSpan - An object that represents Value.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeSpanStatic: FromHours

FromHours

Returns a TimeSpan that represents a specified time, where the specification is in units of hours.

 Public Function FromHours(
      ByVal Value As Double ) As TimeSpan

Parameters

Value
[ByVal] Double. The number of hours the TimeSpan will represent.

Return Values

TimeSpan - An object that represents Value.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeSpanStatic: FromMilliseconds

FromMilliseconds

Returns a TimeSpan that represents a specified time, where the specification is in units of milliseconds.

 Public Function FromMilliseconds(
      ByVal Value As Currency ) As TimeSpan

Parameters

Value
[ByVal] Currency. The number of milliseconds the TimeSpan will represent.

Return Values

TimeSpan - An object that represents Value.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeSpanStatic: FromMinutes

FromMinutes

Returns a TimeSpan that represents a specified time, where the specification is in units of minutes.

 Public Function FromMinutes(
      ByVal Value As Double ) As TimeSpan

Parameters

Value
[ByVal] Double. The number of minutes the TimeSpan will represent.

Return Values

TimeSpan - An object that represents Value.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeSpanStatic: FromSeconds

FromSeconds

Returns a TimeSpan that represents a specified time, where the specification is in units of seconds.

 Public Function FromSeconds(
      ByVal Value As Double ) As TimeSpan

Parameters

Value
[ByVal] Double. The number of seconds the TimeSpan will represent.

Return Values

TimeSpan - An object that represents Value.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeSpanStatic: FromTicks

FromTicks

Returns a TimeSpan that represents a specified time, where the specification is in units of ticks.

 Public Function FromTicks(
      ByRef Value As Variant ) As TimeSpan

Parameters

Value
[ByRef] Variant. The number of ticks the TimeSpan will represent.

Return Values

TimeSpan - An object that represents Value.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeSpanStatic: GreaterThan

GreaterThan

Returns a boolean indicating if the Left TimeSpan instance is greater-than the Right instance.

 Public Function GreaterThan(
      ByRef Left As TimeSpan,
      ByRef Right As TimeSpan ) As Boolean

Parameters

Left
[ByRef] TimeSpan. The TimeSpan on the left-hand side of the equality.
Right
[ByRef] TimeSpan. The TimeSpan on the right-hand side of the equality.

Return Values

Boolean - Returns True if the Left instance is greater-than the Right instance, False otherwise.

Remarks

This method will treat a value of Nothing as zero.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeSpanStatic: LessThan

LessThan

Returns a boolean indicating if the Left TimeSpan instance is less-than the Right instance.

 Public Function LessThan(
      ByRef Left As TimeSpan,
      ByRef Right As TimeSpan ) As Boolean

Parameters

Left
[ByRef] TimeSpan. The TimeSpan on the left-hand side of the equality.
Right
[ByRef] TimeSpan. The TimeSpan on the right-hand side of the equality.

Return Values

Boolean - Returns True if the Left instance is less-than the Right instance, False otherwise.

Remarks

This method will treat a value of Nothing as zero.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeSpanStatic: MaxValue (get)

MaxValue

Gets a TimeSpan with a maximum value.

 Public Property Get MaxValue ( ) As TimeSpan

Return Values

TimeSpan -

Remarks

The value of this field is equivalent to the maximum Currency milliseconds. The string representation of this value is positive 10675199.02:48:05.4775807, or slightly more than 10,675,199 days.

Read Only.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeSpanStatic: MinValue (get)

MinValue

Gets a TimeSpan with a minimum value.

 Public Property Get MinValue ( ) As TimeSpan

Return Values

TimeSpan -

Remarks

The value of this field is equivalent to the minimum Currency milliseconds. The string representation of this value is negative 10675199.02:48:05.4775808, or slightly more than negative 10,675,199 days.

Read Only.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeSpanStatic: Parse

Parse

Parses a string in the format of [d.]h:mm:ss[.ff] into a TimeSpan.

 Public Function Parse(
      ByVal s As String ) As TimeSpan

Parameters

s
[ByVal] String. A string containing the date to be parsed.

Return Values

TimeSpan - A TimeSpan created from the parsed string.

Remarks

This method will throw a FormatException exception if the string cannot be successfully parsed.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeSpanStatic: Subtract

Subtract

Returns a new TimeSpan object whose value is the difference between the two TimeSpan objects.

 Public Function Subtract(
      ByRef Left As TimeSpan,
      ByRef Right As TimeSpan ) As TimeSpan

Parameters

Left
[ByRef] TimeSpan. The time interval to subtract from.
Right
[ByRef] TimeSpan. The time interval to be subracted.

Return Values

TimeSpan - A new time interval whose value is the result of the value of Left minus the value of Right.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeSpanStatic: ToString

ToString

Converts the value of the current TimeSpan object to its equivalent string representation by using the specified format and culture-specific formatting information.

 Public Function ToString(
      ByVal ts As TimeSpan,
      Optional ByRef Format As String,
      Optional ByVal FormatProvider As IFormatProvider ) As String

Parameters

ts
[ByVal] TimeSpan. The TimeSpan to be converted to a string.
Format
[ByRef] Optional. String. A standard or custom TimeSpan format string.
FormatProvider
[ByVal] Optional. IFormatProvider. An object that supplies culture-specific formatting information.

Return Values

String - The string representation of the current TimeSpan value, as specified by Format and FormatProvider.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeSpanStatic: TryParse

TryParse

Attempts to parse the string into a TimeSpan object.

 Public Function TryParse(
      ByRef s As String,
      ByRef Result As TimeSpan ) As Boolean

Parameters

s
[ByRef] String. A string that specifies the time interval to convert.
Result
[ByRef] TimeSpan. When this method returns, contains an object that represents the time interval specified by s, or TimeSpan.Zero if the conversion failed.

Return Values

Boolean - True if s was converted successfully; otherwise, False. This operation returns false if the s parameter empty, has an invalid format, represents a time interval that is less than TimeSpan.MinValue or greater than TimeSpan.MaxValue, or has at least one days, hours, minutes, or seconds component outside its valid range.

Remarks

The TryParse method is like the TimeSpan.Parse(String) method, except that it does not throw an exception if the conversion fails.

The s parameter contains a time interval specification in the form:

[ws][-]{ d | d.hh:mm[:ss[.ff]] | hh:mm[:ss[.ff]] }[ws]

Elements in square brackets ([ and ]) are optional. One selection from the list of alternatives enclosed in braces ({ and }) and separated by vertical bars (|) is required. The following table describes each element.

Element | Description
ws | Optional white space.
- | An optional minus sign, which indicates a negative TimeSpan.
d | Days, ranging from 0 to 10675199.
. | A culture-sensitive symbol that separates days from hours. The invariant format uses a period (".") character.
hh | Hours, ranging from 0 to 23.
: | The culture-sensitive time separator symbol. The invariant format uses a colon (":") character.
mm | Minutes, ranging from 0 to 59.
ss | Optional seconds, ranging from 0 to 59.
. | A culture-sensitive symbol that separates seconds from fractions of a second. The invariant format uses a period (".") character.
ff | Optional fractional seconds, consisting of one to seven decimal digits.

The components of s must collectively specify a time interval that is greater than or equal to TimeSpan.MinValue and less than or equal to TimeSpan.MaxValue.

The Parse(String) method tries to parse s by using each of the culture-specific formats for the current culture.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeSpanStatic: Zero (get)

Zero

Gets a TimeSpan with a value of zero.

 Public Property Get Zero ( ) As TimeSpan

Return Values

TimeSpan -

Read Only.

See Also

Project CorLib Overview

Class TimeSpanStatic Overview


TimeZone

TimeZone

Represents a time zone.

Implements:

IObject

Public:

Properties:

Name | Description
DaylightName (get) | Returns the name of the daylight saving period.
StandardName (get) | Returns the name of the standard time period.

Methods:

Name | Description
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetDayLightChanges | Returns the start and end of the daylight saving period.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetUtcOffset | Returns the offset from UTC to the current timezone, adjusting for daylight saving.
IsDaylightSavingTime | Returns whether the time is currently in the daylight saving period.
ToLocalTime | Returns the time with the UTC offset applied to get the local time.
ToString | Returns a string representation of this object instance.
ToUniversalTime | Returns the local time with UTC offset removed to get the UTC time.

See Also

Project CorLib Overview

Class TimeZone Overview

TimeZoneStatic


TimeZone: DaylightName (get)

DaylightName

Returns the name of the daylight saving period.

 Public Property Get DaylightName ( ) As String

Return Values

String - Daylight saving period name.

Read Only.

See Also

Project CorLib Overview

Class TimeZone Overview


TimeZone: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class TimeZone Overview


TimeZone: GetDayLightChanges

GetDayLightChanges

Returns the start and end of the daylight saving period.

 Public Function GetDayLightChanges(
      ByVal Year As Long ) As DayLightTime

Parameters

Year
[ByVal] Long. The year which contains the daylight saving period.

Return Values

DayLightTime - The daylight saving period.

See Also

Project CorLib Overview

Class TimeZone Overview


TimeZone: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class TimeZone Overview


TimeZone: GetUtcOffset

GetUtcOffset

Returns the offset from UTC to the current timezone, adjusting for daylight saving.

 Public Function GetUtcOffset(
      ByRef Time As Variant ) As TimeSpan

Parameters

Time
[ByRef] Variant. The time to get the offset for.

Return Values

TimeSpan - The offset from the time to UTC.

See Also

Project CorLib Overview

Class TimeZone Overview


TimeZone: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class TimeZone Overview


TimeZone: IsDaylightSavingTime

IsDaylightSavingTime

Returns whether the time is currently in the daylight saving period.

 Public Function IsDaylightSavingTime(
      ByRef Time As Variant ) As Boolean

Parameters

Time
[ByRef] Variant. The time to check if in the daylight saving period.

Return Values

Boolean - Indicating if the time was in the daylight saving period.

See Also

Project CorLib Overview

Class TimeZone Overview


TimeZone: StandardName (get)

StandardName

Returns the name of the standard time period.

 Public Property Get StandardName ( ) As String

Return Values

String - Standard time period name.

Read Only.

See Also

Project CorLib Overview

Class TimeZone Overview


TimeZone: ToLocalTime

ToLocalTime

Returns the time with the UTC offset applied to get the local time.

 Public Function ToLocalTime(
      ByRef Time As Variant ) As CorDateTime

Parameters

Time
[ByRef] Variant. The UTC time to convert to local time.

Return Values

CorDateTime - The local time converted from the UTC time.

See Also

Project CorLib Overview

Class TimeZone Overview


TimeZone: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class TimeZone Overview


TimeZone: ToUniversalTime

ToUniversalTime

Returns the local time with UTC offset removed to get the UTC time.

 Public Function ToUniversalTime(
      ByRef Time As Variant ) As CorDateTime

Parameters

Time
[ByRef] Variant. The local time to have the UTC offset removed.

Return Values

CorDateTime - The UTC time converted from the local time.

See Also

Project CorLib Overview

Class TimeZone Overview


TimeZoneStatic

TimeZoneStatic

Represents static methods for the TimeZone class.

Public:

Properties:

Name | Description
CurrentTimeZone (get) | Returns the current time zone for this machine.

Methods:

Name | Description
IsDaylightSavingTime | Returns whether the time is currently in the daylight saving period.

See Also

Project CorLib Overview

Class TimeZoneStatic Overview

TimeZone


TimeZoneStatic: CurrentTimeZone (get)

CurrentTimeZone

Returns the current time zone for this machine.

 Public Property Get CurrentTimeZone ( ) As TimeZone

Return Values

TimeZone - The current time zone for this machine.

Read Only.

See Also

Project CorLib Overview

Class TimeZoneStatic Overview


TimeZoneStatic: IsDaylightSavingTime

IsDaylightSavingTime

Returns whether the time is currently in the daylight saving period.

 Public Function IsDaylightSavingTime(
      ByRef Time As Variant,
      ByVal daylightTimes As DayLightTime ) As Boolean

Parameters

Time
[ByRef] Variant. The time to check if in the daylight saving period.
daylightTimes
[ByVal] DayLightTime. the daylight period to check the time against.

Return Values

Boolean - True if Time is in the daylight saving period; False otherwise.

See Also

Project CorLib Overview

Class TimeZoneStatic Overview


ToBase64Transform

ToBase64Transform

A class used to transform byte data to Base 64 data.

Implements:

ICryptoTransform
IObject

Public:

Properties:

Name | Description
CanReuseTransform (get) | Returns if this transform object can be reused.
CanTransformMultipleBlocks (get) | Returns if this transform can process multiple data blocks at once.
InputBlockSize (get) | Returns the block size of data that is operated on at a time.
OutputBlockSize (get) | Returns the block size of data that is returned from a transformation operation.

Methods:

Name | Description
Clear | Releases all resources being used by the transform.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
TransformBlock | Converts a specified region of byte array data to Base 64 byte array data.
TransformFinalBlock | Converts a specified region of byte array data to Base 64 byte array data.

Remarks

ToBase64Transform is used to transfrom sections of byte arrays to a Base 64 array.

This class is primarily used with a CryptoStream object to perform transformations of data in a streaming mechanism. It is not intended to be used directly.

See Also

Project CorLib Overview

Class ToBase64Transform Overview

CryptoStream


ToBase64Transform: CanReuseTransform (get)

CanReuseTransform

Returns if this transform object can be reused.

 Public Property Get CanReuseTransform ( ) As Boolean

Return Values

Boolean - Returns True if this transform can be used multiple times, False otherwise.

Remarks

This always returns True.

Read Only.

See Also

Project CorLib Overview

Class ToBase64Transform Overview


ToBase64Transform: CanTransformMultipleBlocks (get)

CanTransformMultipleBlocks

Returns if this transform can process multiple data blocks at once.

 Public Property Get CanTransformMultipleBlocks ( ) As Boolean

Return Values

Boolean - Returns True if this transform can process multiple data blocks at once, False otherwise.

Remarks

This always returns False.

Read Only.

See Also

Project CorLib Overview

Class ToBase64Transform Overview


ToBase64Transform: Clear

Clear

Releases all resources being used by the transform.

 Public Sub Clear ( )

Remarks

Once all resources have been called, this transform instance will no longer work.

See Also

Project CorLib Overview

Class ToBase64Transform Overview


ToBase64Transform: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns if the the Value and this instance are equal.

See Also

Project CorLib Overview

Class ToBase64Transform Overview


ToBase64Transform: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class ToBase64Transform Overview

IObject


ToBase64Transform: ICryptoTransform

ICryptoTransform

 Implements ICryptoTransform

Return Values

ICryptoTransform -

See Also

Project CorLib Overview

Class ToBase64Transform Overview


ToBase64Transform: InputBlockSize (get)

InputBlockSize

Returns the block size of data that is operated on at a time.

 Public Property Get InputBlockSize ( ) As Long

Return Values

Long - The number of bytes operated on at a time.

Remarks

This always returns 3.

When calling the TransformBlock method, the InputCount must be zero or a multiple of this value.

ToBase64Transform works on 24 bits at a time using standard Base 64 conversion methods. The resulting output is 32 bits of transformed data.

Read Only.

See Also

Project CorLib Overview

Class ToBase64Transform Overview


ToBase64Transform: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class ToBase64Transform Overview


ToBase64Transform: OutputBlockSize (get)

OutputBlockSize

Returns the block size of data that is returned from a transformation operation.

 Public Property Get OutputBlockSize ( ) As Long

Return Values

Long - The number of bytes that will result from a transformation.

Remarks

This always returns 4.

ToBase64Transform works on 24 bits at a time using standard Base 64 conversion methods. The resulting output is 32 bits of transformed data.

Read Only.

See Also

Project CorLib Overview

Class ToBase64Transform Overview


ToBase64Transform: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class ToBase64Transform Overview


ToBase64Transform: TransformBlock

TransformBlock

Converts a specified region of byte array data to Base 64 byte array data.

 Public Function TransformBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long,
      ByRef OutputBuffer ( ) As Byte,
      ByVal OutputOffset As Long ) As Long

Parameters

InputBuffer
[ByRef] Byte. A byte array containing the data to be transformed.
InputOffset
[ByVal] Long. The starting position in the InputBuffer to begin transforming data.
InputCount
[ByVal] Long. The number of bytes to be transformed.
OutputBuffer
[ByRef] Byte. A byte array that received the transformed data.
OutputOffset
[ByVal] Long. The starting position in the OutputBuffer to begin placing transformed data.

Return Values

Long - The number of bytes added to the OutputBuffer after the transformation.

Remarks

ToBase64Transform only operated on 3 bytes at a time, generating 4 bytes of output. If more than 3 bytes is needed to be transformed, then this method needs to be called multiple times.

See Also

Project CorLib Overview

Class ToBase64Transform Overview


ToBase64Transform: TransformFinalBlock

TransformFinalBlock

Converts a specified region of byte array data to Base 64 byte array data.

 Public Function TransformFinalBlock(
      ByRef InputBuffer ( ) As Byte,
      ByVal InputOffset As Long,
      ByVal InputCount As Long ) As Byte ( )

Parameters

InputBuffer
[ByRef] Byte. A byte array containing the data to be transformed.
InputOffset
[ByVal] Long. The starting position in the InputBuffer to begin transforming data.
InputCount
[ByVal] Long. The number of bytes to be transformed.

Return Values

Byte() - A byte array containing data transformed to Base 64.

Remarks

The purpose of this method is to transform a block of data that is 0 to 3 bytes in length. This is to allow the end of an array to be transformed if the array length is not a multiple of 3.

The resulting array will always be 4 bytes in length. It is padded if less than 3 bytes is transformed. If zero bytes are transformed, then a zero-length array is returned, not a null array.

See Also

Project CorLib Overview

Class ToBase64Transform Overview


TripleDES

TripleDES

Represents the interface for Triple Data Encryption Standard classes to implement.

Public:

Properties:

Name | Description
BlockSize (get) | Gets the block size, in bits, used by the cryptographic operation.
BlockSize (let) | Sets the block size, in bits, used by the cryptographic operation.
FeedbackSize (get) | Gets the feedback size, in bits, used by the cryptographic operation.
FeedbackSize (let) | Sets the feedback size, in bits, used by the cryptographic operation.
IV (get) | Gets the Initialization Vector used by the cryptographic operation.
IV (let) | Sets the Initialization Vector used by the cryptographic operation.
Key (get) | Returns the secret key used by the cryptographic operation.
Key (let) | Sets the secret key to be used by the cryptographic operation.
KeySize (get) | Returns the size of the key, in bits, used by the cryptographic operation.
KeySize (let) | Sets the size of the key, in bits.
LegalBlockSizes (get) | Gets a list of legal block sizes.
LegalKeySizes (get) | Gets a list of legal key sizes.
Mode (get) | Gets the mode the current algoritm is set to.
Mode (let) | Sets the mode the current algorithm is set to.
Padding (get) | Gets the padding to be used by the algorithm.
Padding (let) | Sets the padding to be used by the algorithm.

Methods:

Name | Description
Clear | Releases all resources.
CreateDecryptor | Creates a new decryptor using the Triple Data Encryption Standard algorithm.
CreateEncryptor | Creates a new encryptor using the Triple Data Ecryption Standard algorithm.
Equals | Returns if this instance and the value are equal.
GenerateIV | Generates a new Initialization Vector array.
GenerateKey | Generates a new Key based on the key size.
GetHashCode | Returns a semi-unique value that represents this instance.
ToString | Returns a string representation of this instance.
ValidKeySize | Checks if the specific number of bits is a valid key size.

See Also

Project CorLib Overview

Class TripleDES Overview

TripleDESCryptoServiceProvider

TripleDESStatic


TripleDES: BlockSize (get)

BlockSize

Gets the block size, in bits, used by the cryptographic operation.

 Public Property Get BlockSize ( ) As Long

Return Values

Long - The block size in bits.

Remarks

A block size is the basic unit size of data that can be encrypted or decrypted in a single operation. Data that is larger than a block size are processed by splitting the data into multiple blocks the same size as the block size then operating of the multiple blocks.

A list of legal block sizes can be obtained through the LegalBlockSizes property.

Read/Write.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: BlockSize (let)

BlockSize

Sets the block size, in bits, used by the cryptographic operation.

 Public Property Let BlockSize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The block size in bits.

Remarks

A block size is the basic unit size of data that can be encrypted or decrypted in a single operation. Data that is larger than a block size are processed by splitting the data into multiple blocks the same size as the block size then operating of the multiple blocks.

An invalid block size will cause a CryptographicException.

A list of legal block sizes can be obtained through the LegalBlockSizes property.

Read/Write.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: Clear

Clear

Releases all resources.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: CreateDecryptor

CreateDecryptor

Creates a new decryptor using the Triple Data Encryption Standard algorithm.

 Public Function CreateDecryptor(
      Optional ByRef RgbKey As Variant,
      Optional ByRef RgbIV As Variant ) As ICryptoTransform

Parameters

RgbKey
[ByRef] Optional. Variant. The secret key to be used to decrypt the ciphered text back into plain text.
RgbIV
[ByRef] Optional. Variant. The Initialization Vector to begin the feedback with.

Return Values

ICryptoTransform - A new ICryptoTransform used to decrypt ciphered text.

Remarks

Though both parameters are optional, if only one parameter is supplied, an exception will be thrown.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: CreateEncryptor

CreateEncryptor

Creates a new encryptor using the Triple Data Ecryption Standard algorithm.

 Public Function CreateEncryptor(
      Optional ByRef RgbKey As Variant,
      Optional ByRef RgbIV As Variant ) As ICryptoTransform

Parameters

RgbKey
[ByRef] Optional. Variant. The secret key to be used to encrypt the plain text into ciphered text.
RgbIV
[ByRef] Optional. Variant. The Initialization Vector to begin the feedback with.

Return Values

ICryptoTransform - A new ICryptoTransform used to encrypt plain text.

Remarks

Though both parameters are optional, if only one parameter is supplied, an exception will be thrown.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: Equals

Equals

Returns if this instance and the value are equal.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare for equality.

Return Values

Boolean - Returns if the value and this instance are equal.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: FeedbackSize (get)

FeedbackSize

Gets the feedback size, in bits, used by the cryptographic operation.

 Public Property Get FeedbackSize ( ) As Long

Return Values

Long - Returns the feedback size in bits.

Remarks

The feedback size determines the amount of data that is fed back to successive encryption or decryption operations. The feedback size cannot be greater than the block size.

Read/Write.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: FeedbackSize (let)

FeedbackSize

Sets the feedback size, in bits, used by the cryptographic operation.

 Public Property Let FeedbackSize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The feedback size in bits.

Remarks

The feedback size determines the amount of data that is fed back to successive encryption or decryption operations. The feedback size cannot be greater than the block size.

Read/Write.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: GenerateIV

GenerateIV

Generates a new Initialization Vector array.

 Public Sub GenerateIV ( )

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: GenerateKey

GenerateKey

Generates a new Key based on the key size.

 Public Sub GenerateKey ( )

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: GetHashCode

GetHashCode

Returns a semi-unique value that represents this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns the semi-unique value.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: IV (get)

IV

Gets the Initialization Vector used by the cryptographic operation.

 Public Property Get IV ( ) As Byte ( ) :

Return Values

Byte() - Returns an array of bytes representing an Initialization Vector.

Remarks

If several blocks of same plain text are encrypted, the ciphered data could all be the same as well. Using an Initialization Vector can prevent same plain text blocks to reproduce the same ciphered blocks.

This can be generated using the GenerateIV method, or a new one will be generated if one hasnt been set when this property is accessed.

Read/Write.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: IV (let)

IV

Sets the Initialization Vector used by the cryptographic operation.

 Public Property Let IV(
      ByRef Value ( ) As Byte ) :

Parameters

Value
[ByRef] Byte. The new Initialization Vector.

Remarks

If several blocks of same plain text are encrypted, the ciphered data could all be the same aswell. Using an Initialization Vector can prevent same plain text blocks to reproduce the same ciphered blocks.

This can be generated using the GenerateIV method, or a new one will be generated if one hasnt been set when this property is accessed.

This must be set to an array the same size as the block size.

Read/Write.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: Key (get)

Key

Returns the secret key used by the cryptographic operation.

 Public Property Get Key ( ) As Byte ( ) :

Return Values

Byte() - Returns the secret key.

Remarks

Valid key sizes are determined by the individual algorithms. A list of valid sizes can be obtained through the LegalKeySizes property.

If a key has not been set, then a new key will be generated automatically.

Read/Write.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: Key (let)

Key

Sets the secret key to be used by the cryptographic operation.

 Public Property Let Key(
      ByRef Value ( ) As Byte ) :

Parameters

Value
[ByRef] Byte. The new secret key to be used.

Remarks

Valid key sizes are determined by the individual algorithms. A list of valid sizes can be obtained through the LegalKeySizes property.

Read/Write.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: KeySize (get)

KeySize

Returns the size of the key, in bits, used by the cryptographic operation.

 Public Property Get KeySize ( ) As Long

Return Values

Long - The size of the key in bits.

Remarks

The size of keys are measured in bits. Common key sizes are 64, 128, 192, and 256 bit lengths.

Read/Write.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: KeySize (let)

KeySize

Sets the size of the key, in bits.

 Public Property Let KeySize(
      ByVal Value As Long ) :

Parameters

Value
[ByVal] Long. The size of the key in bits.

Remarks

The size of keys are measured in bits. Common key sizes are 64, 128, 192, and 256 bit lengths.

This will cause the Key property to reset and regenerate when needed.

Read/Write.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: LegalBlockSizes (get)

LegalBlockSizes

Gets a list of legal block sizes.

 Public Property Get LegalBlockSizes ( ) As KeySizes ( ) :

Return Values

KeySizes() - A list of legal block sizes the cryptographic operation supports.

Read Only.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: LegalKeySizes (get)

LegalKeySizes

Gets a list of legal key sizes.

 Public Property Get LegalKeySizes ( ) As KeySizes ( ) :

Return Values

KeySizes() - A list of legal key sizes the cryptographic operation supports.

Read Only.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: Mode (get)

Mode

Gets the mode the current algoritm is set to.

 Public Property Get Mode ( ) As CipherMode

Return Values

CipherMode - Returns a CipherMode value.

Remarks

The algoritm can operate in several modes. The modes determine how the data is processed from one block to the next.

Read/Write.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: Mode (let)

Mode

Sets the mode the current algorithm is set to.

 Public Property Let Mode(
      ByVal Value As CipherMode ) :

Parameters

Value
[ByVal] CipherMode. The new mode for the algorithm.

Remarks

The algoritm can operate in several modes. The modes determine how the data is processed from one block to the next.

Read/Write.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: Padding (get)

Padding

Gets the padding to be used by the algorithm.

 Public Property Get Padding ( ) As PaddingMode

Return Values

PaddingMode - A current padding being used.

Remarks

Padding is added to the end of plain text data to make the data length an even multiple of the block size.

Read/Write.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: Padding (let)

Padding

Sets the padding to be used by the algorithm.

 Public Property Let Padding(
      ByVal Value As PaddingMode ) :

Parameters

Value
[ByVal] PaddingMode. The new padding value to be used.

Remarks

Padding is added to the end of plain text data to make the data length an even multiple of the block size.

Read/Write.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: ToString

ToString

Returns a string representation of this instance.

 Public Function ToString ( ) As String

Return Values

String - A string that represents this instance.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDES: ValidKeySize

ValidKeySize

Checks if the specific number of bits is a valid key size.

 Public Function ValidKeySize(
      ByVal BitLength As Long ) As Boolean

Parameters

BitLength
[ByVal] Long. A value to determine if is a legal key size.

Return Values

Boolean - Returns True if the bit length is a valid key size, False otherwise.

See Also

Project CorLib Overview

Class TripleDES Overview


TripleDESCryptoServiceProvider

TripleDESCryptoServiceProvider

Provides cryptographic services using the TripleDES cryptographic service provider.

Implements:

IObject
SymmetricAlgorithm
TripleDES

Public:

Properties:

Name | Description
BlockSize (get) | Gets the block size, in bits, used by this algorithm.
BlockSize (let) | Sets the block size, in bits, used by this algorithm.
FeedbackSize (get) | Gets the Feedback Size in bits.
FeedbackSize (let) | Sets the Feedback size in bits.
IV (get) | Gets the initialization vector.
IV (let) | Sets the initialization vector to be used.
Key (get) | Gets the current secret key.
Key (let) | Sets the secret key.
KeySize (get) | Gets the key size in bits.
KeySize (let) | Sets the key size in bits.
LegalBlockSizes (get) | Gets a list of legal block sizes.
LegalKeySizes (get) | Gets a list of valid key sizes supported by this algorithm.
Mode (get) | Gets the Cipher mode this algorithm will use.
Mode (let) | Sets the Cipher mode this algorithm will use.
Padding (get) | Gets the padding mode being used.
Padding (let) | Sets the padding mode to be used.

Methods:

Name | Description
Clear | Clears the Key and IV arrays.
CreateDecryptor | Returns a new cipher used to decrypt data.
CreateEncryptor | Returns a new cipher used to encrypt data.
Equals | This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.
GenerateIV | Generates a random initialization vector array to use.
GenerateKey | Generates a random key to be used.
GetHashCode | Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.
ToString | Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.
ValidKeySize | Tests if a specific bit length is valid for a key.

Examples

This example shows a very simple method of encrypting then decrypting a String value.

Private Sub Main()
    Dim Key As New TripleDESCryptoServiceProvider
    Dim Buffer() As Byte
    Dim PlainText As String

    ' Encrypt a string to a byte array.
    Buffer = Encrypt("This is some plaintext!", Key)

    Debug.Print "Encrypted data"
    PrintBytes Buffer
    Debug.Print

    ' Decrypt the byte array back to a string.
    PlainText = Decrypt(Buffer, Key)

    ' Display the plaintext value to the console.
    Debug.Print "Original text"
    Debug.Print PlainText
End Sub

Private Sub PrintBytes(ByRef Bytes() As Byte)
    Dim i As Long

    For i = LBound(Bytes) To UBound(Bytes)
        Debug.Print Object.ToString(Bytes(i), "X2"); " ";
    Next

    Debug.Print
End Sub

' Encrypt the string.
Private Function Encrypt(ByVal PlainText As String, ByVal Key As SymmetricAlgorithm) As Byte()
    Dim Encryptor As ICryptoTransform
    Dim Buffer() As Byte

    Buffer = Encoding.UTF8.GetBytes(PlainText)
    Set Encryptor = Key.CreateEncryptor
    Encrypt = Encryptor.TransformFinalBlock(Buffer, 0, CorArray.Length(Buffer))
End Function

' Decrypt the byte array.
Public Function Decrypt(ByRef CypherText() As Byte, ByVal Key As SymmetricAlgorithm) As String
    Dim Decryptor As ICryptoTransform
    Dim Buffer() As Byte

    Set Decryptor = Key.CreateDecryptor
    Buffer = Decryptor.TransformFinalBlock(CypherText, 0, CorArray.Length(CypherText))
    Decrypt = Encoding.UTF8.GetString(Buffer)
End Function

' This example produces the following output.
'
'    Encrypted Data (may be different because key is generated)
'    41 40 45 31 BF D9 B5 9C 63 0E CB 0B 83 D8 DD 81 AA 47 5C F1 05 5D C2 04
'
'    Original Text
'    This is some plaintext!

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview

TripleDESStatic


TripleDESCryptoServiceProvider: BlockSize (get)

BlockSize

Gets the block size, in bits, used by this algorithm.

 Public Property Get BlockSize ( ) As Long

Return Values

Long - The block size in bits.

Remarks

This will always return 64 bits (8 bytes).

Read/Write.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: BlockSize (let)

BlockSize

Sets the block size, in bits, used by this algorithm.

 Public Property Let BlockSize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new block size in bits.

Remarks

The only valid block size is 64 bits.

Read/Write.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: Clear

Clear

Clears the Key and IV arrays.

 Public Sub Clear ( )

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: CreateDecryptor

CreateDecryptor

Returns a new cipher used to decrypt data.

 Public Function CreateDecryptor(
      Optional ByRef RgbKey As Variant,
      Optional ByRef RgbIV As Variant ) As ICryptoTransform

Parameters

RgbKey
[ByRef] Optional. Variant. A supplied byte array used as the secret key.
RgbIV
[ByRef] Optional. Variant. A supplied byte array used for the Initialization Vector (IV).

Return Values

ICryptoTransform - An ICryptoTransform object used to dencrypt data.

Remarks

The RgbKey and RgbIV parameters must be either supplied or missing. A single parameter will throw an exception.

If no parameters are supplied then the key and IV will be retrieved through the Key and IV properties.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: CreateEncryptor

CreateEncryptor

Returns a new cipher used to encrypt data.

 Public Function CreateEncryptor(
      Optional ByRef RgbKey As Variant,
      Optional ByRef RgbIV As Variant ) As ICryptoTransform

Parameters

RgbKey
[ByRef] Optional. Variant. A supplied byte array used as the secret key.
RgbIV
[ByRef] Optional. Variant. A supplied byte array used for the initialization vector (IV).

Return Values

ICryptoTransform - An ICryptoTransform object used to encrypt data.

Remarks

The RgbKey and RgbIV parameters must be either supplied or missing. A single parameter will throw an exception.

If no parameters are supplied then the key and IV will be retrieved through the Key and IV properties.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: Equals

Equals

This function determines if the value passed in is the same as the current object instance. Meaning, are the Value and this object the same object in memory.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare against this instance.

Return Values

Boolean - Returns True if the values are the same.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: FeedbackSize (get)

FeedbackSize

Gets the Feedback Size in bits.

 Public Property Get FeedbackSize ( ) As Long

Return Values

Long - The Feedback size in bits.

Remarks

Always returns 64 bits.

Read/Write.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: FeedbackSize (let)

FeedbackSize

Sets the Feedback size in bits.

 Public Property Let FeedbackSize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new feedback size in bits.

Remarks

Only 64 bits is valid.

Read/Write.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: GenerateIV

GenerateIV

Generates a random initialization vector array to use.

 Public Sub GenerateIV ( )

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: GenerateKey

GenerateKey

Generates a random key to be used.

 Public Sub GenerateKey ( )

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: GetHashCode

GetHashCode

Returns a psuedo-unique number used to help identify this object in memory. The current method is to return the value obtained from ObjPtr. If a different method needs to be impelmented then change the method here in this function.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Returns a number identifing this instance.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: IV (get)

IV

Gets the initialization vector.

 Public Property Get IV ( ) As Byte ( )

Return Values

Byte() - A byte-array representing the initialization vector.

Remarks

If several blocks of same plain text are encrypted, the ciphered data could all be the same as well. Using an Initialization Vector can prevent same plain text blocks to reproduce the same ciphered blocks.

This can be generated using the GenerateIV method, or a new one will be generated if one hasnt been set when this property is accessed.

If IV has not been set, then a new random IV will be generated.

Read/Write.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: IV (let)

IV

Sets the initialization vector to be used.

 Public Property Let IV(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. An 8-byte array representing the initialization vector.

Remarks

If several blocks of same plain text are encrypted, the ciphered data could all be the same as well. Using an initialization vector can prevent same plain text blocks to reproduce the same ciphered blocks.

This can be generated using the GenerateIV method, or a new one will be generated if one hasnt been set when this property is accessed.

The Value parameter must be 8 bytes in length.

Read/Write.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: Key (get)

Key

Gets the current secret key.

 Public Property Get Key ( ) As Byte ( )

Return Values

Byte() - The secret key.

Remarks

If no key has been set, then a new random key will be generated.

Read/Write.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: Key (let)

Key

Sets the secret key.

 Public Property Let Key(
      ByRef Value ( ) As Byte )

Parameters

Value
[ByRef] Byte. The new secret key.

Read/Write.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: KeySize (get)

KeySize

Gets the key size in bits.

 Public Property Get KeySize ( ) As Long

Return Values

Long - The key size in bits.

Read/Write.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: KeySize (let)

KeySize

Sets the key size in bits.

 Public Property Let KeySize(
      ByVal Value As Long )

Parameters

Value
[ByVal] Long. The new key size in bits.

Remarks

Key sizes of 128 or 192 are supported.

Read/Write.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: LegalBlockSizes (get)

LegalBlockSizes

Gets a list of legal block sizes.

 Public Property Get LegalBlockSizes ( ) As KeySizes ( )

Return Values

KeySizes() - A list of legal block sizes.

Remarks

Only one block size is legal, 64 bits.

Read Only.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: LegalKeySizes (get)

LegalKeySizes

Gets a list of valid key sizes supported by this algorithm.

 Public Property Get LegalKeySizes ( ) As KeySizes ( )

Return Values

KeySizes() - A list of valid key sizes.

Read Only.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: Mode (get)

Mode

Gets the Cipher mode this algorithm will use.

 Public Property Get Mode ( ) As CipherMode

Return Values

CipherMode - The Cipher mode.

Read/Write.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview

CipherMode


TripleDESCryptoServiceProvider: Mode (let)

Mode

Sets the Cipher mode this algorithm will use.

 Public Property Let Mode(
      ByVal Value As CipherMode )

Parameters

Value
[ByVal] CipherMode. The cipher mode to use.

Read/Write.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview

CipherMode


TripleDESCryptoServiceProvider: Padding (get)

Padding

Gets the padding mode being used.

 Public Property Get Padding ( ) As PaddingMode

Return Values

PaddingMode - The current padding mode.

Read/Write.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview

PaddingMode


TripleDESCryptoServiceProvider: Padding (let)

Padding

Sets the padding mode to be used.

 Public Property Let Padding(
      ByVal Value As PaddingMode )

Parameters

Value
[ByVal] PaddingMode. The new padding mode.

Read/Write.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview

PaddingMode


TripleDESCryptoServiceProvider: SymmetricAlgorithm

SymmetricAlgorithm

 Implements SymmetricAlgorithm

Return Values

SymmetricAlgorithm -

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: ToString

ToString

Returns a string representation of this object instance. The default method simply returns the application name and class name in which this class resides.

 Public Function ToString ( ) As String

Return Values

String - Returns a string representation of this instance.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: TripleDES

TripleDES

 Implements TripleDES

Return Values

TripleDES -

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESCryptoServiceProvider: ValidKeySize

ValidKeySize

Tests if a specific bit length is valid for a key.

 Public Function ValidKeySize(
      ByVal BitLength As Long ) As Boolean

Parameters

BitLength
[ByVal] Long. The number of bits to test for.

Return Values

Boolean - True if the number of bits is supported, False otherwise.

Remarks

Only 128-bit and 192-bit are supported.

See Also

Project CorLib Overview

Class TripleDESCryptoServiceProvider Overview


TripleDESStatic

TripleDESStatic

Provides static methods used with the Triple Data Encryption Standard algorithm.

Public:

Methods:

Name | Description
Create | Returns a TripleDES algorithm implementation based on the name.
IsWeakKey | Determines if a key is weak or not.

See Also

Project CorLib Overview

Class TripleDESStatic Overview

TripleDES

TripleDESCryptoServiceProvider


TripleDESStatic: Create

Create

Returns a TripleDES algorithm implementation based on the name.

 Public Function Create(
      Optional ByVal AlgName As String = "TripleDES" ) As TripleDES

Parameters

AlgName
[ByVal] Optional. String. The name of the TripleDES implementation.

Default: "TripleDES"

Return Values

TripleDES - The specified TripleDES algorithm.

Remarks

The name is specified by the Server.Class name. The CreateObject method is used to instantiate the object.

If the name is "3DES", "TripleDES" or missing then the default implementation is returned.

See Also

Project CorLib Overview

Class TripleDESStatic Overview


TripleDESStatic: IsWeakKey

IsWeakKey

Determines if a key is weak or not.

 Public Function IsWeakKey(
      ByRef RgbKey ( ) As Byte ) As Boolean

Parameters

RgbKey
[ByRef] Byte. The key to be tested for weakness.

Return Values

Boolean - Returns True if the key is weak, or False if not.

Remarks

A weak key is determined if the first 64 bits are equal to the second 64 bits for a 128 bit key. For a 192 bit key, weakness is determined if the first 64 bits is equal to the second 64 bits, or if the second 64 bits is equal to the third 64 bits.

See Also

Project CorLib Overview

Class TripleDESStatic Overview


UnauthorizedAccessException

UnauthorizedAccessException

This exception is thrown when an operation attempted to access a secured value or location without proper authorization.

Implements:

Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

See Also

Project CorLib Overview

Class UnauthorizedAccessException Overview

Constructors

Exception

ExceptionMethods


UnauthorizedAccessException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class UnauthorizedAccessException Overview


UnauthorizedAccessException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class UnauthorizedAccessException Overview


UnauthorizedAccessException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class UnauthorizedAccessException Overview


UnauthorizedAccessException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class UnauthorizedAccessException Overview


UnauthorizedAccessException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class UnauthorizedAccessException Overview


UnauthorizedAccessException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class UnauthorizedAccessException Overview


UnauthorizedAccessException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class UnauthorizedAccessException Overview


UnauthorizedAccessException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class UnauthorizedAccessException Overview


UnauthorizedAccessException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class UnauthorizedAccessException Overview

Exception


UnauthorizedAccessException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class UnauthorizedAccessException Overview


UnauthorizedAccessException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class UnauthorizedAccessException Overview


UnauthorizedAccessException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewSystemException.

Read Only.

See Also

Project CorLib Overview

Class UnauthorizedAccessException Overview


UnauthorizedAccessException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class UnauthorizedAccessException Overview


UnauthorizedAccessException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class UnauthorizedAccessException Overview


UnauthorizedAccessException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class UnauthorizedAccessException Overview


UnauthorizedAccessException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class UnauthorizedAccessException Overview


UnicodeEncoding

UnicodeEncoding

A set of functions used to convert UTF-16 Unicode characters to and from byte arrays.

Implements:

Encoding
ICloneable
IObject

Public:

Properties:

Name | Description
BodyName (get) | Gets the encoding name to be used in with the mail agent body tags.
CodePage (get) | Gets the code page identifier for this encoding.
DecoderFallback (get) | Gets the current DecoderFallback instance used by the encoding.
DecoderFallback (set) | Sets the DecoderFallback to be used by this encoding instance.
EncoderFallback (get) | Gets the current EncoderFallback instance used by the encoding.
EncoderFallback (set) | Sets the EncoderFallback to be used by this encoding instance.
EncodingName (get) | Gets the name of this encoding.
HeaderName (get) | Gets the encoding name to be used in with the mail agent header tags.
IsBrowserDisplay (get) | Gets if this encoding can be used by browsers to display text.
IsBrowserSave (get) | Gets if this encoding can be used to save data with this encoding.
IsMailNewsDisplay (get) | Gets if this encoding can be used to display mail and news by mail and news clients.
IsMailNewsSave (get) | Gets if this encoding can be used to save date by mail and news clients.
IsReadOnly (get) | When implemented in a derived class, gets a value indicating whether the current encoding is read-only.
IsSingleByte (get) | Gets if the current encoding uses single-byte code points.
WebName (get) | Gets the encoding name registered with the Internet Assigned Numbers Authority.
WindowsCodePage (get) | Gets the Windows Operating Systems code page for this encoding.

Methods:

Name | Description
Clone | Creates a clone of the current Encoding instance.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetByteCount | Returns the number of bytes that would be produced from the set of characters using this encoding.
GetBytes | Encodes a set of characters into an array of bytes.
GetBytesEx | Encodes a set of characters into an array of bytes, returning the number of bytes produced.
GetCharCount | Returns the number of characters that would be produced by decoding a byte array.
GetChars | Decodes a set of bytes into a set of characters.
GetCharsEx | Decodes a set of bytes into the supplied Integer array.
GetDecoder | Returns a decoder that maintains state.
GetEncoder | Returns an encoder that maintains state.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetMaxByteCount | Returns the maximum number of bytes that can be created from a specific number of characters.
GetMaxCharCount | Returns the maximum number of characters than can be decoded from the number of bytes specified.
GetPreamble | Returns an array of bytes that represents this encoding.
GetString | Decodes a set of bytes into a String.
ToString | Returns a string representation of this object instance.

Remarks

This encoding can encode characters using big-endian or little-endian notation. The default is little-endian (least significant byte first).

A Byte order Mark will be emitted if selected using the Cor.NewUnicodeEncoding constructor.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview

Constructors

Encoding


UnicodeEncoding: BodyName (get)

BodyName

Gets the encoding name to be used in with the mail agent body tags.

 Public Property Get BodyName ( ) As String

Return Values

String - The body tag compatible encoding name.

Read Only.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: Clone

Clone

Creates a clone of the current Encoding instance.

 Public Function Clone ( ) As UnicodeEncoding

Return Values

UnicodeEncoding - A cloned instance of a UnicodeEncoding object.

Remarks

A cloned instance will have the read-only limitations removed.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: CodePage (get)

CodePage

Gets the code page identifier for this encoding.

 Public Property Get CodePage ( ) As Long

Return Values

Long - Code page identifier.

Read Only.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: DecoderFallback (get)

DecoderFallback

Gets the current DecoderFallback instance used by the encoding.

 Public Property Get DecoderFallback ( ) As DecoderFallback

Return Values

DecoderFallback - An object derived from DecoderFallback.

Remarks

The default will return an instance of DecoderReplacementFallback.

Read/Write.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: DecoderFallback (set)

DecoderFallback

Sets the DecoderFallback to be used by this encoding instance.

 Public Property Set DecoderFallback(
      ByVal Value As DecoderFallback )

Parameters

Value
[ByVal] DecoderFallback. The DecoderFallback instance to set.

Remarks

By default an Encoding instance is marked as read-only and setting this value will result in an InvalidOperationException being thrown. If a clone of the instance is made, then it will become read-write and allow the setting of the value.

Read/Write.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: EncoderFallback (get)

EncoderFallback

Gets the current EncoderFallback instance used by the encoding.

 Public Property Get EncoderFallback ( ) As EncoderFallback

Return Values

EncoderFallback - An object derived from EncoderFallback.

Remarks

The default will return an instance of EncoderReplacementFallback.

Read/Write.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: EncoderFallback (set)

EncoderFallback

Sets the EncoderFallback to be used by this encoding instance.

 Public Property Set EncoderFallback(
      ByVal Value As EncoderFallback )

Parameters

Value
[ByVal] EncoderFallback. The EncoderFallback instance to set.

Remarks

By default an Encoding instance is marked as read-only and setting this value will result in an InvalidOperationException being thrown. If a clone of the instance is made, then it will become read-write and allow the setting of the value.

Read/Write.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: Encoding

Encoding

 Implements Encoding

Return Values

Encoding -

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: EncodingName (get)

EncodingName

Gets the name of this encoding.

 Public Property Get EncodingName ( ) As String

Return Values

String - The encodings name.

Read Only.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: GetByteCount

GetByteCount

Returns the number of bytes that would be produced from the set of characters using this encoding.

 Public Function GetByteCount(
      ByRef Chars As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Chars
[ByRef] Variant. A set of characters used to calculated the number of bytes once encoded with this encoding.
Index
[ByRef] Optional. Variant. The starting index of the first character to be used.
Count
[ByRef] Optional. Variant. The number of characters to include in the calculation.

Return Values

Long - The number of bytes that would be produced by encoding the set of characters.

Remarks

The Chars parameter will accept either a String or an Integer array. The Index is zero based for both the String and Integer array, not 1 based like Mid$.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: GetBytes

GetBytes

Encodes a set of characters into an array of bytes.

 Public Function GetBytes(
      ByRef Chars As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Chars
[ByRef] Variant. The set of characters to be encoded into an array of bytes. This can be either an Integer array or a String.
Index
[ByRef] Optional. Variant. The index of the first character to begin encoding from.
Count
[ByRef] Optional. Variant. The number of characters to be encoded.

Return Values

Byte() - A byte array containing the encoded characters as bytes.

Remarks

The Chars parameter will accept either a String or an Integer array. The Index is zero based for both the String and Integer array, not 1 based like Mid$.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: GetBytesEx

GetBytesEx

Encodes a set of characters into an array of bytes, returning the number of bytes produced.

 Public Function GetBytesEx(
      ByRef Chars As Variant,
      ByVal CharIndex As Long,
      ByVal CharCount As Long,
      ByRef Bytes ( ) As Byte,
      ByVal ByteIndex As Long ) As Long

Parameters

Chars
[ByRef] Variant. the set of characters to be encoded into bytes. This can be either an Integer array or a String.
CharIndex
[ByVal] Long. The index of the first character to begin encoding from.
CharCount
[ByVal] Long. The number of characters to be encoded.
Bytes
[ByRef] Byte. The destination for the encoded characters.
ByteIndex
[ByVal] Long. The index of the first byte stored in the destination array.

Return Values

Long - The number of bytes produce by the encoding.

Remarks

The Bytes array cannot be null and must be large enough to hold the encoded set of characters. To obtain the size required, use GetByteCount to find the necessary size. Or, use GetMaxByteCount to get the largest size that could be produced. The largest size is not the perfect size, only the maximum number of bytes that could ever be produced by a number of characters. Resizing of the resultant Bytes array may be necessary.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: GetCharCount

GetCharCount

Returns the number of characters that would be produced by decoding a byte array.

 Public Function GetCharCount(
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Bytes
[ByRef] Byte. The bytes to use when calculating the number of characters.
Index
[ByRef] Optional. Variant. The starting index in Bytes to being calculating from.
Count
[ByRef] Optional. Variant. The number of bytes to be used in the calculation.

Return Values

Long - The number of characters that would be decoded from the set of bytes.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: GetChars

GetChars

Decodes a set of bytes into a set of characters.

 Public Function GetChars(
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Integer ( )

Parameters

Bytes
[ByRef] Byte. The set of bytes to be decoded into characters.
Index
[ByRef] Optional. Variant. The index of the first byte to be used in decoding.
Count
[ByRef] Optional. Variant. The number of bytes to be used in decoding.

Return Values

Integer() - An array of characters decoded from the set of bytes.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: GetCharsEx

GetCharsEx

Decodes a set of bytes into the supplied Integer array.

 Public Function GetCharsEx(
      ByRef Bytes ( ) As Byte,
      ByVal ByteIndex As Long,
      ByVal ByteCount As Long,
      ByRef Chars ( ) As Integer,
      ByVal CharIndex As Long ) As Long

Parameters

Bytes
[ByRef] Byte. The set of bytes to be decoded into characters.
ByteIndex
[ByVal] Long. The index of the first byte to begin decoding from.
ByteCount
[ByVal] Long. The number of bytes to be used in decoding.
Chars
[ByRef] Integer. The destination character array for the decoded bytes.
CharIndex
[ByVal] Long. The first index to begin storing decoded bytes in Chars.

Return Values

Long - The number of characters decoded from the array of bytes.

Remarks

The Chars array must be large enough to handle all the bytes that will be decoded. To ensure the Chars array is large enough, use either GetCharCount or GetMaxCharCount to determine a size that will hold the decoded bytes.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: GetDecoder

GetDecoder

Returns a decoder that maintains state.

 Public Function GetDecoder ( ) As Decoder

Return Values

Decoder - The stateful decoder.

Remarks

Unlike UnicodeEncoding, the decoder maintains state between decoding calls. Since a single unicode character required exactly 2 bytes to be decoded, it is possible that an odd number of bytes may be attempted to be decoding, creating an orphaned byte which represents only half of a unicode character. The remaining byte is held until the next decoding call, and the byte is then inserted at the beginning of the next set of bytes to be decoded, picking up byte decoding where the orphaned byte left off.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: GetEncoder

GetEncoder

Returns an encoder that maintains state.

 Public Function GetEncoder ( ) As Encoder

Return Values

Encoder - The stateful encoder.

Remarks

Since encoding Unicode characters equates to exactly 2 bytes per character, there is no state that is maintained between calls. This method functions identically to GetBytes.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: GetMaxByteCount

GetMaxByteCount

Returns the maximum number of bytes that can be created from a specific number of characters.

 Public Function GetMaxByteCount(
      ByVal CharCount As Long ) As Long

Parameters

CharCount
[ByVal] Long. The number of characters to be encoded.

Return Values

Long - The maximum number of bytes that can be generated from the specified number of characters.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: GetMaxCharCount

GetMaxCharCount

Returns the maximum number of characters than can be decoded from the number of bytes specified.

 Public Function GetMaxCharCount(
      ByVal ByteCount As Long ) As Long

Parameters

ByteCount
[ByVal] Long. The number of bytes to be decoded.

Return Values

Long - The maximum number of characters that can be decoded from the specified number of bytes.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: GetPreamble

GetPreamble

Returns an array of bytes that represents this encoding.

 Public Function GetPreamble ( ) As Byte ( )

Return Values

Byte() - A byte array containg the bytes to be used to identify this encoding type.

Remarks

If the encoding was created setting the BigEndian paramter to true, then this will return the Unicode byte array identifer &HFEFF otherwise &HFFFE for a non-bigEndian encoding. If no identifier is to be emitted, then an empty byte array is returned (not a null array).

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: GetString

GetString

Decodes a set of bytes into a String.

 Public Function GetString(
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As String

Parameters

Bytes
[ByRef] Byte. The set of bytes to be decoded into a string.
Index
[ByRef] Optional. Variant. The index of the first byte to be decoded.
Count
[ByRef] Optional. Variant. The number of bytes to be used in the decoding.

Return Values

String - A string containing the decoded set of bytes.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: HeaderName (get)

HeaderName

Gets the encoding name to be used in with the mail agent header tags.

 Public Property Get HeaderName ( ) As String

Return Values

String - The header tag compatible encoding name.

Read Only.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: IsBrowserDisplay (get)

IsBrowserDisplay

Gets if this encoding can be used by browsers to display text.

 Public Property Get IsBrowserDisplay ( ) As Boolean

Return Values

Boolean - The indication for browser display capable.

Read Only.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: IsBrowserSave (get)

IsBrowserSave

Gets if this encoding can be used to save data with this encoding.

 Public Property Get IsBrowserSave ( ) As Boolean

Return Values

Boolean - The indication for the browser saving capable.

Read Only.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: IsMailNewsDisplay (get)

IsMailNewsDisplay

Gets if this encoding can be used to display mail and news by mail and news clients.

 Public Property Get IsMailNewsDisplay ( ) As Boolean

Return Values

Boolean - Indication for mail and news client capable.

Read Only.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: IsMailNewsSave (get)

IsMailNewsSave

Gets if this encoding can be used to save date by mail and news clients.

 Public Property Get IsMailNewsSave ( ) As Boolean

Return Values

Boolean - Indication for the mail and news clients to use this encoding for saving.

Read Only.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: IsReadOnly (get)

IsReadOnly

When implemented in a derived class, gets a value indicating whether the current encoding is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - true if the current Encoding is read-only; otherwise, false. The default is true.

Read Only.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: IsSingleByte (get)

IsSingleByte

Gets if the current encoding uses single-byte code points.

 Public Property Get IsSingleByte ( ) As Boolean

Return Values

Boolean - Returns True for single-byte, False for multi-byte code points.

Read Only.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: WebName (get)

WebName

Gets the encoding name registered with the Internet Assigned Numbers Authority.

 Public Property Get WebName ( ) As String

Return Values

String - The registered encoding name.

Read Only.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UnicodeEncoding: WindowsCodePage (get)

WindowsCodePage

Gets the Windows Operating Systems code page for this encoding.

 Public Property Get WindowsCodePage ( ) As Long

Return Values

Long - The Windows code page for this encoding.

Read Only.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview


UTF32Encoding

UTF32Encoding

Represents a UTF-32 encoding of Unicode characters.

Implements:

Encoding
IObject

Public:

Properties:

Name | Description
BodyName (get) | Gets the name of the current encoding that can be used with the mail agent body tags.
CodePage (get) | gets the code page identifier of the current Encoding.
DecoderFallback (get) | Gets the current DecoderFallback instance used by the encoding.
DecoderFallback (set) | Sets the DecoderFallback to be used by this encoding instance.
EncoderFallback (get) | Gets the current EncoderFallback instance used by the encoding.
EncoderFallback (set) | Sets the EncoderFallback to be used by this encoding instance.
EncodingName (get) | gets the human-readable description of the current encoding.
HeaderName (get) | gets a name for the current encoding that can be used with mail agent header tags.
IsBrowserDisplay (get) | Gets if this encoding can be used by browsers to display text.
IsBrowserSave (get) | Gets if this encoding can be used to save data with this encoding.
IsMailNewsDisplay (get) | Gets if this encoding can be used to display mail and news by mail and news clients.
IsMailNewsSave (get) | Gets if this encoding can be used to save date by mail and news clients.
IsReadOnly (get) | Gets a value indicating whether the current encoding is read-only.
IsSingleByte (get) | Gets if the current encoding uses single-byte code points.
WebName (get) | Gets the encoding name registered with the Internet Assigned Numbers Authority.
WindowsCodePage (get) | Gets the Windows Operating Systems code page for this encoding.

Methods:

Name | Description
Clone | Creates a clone of the current Encoding instance.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetByteCount | Returns the number of bytes that would be produced from the set of characters using this encoding.
GetBytes | Encodes a set of characters into an array of bytes.
GetBytesEx | Encodes a set of characters into an array of bytes, returning the number of bytes produced.
GetCharCount | Returns the number of characters that would be produced by decoding a byte array.
GetChars | Decodes a set of bytes into a set of characters.
GetCharsEx | Decodes a set of bytes into the supplied Integer array.
GetDecoder | Obtains a decoder that converts an ASCII encoded sequence of bytes into a sequence of Unicode characters.
GetEncoder | Obtains an encoder that converts a sequence of Unicode characters into an ASCII encoded sequence of bytes.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetMaxByteCount | Returns the maximum number of bytes that can be created from a specific number of characters.
GetMaxCharCount | Returns the maximum number of characters than can be decoded from the number of bytes specified.
GetPreamble | Returns a Unicode byte order mark encoded in UTF-32 format, if the UTF32Encoding object is configured to supply one.
GetString | Decodes a range of bytes into a String.
ToString | Returns a string representation of this object instance.

Remarks

Encoding is the process of transforming a set of Unicode characters into a sequence of bytes. Decoding is the process of transforming a sequence of encoded bytes into a set of Unicode characters.

The UTF-32 encoding represents each code point as a 32-bit integer.

The GetByteCount method determines how many bytes result in encoding a set of Unicode characters, and the GetBytes method performs the actual encoding.

Likewise, the GetCharCount method determines how many characters result in decoding a sequence of bytes, and the GetChars and GetString methods perform the actual decoding.

UTF32Encoding corresponds to the Windows code pages 12000 (little endian byte order) and 12001 (big endian byte order).

The encoder can use the big endian byte order (most significant byte first) or the little endian byte order (least significant byte first). For example, the Latin Capital Letter A (code point U+0041) is serialized as follows (in hexadecimal):
  • Big endian byte order: 00 00 00 41
  • Little endian byte order: 41 00 00 00

It is generally more efficient to store Unicode characters using the native byte order. For example, it is better to use the little endian byte order on little endian platforms, such as Intel computers.

The GetPreamble method retrieves an array of bytes that can include the byte order mark (BOM). If this byte array is prefixed to an encoded stream, it helps the decoder to identify the encoding format used.

For more information on byte order and the byte order mark, see The Unicode Standard at the Unicode home page.

Public Sub Main()
    Dim U32LE       As UTF32Encoding
    Dim U32withED   As UTF32Encoding
    Dim U32noED     As UTF32Encoding
    Dim MyStr       As String
    Dim MyBytes()   As Byte

    Set Console.OutputEncoding = Encoding.UTF8

    ' Create an instance of UTF32Encoding using little-endian byte order.
    ' This will be used for encoding.
    Set U32LE = NewUTF32Encoding(False, True)

    ' Create two instances of UTF32Encoding using big-endian byte order: one with error detection and one without.
    ' These will be used for decoding.
    Set U32withED = NewUTF32Encoding(True, True, True)
    Set U32noED = NewUTF32Encoding(True, True, False)

    ' Create byte arrays from the same string containing the following characters:
    '    Latin Small Letter Z (U+007A)
    '    Latin Small Letter A (U+0061)
    '    Combining Breve (U+0306)
    '    Latin Small Letter AE With Acute (U+01FD)
    '    Greek Small Letter Beta (U+03B2)
    '    a high-surrogate value (U+D8FF)
    '    a low-surrogate value (U+DCFF)
    MyStr = t("za\u0306\u01FD\u03B2\uD8FF\uDCFF")

    ' Encode the string using little-endian byte order.
    ReDim MyBytes(0 To U32LE.GetByteCount(MyStr) - 1)
    U32LE.GetBytesEx MyStr, 0, Len(MyStr), MyBytes, 0

    ' Decode the byte array with error detection.
    Console.WriteLine "Decoding with error detection:"
    PrintDecodedString MyBytes, U32withED

    ' Decode the byte array without error detection.
    Console.WriteLine "Decoding without error detection:"
    PrintDecodedString MyBytes, U32noED

    Console.ReadKey
End Sub

Private Sub PrintDecodedString(ByRef Bytes() As Byte, ByVal Enc As Encoding)
    On Error GoTo Catch

    Console.WriteLine "  Decoded string: {0}", Enc.GetString(Bytes)

    GoTo Finally

Catch:
    Dim Ex As Exception
    Catch Ex, Err
    Console.WriteLine Ex.ToString
Finally:
    Console.WriteLine
End Sub

See Also

Project CorLib Overview

Class UTF32Encoding Overview

ASCIIEncoding

UTF7Encoding

UTF8Encoding

UnicodeEncoding


UTF32Encoding: BodyName (get)

BodyName

Gets the name of the current encoding that can be used with the mail agent body tags.

 Public Property Get BodyName ( ) As String

Return Values

String - A name for the current Encoding that can be used with mail agent body tags.
-or-
An empty string (""), if the current Encoding cannot be used.

Read Only.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: Clone

Clone

Creates a clone of the current Encoding instance.

 Public Function Clone ( ) As UTF32Encoding

Return Values

UTF32Encoding - A cloned version of this instance.

Remarks

A cloned instance will have the read-only limitations removed.

See Also

Project CorLib Overview

Class UTF32Encoding Overview


UTF32Encoding: CodePage (get)

CodePage

gets the code page identifier of the current Encoding.

 Public Property Get CodePage ( ) As Long

Return Values

Long - Code page identifier of the current Encoding

Read Only.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: DecoderFallback (get)

DecoderFallback

Gets the current DecoderFallback instance used by the encoding.

 Public Property Get DecoderFallback ( ) As DecoderFallback

Return Values

DecoderFallback - An object derived from DecoderFallback.

Remarks

The default will return an instance of DecoderReplacementFallback.

Read/Write.

See Also

Project CorLib Overview

Class UTF32Encoding Overview


UTF32Encoding: DecoderFallback (set)

DecoderFallback

Sets the DecoderFallback to be used by this encoding instance.

 Public Property Set DecoderFallback(
      ByVal Value As DecoderFallback )

Parameters

Value
[ByVal] DecoderFallback. The DecoderFallback instance to set.

Remarks

By default an Encoding instance is marked as read-only and setting this value will result in an InvalidOperationException being thrown. If a clone of the instance is made, then it will become read-write and allow the setting of the value.

Read/Write.

See Also

Project CorLib Overview

Class UTF32Encoding Overview


UTF32Encoding: EncoderFallback (get)

EncoderFallback

Gets the current EncoderFallback instance used by the encoding.

 Public Property Get EncoderFallback ( ) As EncoderFallback

Return Values

EncoderFallback - An object derived from EncoderFallback.

Remarks

The default will return an instance of EncoderReplacementFallback.

Read/Write.

See Also

Project CorLib Overview

Class UTF32Encoding Overview


UTF32Encoding: EncoderFallback (set)

EncoderFallback

Sets the EncoderFallback to be used by this encoding instance.

 Public Property Set EncoderFallback(
      ByVal Value As EncoderFallback )

Parameters

Value
[ByVal] EncoderFallback. The EncoderFallback instance to set.

Remarks

By default an Encoding instance is marked as read-only and setting this value will result in an InvalidOperationException being thrown. If a clone of the instance is made, then it will become read-write and allow the setting of the value.

Read/Write.

See Also

Project CorLib Overview

Class UTF32Encoding Overview


UTF32Encoding: Encoding

Encoding

 Implements Encoding

Return Values

Encoding -

See Also

Project CorLib Overview

Class UTF32Encoding Overview


UTF32Encoding: EncodingName (get)

EncodingName

gets the human-readable description of the current encoding.

 Public Property Get EncodingName ( ) As String

Return Values

String - The human-readable description of the current Encoding.

Remarks

The EncodingName property is intended for display. To find a name that can be passed to the GetEncoding method, use the WebName property.

Read Only.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

IObject


UTF32Encoding: GetByteCount

GetByteCount

Returns the number of bytes that would be produced from the set of characters using this encoding.

 Public Function GetByteCount(
      ByRef Chars As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Chars
[ByRef] Variant. The character array containing the set of characters to encode.
Index
[ByRef] Optional. Variant. The index of the first character to encode.
Count
[ByRef] Optional. Variant. The number of characters to encode.

Return Values

Long - The number of bytes produced by encoding the specified characters.

Remarks

The Chars parameter will accept either a String or an Integer array.

If Chars is a string then the Index parameter is zero-based.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: GetBytes

GetBytes

Encodes a set of characters into an array of bytes.

 Public Function GetBytes(
      ByRef Chars As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Chars
[ByRef] Variant. The set of characters to be encoded into an array of bytes.
Index
[ByRef] Optional. Variant. The index of the first character to begin encoding from.
Count
[ByRef] Optional. Variant. The number of characters to be encoded.

Return Values

Byte() - A byte array containing the encoded characters as bytes.

Remarks

The Chars parameter will accept either a String or an Integer array.

If Chars is a string then the Index parameter is zero-based.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: GetBytesEx

GetBytesEx

Encodes a set of characters into an array of bytes, returning the number of bytes produced.

 Public Function GetBytesEx(
      ByRef Chars As Variant,
      ByVal CharIndex As Long,
      ByVal CharCount As Long,
      ByRef Bytes ( ) As Byte,
      ByVal ByteIndex As Long ) As Long

Parameters

Chars
[ByRef] Variant. the set of characters to be encoded into bytes.
CharIndex
[ByVal] Long. The index of the first character to begin encoding from.
CharCount
[ByVal] Long. The number of characters to be encoded.
Bytes
[ByRef] Byte. The destination for the encoded characters.
ByteIndex
[ByVal] Long. The index of the first byte stored in the destination array.

Return Values

Long - The number of bytes produce by the encoding.

Remarks

The Bytes array cannot be null and must be large enough to hold the encoded set of characters. To obtain the size required, use GetByteCount to find the necessary size. Or, use GetMaxByteCount to get the largest size that could be produced. The largest size is not the perfect size, only the maximum number of bytes that could ever be produced by a number of characters. Resizing of the resultant Bytes array may be necessary.

The Chars parameter will accept either a String or an Integer array.

If Chars is a string then the CharIndex parameter is zero-based.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: GetCharCount

GetCharCount

Returns the number of characters that would be produced by decoding a byte array.

 Public Function GetCharCount(
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Bytes
[ByRef] Byte. The bytes to use when calculating the number of characters.
Index
[ByRef] Optional. Variant. The starting index in Bytes to being calculating from.
Count
[ByRef] Optional. Variant. The number of bytes to be used in the calculation.

Return Values

Long - The number of characters that would be decoded from the set of bytes.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: GetChars

GetChars

Decodes a set of bytes into a set of characters.

 Public Function GetChars(
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Integer ( )

Parameters

Bytes
[ByRef] Byte. The set of bytes to be decoded into characters.
Index
[ByRef] Optional. Variant. The index of the first byte to be used in decoding.
Count
[ByRef] Optional. Variant. The number of bytes to be used in decoding.

Return Values

Integer() - An array of characters decoded from the set of bytes.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: GetCharsEx

GetCharsEx

Decodes a set of bytes into the supplied Integer array.

 Public Function GetCharsEx(
      ByRef Bytes ( ) As Byte,
      ByVal ByteIndex As Long,
      ByVal ByteCount As Long,
      ByRef Chars ( ) As Integer,
      ByVal CharIndex As Long ) As Long

Parameters

Bytes
[ByRef] Byte. The set of bytes to be decoded into characters.
ByteIndex
[ByVal] Long. The index of the first byte to begin decoding from.
ByteCount
[ByVal] Long. The number of bytes to be used in decoding.
Chars
[ByRef] Integer. The destination character array for the decoded bytes.
CharIndex
[ByVal] Long. The first index to begin storing decoded bytes in Chars.

Return Values

Long - The number of characters decoded from the array of bytes.

Remarks

The Chars array must be large enough to handle all the bytes that will be decoded. To ensure the Chars array is large enough, use either GetCharCount or GetMaxCharCount to determine a size that will hold the decoded bytes.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: GetDecoder

GetDecoder

Obtains a decoder that converts an ASCII encoded sequence of bytes into a sequence of Unicode characters.

 Public Function GetDecoder ( ) As Decoder

Return Values

Decoder - A Decoder that converts an ASCII encoded sequence of bytes into a sequence of Unicode characters.

Remarks

The Decoder.GetChars method converts sequential blocks of bytes into sequential blocks of characters, in a manner similar to the GetChars method of this class. However, a Decoder maintains state information between calls so it can correctly decode byte sequences that span blocks. The Decoder also preserves trailing bytes at the end of data blocks and uses the trailing bytes in the next decoding operation. Therefore, GetDecoder and GetEncoder are useful for network transmission and file operations, because those operations often deal with blocks of data instead of a complete data stream.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: GetEncoder

GetEncoder

Obtains an encoder that converts a sequence of Unicode characters into an ASCII encoded sequence of bytes.

 Public Function GetEncoder ( ) As Encoder

Return Values

Encoder - An Encoder that converts a sequence of Unicode characters into an ASCII encoded sequence of bytes.

Remarks

The Encoder.GetBytes method converts sequential blocks of characters into sequential blocks of bytes, in a manner similar to the GetBytes method of this class. However, an Encoder maintains state information between calls so it can correctly encode character sequences that span blocks. The Encoder also preserves trailing characters at the end of data blocks and uses the trailing characters in the next encoding operation. For example, a data block might end with an unmatched high surrogate, and the matching low surrogate might be in the next data block. Therefore, Project CorLib Overview

Class UTF32Encoding Overview


UTF32Encoding: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

IObject


UTF32Encoding: GetMaxByteCount

GetMaxByteCount

Returns the maximum number of bytes that can be created from a specific number of characters.

 Public Function GetMaxByteCount(
      ByVal CharCount As Long ) As Long

Parameters

CharCount
[ByVal] Long. The number of characters to be encoded.

Return Values

Long - The maximum number of bytes that can be generated from the specified number of characters.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: GetMaxCharCount

GetMaxCharCount

Returns the maximum number of characters than can be decoded from the number of bytes specified.

 Public Function GetMaxCharCount(
      ByVal ByteCount As Long ) As Long

Parameters

ByteCount
[ByVal] Long. The number of bytes to be decoded.

Return Values

Long - The maximum number of characters that can be decoded from the specified number of bytes.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | ByteCount is less than zero. -or- The resulting number of bytes is greater than the maximum number that can be returned as an integer.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: GetPreamble

GetPreamble

Returns a Unicode byte order mark encoded in UTF-32 format, if the UTF32Encoding object is configured to supply one.

 Public Function GetPreamble ( ) As Byte ( )

Return Values

Byte() - A byte array containing the Unicode byte order mark, if the UTF32Encoding object is configured to supply one. Otherwise, this method returns a zero-length byte array

See Encoding.GetPreamble for additional information.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: GetString

GetString

Decodes a range of bytes into a String.

 Public Function GetString(
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As String

Parameters

Bytes
[ByRef] Byte. The set of bytes to be decoded into a string.
Index
[ByRef] Optional. Variant. The index of the first byte to be decoded.
Count
[ByRef] Optional. Variant. The number of bytes to be used in the decoding.

Return Values

String - A string containing the decoded set of bytes.

Exceptions

Exception | Condition
ArgumentNullException | Bytes is null.
ArgumentOutOfRangeException | Index is less than the lower-bound of Bytes. -or- Count is less than zero. -or- Index and Count do not denote a valid range in Bytes.
DecoderFallbackException | A fallback occurred -and- DecoderFallback is set to DecoderExceptionFallback.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: HeaderName (get)

HeaderName

gets a name for the current encoding that can be used with mail agent header tags.

 Public Property Get HeaderName ( ) As String

Return Values

String - A name for the current Encoding that can be used with mail agent body tags.
-or-
An empty string (""), if the current Encoding cannot be used.

Read Only.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class UTF32Encoding Overview


UTF32Encoding: IsBrowserDisplay (get)

IsBrowserDisplay

Gets if this encoding can be used by browsers to display text.

 Public Property Get IsBrowserDisplay ( ) As Boolean

Return Values

Boolean - The indication for browser display capable.

Read Only.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: IsBrowserSave (get)

IsBrowserSave

Gets if this encoding can be used to save data with this encoding.

 Public Property Get IsBrowserSave ( ) As Boolean

Return Values

Boolean - The indication for the browser saving capable.

Read Only.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: IsMailNewsDisplay (get)

IsMailNewsDisplay

Gets if this encoding can be used to display mail and news by mail and news clients.

 Public Property Get IsMailNewsDisplay ( ) As Boolean

Return Values

Boolean - Indication for mail and news client capable.

Read Only.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: IsMailNewsSave (get)

IsMailNewsSave

Gets if this encoding can be used to save date by mail and news clients.

 Public Property Get IsMailNewsSave ( ) As Boolean

Return Values

Boolean - Indication for the mail and news clients to use this encoding for saving.

Read Only.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: IsReadOnly (get)

IsReadOnly

Gets a value indicating whether the current encoding is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - True if the current Encoding is read-only; otherwise, False.

Read Only.

See Also

Project CorLib Overview

Class UTF32Encoding Overview


UTF32Encoding: IsSingleByte (get)

IsSingleByte

Gets if the current encoding uses single-byte code points.

 Public Property Get IsSingleByte ( ) As Boolean

Return Values

Boolean - True for single-byte, False for multi-byte code points.

Remarks

This always returns False.

Read Only.

See Also

Project CorLib Overview

Class UTF32Encoding Overview


UTF32Encoding: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

IObject


UTF32Encoding: WebName (get)

WebName

Gets the encoding name registered with the Internet Assigned Numbers Authority.

 Public Property Get WebName ( ) As String

Return Values

String - The registered IANA name for the current Encoding.

Read Only.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF32Encoding: WindowsCodePage (get)

WindowsCodePage

Gets the Windows Operating Systems code page for this encoding.

 Public Property Get WindowsCodePage ( ) As Long

Return Values

Long - The Windows code page for this encoding.

Read Only.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding


UTF7Encoding

UTF7Encoding

Represents a UTF-7 encoding of Unicode characters.

Implements:

Encoding
ICloneable
IObject

Public:

Properties:

Name | Description
BodyName (get) | Gets the encoding name to be used in with the mail agent body tags.
CodePage (get) | Gets the code page identifier for this encoding.
DecoderFallback (get) | Gets the current DecoderFallback instance used by the encoding.
DecoderFallback (set) | Sets the DecoderFallback to be used by this encoding instance.
EncoderFallback (get) | Gets the current EncoderFallback instance used by the encoding.
EncoderFallback (set) | Sets the EncoderFallback to be used by this encoding instance.
EncodingName (get) | Gets the name of this encoding.
HeaderName (get) | Gets the encoding name to be used in with the mail agent header tags.
IsBrowserDisplay (get) | Gets if this encoding can be used by browsers to display text.
IsBrowserSave (get) | Gets if this encoding can be used to save data with this encoding.
IsMailNewsDisplay (get) | Gets if this encoding can be used to display mail and news by mail and news clients.
IsMailNewsSave (get) | Gets if this encoding can be used to save date by mail and news clients.
IsReadOnly (get) | When implemented in a derived class, gets a value indicating whether the current encoding is read-only.
IsSingleByte (get) | Gets if the current encoding uses single-byte code points.
WebName (get) | Gets the encoding name registered with the Internet Assigned Numbers Authority.
WindowsCodePage (get) | Gets the Windows Operating Systems code page for this encoding.

Methods:

Name | Description
Clone | Creates a clone of the current Encoding instance.
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetByteCount | Returns the number of bytes that would be produced from the set of characters using this encoding.
GetBytes | Encodes a set of characters into an array of bytes.
GetBytesEx | Encodes a set of characters into an array of bytes, returning the number of bytes produced.
GetCharCount | Returns the number of characters that would be produced by decoding a byte array.
GetChars | Decodes a set of bytes into a set of characters.
GetCharsEx | Decodes a set of bytes into the supplied Integer array.
GetDecoder | Returns a decoder that maintains state.
GetEncoder | Returns an encoder that maintains state.
GetHashCode | Returns a pseudo-unique number identifying this instance.
GetMaxByteCount | Returns the maximum number of bytes that can be created from a specific number of characters.
GetMaxCharCount | Returns the maximum number of characters than can be decoded from the number of bytes specified.
GetPreamble | Returns an array of bytes that represents this encoding.
GetString | Decodes a set of bytes into a String.
ToString | Returns a string representation of this object instance.

Remarks

Encoding is the process of transforming a set of Unicode characters into a sequence of bytes. Decoding is the process of transforming a sequence of encoded bytes into a set of Unicode characters.

The UTF-7 encoding represents Unicode characters as sequences of 7-bit ASCII characters. This encoding supports certain protocols for which it is required, most often e-mail or newsgroup protocols. Since UTF-7 is not particularly secure or robust, and most modern systems allow 8-bit encodings, UTF-8 should normally be preferred to UTF-7.

Caution
UTF7Encoding does not provide error detection. For security reasons, you should use UTF8Encoding, UnicodeEncoding, or UTF32Encoding and enable error detection.

Information about the UTF-7 encoding scheme can be found at http://www.faqs.org/rfcs/rfc2152.html.

The GetByteCount method determines how many bytes result in encoding a set of Unicode characters, and the GetBytes method performs the actual encoding.

Likewise, the GetCharCount method determines how many characters result in decoding a sequence of bytes, and the GetChars and GetString methods perform the actual decoding.

UTF7Encoding corresponds to the Windows code page 65000.

Examples

The following code example demonstrates how to use a UTF7Encoding to encode a string of Unicode characters and store them in a byte array. Notice that when the byte array is decoded back to a string, no data is lost.

Public Sub Main()
    Dim UTF7            As New UTF7Encoding
    Dim UnicodeString   As String
    Dim EncodedBytes()  As Byte
    Dim DecodedString   As String
    Dim b               As Variant

    Set Console.OutputEncoding = Encoding.UTF8

    ' A Unicode string with two characters outside a 7-bit code range.
    UnicodeString = t("This Unicode string contains two characters with codes outside a 7-bit code range, Pi (\u03a0) and Sigma (\u03a3).")

    Console.WriteLine "Original string:"
    Console.WriteLine UnicodeString

    ' Encode the string.
    EncodedBytes = UTF7.GetBytes(UnicodeString)
    Console.WriteLine
    Console.WriteLine "Encoded bytes:"

    For Each b In EncodedBytes
        Console.WriteValue "[{0}]", b
    Next

    Console.WriteLine

    ' Decode bytes back to string.
    ' Notice Pi and Sigma characters are still present.
    DecodedString = UTF7.GetString(EncodedBytes)
    Console.WriteLine
    Console.WriteLine "Decoded bytes:"
    Console.WriteLine DecodedString
    Console.ReadKey
End Sub

See Also

Project CorLib Overview

Class UTF7Encoding Overview

Constructors

Encoding

ASCIIEncoding

UTF8Encoding

UTF32Encoding

UnicodeEncoding


UTF7Encoding: BodyName (get)

BodyName

Gets the encoding name to be used in with the mail agent body tags.

 Public Property Get BodyName ( ) As String

Return Values

String - The body tag compatible encoding name.

Read Only.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: Clone

Clone

Creates a clone of the current Encoding instance.

 Public Function Clone ( ) As UTF7Encoding

Return Values

UTF7Encoding - A cloned instance of a UTF7Encoding object.

Remarks

A cloned instance will have the read-only limitations removed.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: CodePage (get)

CodePage

Gets the code page identifier for this encoding.

 Public Property Get CodePage ( ) As Long

Return Values

Long - Code page identifier.

Read Only.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: DecoderFallback (get)

DecoderFallback

Gets the current DecoderFallback instance used by the encoding.

 Public Property Get DecoderFallback ( ) As DecoderFallback

Return Values

DecoderFallback - An object derived from DecoderFallback.

Remarks

The default will return an instance of DecoderReplacementFallback.

Read/Write.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: DecoderFallback (set)

DecoderFallback

Sets the DecoderFallback to be used by this encoding instance.

 Public Property Set DecoderFallback(
      ByVal Value As DecoderFallback )

Parameters

Value
[ByVal] DecoderFallback. The DecoderFallback instance to set.

Remarks

By default an Encoding instance is marked as read-only and setting this value will result in an InvalidOperationException being thrown. If a clone of the instance is made, then it will become read-write and allow the setting of the value.

Read/Write.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: EncoderFallback (get)

EncoderFallback

Gets the current EncoderFallback instance used by the encoding.

 Public Property Get EncoderFallback ( ) As EncoderFallback

Return Values

EncoderFallback - An object derived from EncoderFallback.

Remarks

The default will return an instance of EncoderReplacementFallback.

Read/Write.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: EncoderFallback (set)

EncoderFallback

Sets the EncoderFallback to be used by this encoding instance.

 Public Property Set EncoderFallback(
      ByVal Value As EncoderFallback )

Parameters

Value
[ByVal] EncoderFallback. The EncoderFallback instance to set.

Remarks

By default an Encoding instance is marked as read-only and setting this value will result in an InvalidOperationException being thrown. If a clone of the instance is made, then it will become read-write and allow the setting of the value.

Read/Write.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: Encoding

Encoding

 Implements Encoding

Return Values

Encoding -

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: EncodingName (get)

EncodingName

Gets the name of this encoding.

 Public Property Get EncodingName ( ) As String

Return Values

String - The encodings name.

Read Only.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equality to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: GetByteCount

GetByteCount

Returns the number of bytes that would be produced from the set of characters using this encoding.

 Public Function GetByteCount(
      ByRef Chars As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Chars
[ByRef] Variant. A set of characters used to calculated the number of bytes once encoded with this encoding.
Index
[ByRef] Optional. Variant. The starting index of the first character to be used.
Count
[ByRef] Optional. Variant. The number of characters to include in the calculation.

Return Values

Long - The number of bytes that would be produced by encoding the set of characters.

Remarks

The Chars parameter will accept either a String or an Integer array. The Index is zero based for both the String and Integer array, not 1 based like Mid$.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: GetBytes

GetBytes

Encodes a set of characters into an array of bytes.

 Public Function GetBytes(
      ByRef Chars As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Chars
[ByRef] Variant. The set of characters to be encoded into an array of bytes. This can be either an Integer array or a String.
Index
[ByRef] Optional. Variant. The index of the first character to begin encoding from.
Count
[ByRef] Optional. Variant. The number of characters to be encoded.

Return Values

Byte() - A byte array containing the encoded characters as bytes.

Remarks

The Chars parameter will accept either a String or an Integer array. The Index is zero based for both the String and Integer array, not 1 based like Mid$.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: GetBytesEx

GetBytesEx

Encodes a set of characters into an array of bytes, returning the number of bytes produced.

 Public Function GetBytesEx(
      ByRef Chars As Variant,
      ByVal CharIndex As Long,
      ByVal CharCount As Long,
      ByRef Bytes ( ) As Byte,
      ByVal ByteIndex As Long ) As Long

Parameters

Chars
[ByRef] Variant. the set of characters to be encoded into bytes. This can be either an Integer array or a String.
CharIndex
[ByVal] Long. The index of the first character to begin encoding from.
CharCount
[ByVal] Long. The number of characters to be encoded.
Bytes
[ByRef] Byte. The destination for the encoded characters.
ByteIndex
[ByVal] Long. The index of the first byte stored in the destination array.

Return Values

Long - The number of bytes produce by the encoding.

Remarks

The Bytes array cannot be null and must be large enough to hold the encoded set of characters. To obtain the size required, use GetByteCount to find the necessary size. Or, use GetMaxByteCount to get the largest size that could be produced. The largest size is not the perfect size, only the maximum number of bytes that could ever be produced by a number of characters. Resizing of the resultant Bytes array may be necessary.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: GetCharCount

GetCharCount

Returns the number of characters that would be produced by decoding a byte array.

 Public Function GetCharCount(
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Bytes
[ByRef] Byte. The bytes to use when calculating the number of characters.
Index
[ByRef] Optional. Variant. The starting index in Bytes to being calculating from.
Count
[ByRef] Optional. Variant. The number of bytes to be used in the calculation.

Return Values

Long - The number of characters that would be decoded from the set of bytes.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: GetChars

GetChars

Decodes a set of bytes into a set of characters.

 Public Function GetChars(
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Integer ( )

Parameters

Bytes
[ByRef] Byte. The set of bytes to be decoded into characters.
Index
[ByRef] Optional. Variant. The index of the first byte to be used in decoding.
Count
[ByRef] Optional. Variant. The number of bytes to be used in decoding.

Return Values

Integer() - An array of characters decoded from the set of bytes.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: GetCharsEx

GetCharsEx

Decodes a set of bytes into the supplied Integer array.

 Public Function GetCharsEx(
      ByRef Bytes ( ) As Byte,
      ByVal ByteIndex As Long,
      ByVal ByteCount As Long,
      ByRef Chars ( ) As Integer,
      ByVal CharIndex As Long ) As Long

Parameters

Bytes
[ByRef] Byte. The set of bytes to be decoded into characters.
ByteIndex
[ByVal] Long. The index of the first byte to begin decoding from.
ByteCount
[ByVal] Long. The number of bytes to be used in decoding.
Chars
[ByRef] Integer. The destination character array for the decoded bytes.
CharIndex
[ByVal] Long. The first index to begin storing decoded bytes in Chars.

Return Values

Long - The number of characters decoded from the array of bytes.

Remarks

The Chars array must be large enough to handle all the bytes that will be decoded. To ensure the Chars array is large enough, use either GetCharCount or GetMaxCharCount to determine a size that will hold the decoded bytes.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: GetDecoder

GetDecoder

Returns a decoder that maintains state.

 Public Function GetDecoder ( ) As Decoder

Return Values

Decoder - The stateful decoder.

Remarks

Unlike UTF8Encoding, the decoder maintains state between decoding calls. this allows for a sequence of bytes to not have to be in the same call in order to be decoded to the representive character. All characters other than directly encodable characters are encoded in a modified Base64 encoding, which can be require 3 bytes to decode to a single character. This decoder allows the Base64 encoded byte set to be decoded across multiple calls and still be decoded as a single set of bytes. A multi-byte encoded characters does not need to be in the same call in order to be decoded properly.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: GetEncoder

GetEncoder

Returns an encoder that maintains state.

 Public Function GetEncoder ( ) As Encoder

Return Values

Encoder - The stateful encoder.

Remarks

Unlike UTF7Encoding, the encoder maintains state between encoding calls. This allows for a set of characters to be split up but still be encoded as a single set of characters. This will allow Modified Base64 encoding to continue between encoding calls.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: GetMaxByteCount

GetMaxByteCount

Returns the maximum number of bytes that can be created from a specific number of characters.

 Public Function GetMaxByteCount(
      ByVal CharCount As Long ) As Long

Parameters

CharCount
[ByVal] Long. The number of characters to be encoded.

Return Values

Long - The maximum number of bytes that can be generated from the specified number of characters.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: GetMaxCharCount

GetMaxCharCount

Returns the maximum number of characters than can be decoded from the number of bytes specified.

 Public Function GetMaxCharCount(
      ByVal ByteCount As Long ) As Long

Parameters

ByteCount
[ByVal] Long. The number of bytes to be decoded.

Return Values

Long - The maximum number of characters that can be decoded from the specified number of bytes.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: GetPreamble

GetPreamble

Returns an array of bytes that represents this encoding.

 Public Function GetPreamble ( ) As Byte ( )

Return Values

Byte() - A byte array containg the bytes to be used to identify this encoding type.

Remarks

There is no identifier for UTF7 so an empty array is returned.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: GetString

GetString

Decodes a set of bytes into a String.

 Public Function GetString(
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As String

Parameters

Bytes
[ByRef] Byte. The set of bytes to be decoded into a string.
Index
[ByRef] Optional. Variant. The index of the first byte to be decoded.
Count
[ByRef] Optional. Variant. The number of bytes to be used in the decoding.

Return Values

String - A string containing the decoded set of bytes.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: HeaderName (get)

HeaderName

Gets the encoding name to be used in with the mail agent header tags.

 Public Property Get HeaderName ( ) As String

Return Values

String - The header tag compatible encoding name.

Read Only.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: IsBrowserDisplay (get)

IsBrowserDisplay

Gets if this encoding can be used by browsers to display text.

 Public Property Get IsBrowserDisplay ( ) As Boolean

Return Values

Boolean - The indication for browser display capable.

Read Only.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: IsBrowserSave (get)

IsBrowserSave

Gets if this encoding can be used to save data with this encoding.

 Public Property Get IsBrowserSave ( ) As Boolean

Return Values

Boolean - The indication for the browser saving capable.

Read Only.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: IsMailNewsDisplay (get)

IsMailNewsDisplay

Gets if this encoding can be used to display mail and news by mail and news clients.

 Public Property Get IsMailNewsDisplay ( ) As Boolean

Return Values

Boolean - Indication for mail and news client capable.

Read Only.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: IsMailNewsSave (get)

IsMailNewsSave

Gets if this encoding can be used to save date by mail and news clients.

 Public Property Get IsMailNewsSave ( ) As Boolean

Return Values

Boolean - Indication for the mail and news clients to use this encoding for saving.

Read Only.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: IsReadOnly (get)

IsReadOnly

When implemented in a derived class, gets a value indicating whether the current encoding is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - True if the current Encoding is read-only; otherwise, False. The default is True.

Read Only.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: IsSingleByte (get)

IsSingleByte

Gets if the current encoding uses single-byte code points.

 Public Property Get IsSingleByte ( ) As Boolean

Return Values

Boolean - Returns True for single-byte, False for multi-byte code points.

Read Only.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: WebName (get)

WebName

Gets the encoding name registered with the Internet Assigned Numbers Authority.

 Public Property Get WebName ( ) As String

Return Values

String - The registered encoding name.

Read Only.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF7Encoding: WindowsCodePage (get)

WindowsCodePage

Gets the Windows Operating Systems code page for this encoding.

 Public Property Get WindowsCodePage ( ) As Long

Return Values

Long - The Windows code page for this encoding.

Read Only.

See Also

Project CorLib Overview

Class UTF7Encoding Overview


UTF8Encoding

UTF8Encoding

A set of functions to be used to convert character arrays to and from byte arrays.

Implements:

Encoding
ICloneable
IObject

Public:

Properties:

Name | Description
BodyName (get) | Gets the encoding name to be used in with the mail agent body tags.
CodePage (get) | Gets the code page identifier for this encoding.
DecoderFallback (get) | Gets the DecoderFallback object for the current Encoding object.
DecoderFallback (set) | Sets the DecoderFallback object for the current Encoding object.
EncoderFallback (get) | Gets the EncoderFallback object for the current Encoding object.
EncoderFallback (set) | Sets the EncoderFallback object for the current Encoding object.
EncodingName (get) | Gets the human-readable description of the current encoding.
HeaderName (get) | Gets the encoding name to be used in with the mail agent header tags.
IsBrowserDisplay (get) | Gets if this encoding can be used by browsers to display text.
IsBrowserSave (get) | Gets if this encoding can be used to save data with this encoding.
IsMailNewsDisplay (get) | Gets if this encoding can be used to display mail and news by mail and news clients.
IsMailNewsSave (get) | Gets if this encoding can be used to save data by mail and news clients.
IsReadOnly (get) | When implemented in a derived class, gets a value indicating whether the current encoding is read-only.
IsSingleByte (get) | Gets if the current encoding uses single-byte code points.
WebName (get) | Gets the encoding name registered with the Internet Assigned Numbers Authority.
WindowsCodePage (get) | Gets the Windows Operating Systems code page for this encoding.

Methods:

Name | Description
Clone | Creates a clone of the current Encoding instance.
Equals | Determines whether the specified value is equal to the current UTF8Encoding object.
GetByteCount | Calculates the number of bytes produced by encoding the characters in the specified String or Integer().
GetBytes | Encodes all the characters in the specified character array or string into a sequence of bytes.
GetBytesEx | Encodes a set of characters into an array of bytes, returning the number of bytes produced.
GetCharCount | Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
GetChars | Decodes a sequence of bytes from the specified byte array into a set of characters.
GetCharsEx | Decodes a sequence of bytes from the specified byte array into the specified character array.
GetDecoder | Obtains a decoder that converts a UTF-8 encoded sequence of bytes into a sequence of Unicode characters.
GetEncoder | Obtains an encoder that converts a sequence of Unicode characters into a UTF-8 encoded sequence of bytes.
GetHashCode | Returns the hash code for the current instance.
GetMaxByteCount | Calculates the maximum number of bytes produced by encoding the specified number of characters.
GetMaxCharCount | Calculates the maximum number of characters produced by decoding the specified number of bytes.
GetPreamble | Returns a Unicode byte order mark encoded in UTF-8 format, if the constructor for this instance requests a byte order mark.
GetString | Decodes a range of bytes from a byte array into a string.
ToString | Returns a string representation of the current object.

Remarks

Encoding is the process of transforming a set of Unicode characters into a sequence of bytes. Decoding is the process of transforming a sequence of encoded bytes into a set of Unicode characters.

UTF-8 encoding represents each code point as a sequence of one to four bytes.

The GetByteCount method determines how many bytes result in encoding a set of Unicode characters, and the GetBytes method performs the actual encoding.

Likewise, the GetCharCount method determines how many characters result in decoding a sequence of bytes, and the GetChars and GetString methods perform the actual decoding.

UTF8Encoding corresponds to the Windows code page 65001.

Optionally, the UTF8Encoding object provides a preamble, which is an array of bytes that can be prefixed to the sequence of bytes resulting from the encoding process. If the preamble contains a byte order mark (BOM), it helps the decoder determine the byte order and the transformation format or UTF. The GetPreamble method retrieves an array of bytes that can include the BOM. For more information on byte order and the byte order mark, see The Unicode Standard at the Unicode home page.

Note
To enable error detection and to make the class instance more secure, the application should use the UTF8Encoding constructor that takes a ThrowOnInvalidBytes parameter and set that parameter to true. With error detection, a method that detects an invalid sequence of characters or bytes throws a ArgumentException. Without error detection, no exception is thrown, and the invalid sequence is generally ignored.

Examples

The following example demonstrates how to use a UTF8Encoding to encode a string of Unicode characters and store them in a byte array. Notice that when encodedBytes is decoded back to a string there is no loss of data.

Public Sub Main()
    Dim UTF8            As New UTF8Encoding
    Dim UnicodeString   As String
    Dim EncodedBytes()  As Byte
    Dim DecodedString   As String
    Dim b               As Variant

    Set Console.OutputEncoding = Encoding.UTF8

    ' A Unicode string with two characters outside an 8-bit code range.
    UnicodeString = t("This unicode string contains two characters with codes outside an 8-bit code range, Pi (\u03a0) and Sigma (\u03a3).")
    Console.WriteLine "Original string:"
    Console.WriteLine UnicodeString

    ' Encode the string.
    EncodedBytes = UTF8.GetBytes(UnicodeString)
    Console.WriteLine
    Console.WriteLine "Encoded bytes:"

    For Each b In EncodedBytes
        Console.WriteValue "[{0}]", b
    Next
    Console.WriteLine

    ' Decode bytes back to string.
    ' Notice Pi and Sigma characters are still present.
    DecodedString = UTF8.GetString(EncodedBytes)
    Console.WriteLine
    Console.WriteLine "Decoded bytes:"
    Console.WriteLine DecodedString
    Console.ReadKey
End Sub

See Also

Project CorLib Overview

Class UTF8Encoding Overview

Encoding

ASCIIEncoding

UTF7Encoding

UTF32Encoding

UnicodeEncoding


UTF8Encoding: BodyName (get)

BodyName

Gets the encoding name to be used in with the mail agent body tags.

 Public Property Get BodyName ( ) As String

Return Values

String - The body tag compatible encoding name.

Read Only.

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: Clone

Clone

Creates a clone of the current Encoding instance.

 Public Function Clone ( ) As UTF8Encoding

Return Values

UTF8Encoding - A cloned instance of a UTF8Encoding object.

Remarks

A cloned instance will have the read-only limitations removed.

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: CodePage (get)

CodePage

Gets the code page identifier for this encoding.

 Public Property Get CodePage ( ) As Long

Return Values

Long - Code page identifier.

Read Only.

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: DecoderFallback (get)

DecoderFallback

Gets the DecoderFallback object for the current Encoding object.

 Public Property Get DecoderFallback ( ) As DecoderFallback

Return Values

DecoderFallback - The decoder fallback object for the current Encoding object.

Remarks

The DecoderFallback object represents an error handler that is invoked when an encoded byte sequence cannot be decoded into a character. Any one of the following handler types is supported:

  • A replacement fallback handler, which replaces bytes that cannot be decoded with some arbitrary replacement character. VBCorLib includes one replacement fallback handler, DecoderFallback, which by default replaces bytes that cannot be decoded with a question mark ("?") character.
  • An exception fallback handler, which throws an exception when bytes cannot be decoded. VBCorLib includes one exception fallback handler, DecoderExceptionFallback, which throws a DecoderFallbackException when bytes cannot be decoded.

Read/Write.

Exceptions

Exception | Condition
ArgumentNullException | The value in a set operation is Nothing.
InvalidOperationException | A value cannot be assigned in a set operation because the current Encoding object is read-only.

See Also

Project CorLib Overview

Class UTF8Encoding Overview

DecoderFallback

DecoderFallbackBuffer


UTF8Encoding: DecoderFallback (set)

DecoderFallback

Sets the DecoderFallback object for the current Encoding object.

 Public Property Set DecoderFallback(
      ByVal Value As DecoderFallback )

Parameters

Value
[ByVal] DecoderFallback. The decoder fallback object for the current Encoding object.

Remarks

The DecoderFallback object represents an error handler that is invoked when an encoded byte sequence cannot be decoded into a character. Any one of the following handler types is supported:

  • A replacement fallback handler, which replaces bytes that cannot be decoded with some arbitrary replacement character. VBCorLib includes one replacement fallback handler, DecoderFallback, which by default replaces bytes that cannot be decoded with a question mark ("?") character.
  • An exception fallback handler, which throws an exception when bytes cannot be decoded. VBCorLib includes one exception fallback handler, DecoderExceptionFallback, which throws a DecoderFallbackException when bytes cannot be decoded.

Read/Write.

Exceptions

Exception | Condition
ArgumentNullException | The value in a set operation is Nothing.
InvalidOperationException | A value cannot be assigned in a set operation because the current Encoding object is read-only.

See Also

Project CorLib Overview

Class UTF8Encoding Overview

DecoderFallback

DecoderFallbackBuffer


UTF8Encoding: EncoderFallback (get)

EncoderFallback

Gets the EncoderFallback object for the current Encoding object.

 Public Property Get EncoderFallback ( ) As EncoderFallback

Return Values

EncoderFallback - The encoder fallback object for the current Encoding object.

Remarks

The EncoderFallback object represents an error handler that is invoked when a character cannot be converted into an encoded byte sequence. Any one of the following handler types is supported:

  • A replacement fallback handler, which replaces characters that cannot be encoded with some arbitrary replacement character. VBCorLib includes one replacement fallback handler, EncoderFallback, which by default replaces characters that cannot be encoded with a question mark ("?") character.
  • An exception fallback handler, which throws an exception when characters cannot be encoded. VBCorLib includes one exception fallback handler, EncoderExceptionFallback, which throws an EncoderFallbackException when characters cannot be decoded.

Read/Write.

Exceptions

Exception | Condition
ArgumentNullException | The value in a set operation is Nothing.
InvalidOperationException | A value cannot be assigned in a set operation because the current Encoding object is read-only.

See Also

Project CorLib Overview

Class UTF8Encoding Overview

EncoderFallback

EncoderFallbackBuffer


UTF8Encoding: EncoderFallback (set)

EncoderFallback

Sets the EncoderFallback object for the current Encoding object.

 Public Property Set EncoderFallback(
      ByVal Value As EncoderFallback )

Parameters

Value
[ByVal] EncoderFallback. The encoder fallback object for the current Encoding object.

Remarks

The EncoderFallback object represents an error handler that is invoked when a character cannot be converted into an encoded byte sequence. Any one of the following handler types is supported:

  • A replacement fallback handler, which replaces characters that cannot be encoded with some arbitrary replacement character. VBCorLib includes one replacement fallback handler, EncoderFallback, which by default replaces characters that cannot be encoded with a question mark ("?") character.
  • An exception fallback handler, which throws an exception when characters cannot be encoded. VBCorLib includes one exception fallback handler, EncoderExceptionFallback, which throws an EncoderFallbackException when characters cannot be decoded.

Read/Write.

Exceptions

Exception | Condition
ArgumentNullException | The value in a set operation is Nothing.
InvalidOperationException | A value cannot be assigned in a set operation because the current Encoding object is read-only.

See Also

Project CorLib Overview

Class UTF8Encoding Overview

EncoderFallback

EncoderFallbackBuffer


UTF8Encoding: Encoding

Encoding

 Implements Encoding

Return Values

Encoding -

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: EncodingName (get)

EncodingName

Gets the human-readable description of the current encoding.

 Public Property Get EncodingName ( ) As String

Return Values

String - The human-readable description of the current Encoding.

Remarks

The EncodingName property is intended for display. To find a name that can be passed to the GetEncoding method, use the WebName property.

Read Only.

Examples

The following example retrieves the different names for each encoding and displays the encodings with one or more names that are different from EncodingInfo.Name. It displays EncodingName but does not compare against it.

Public Sub Main()
    Debug.Print "Name                ";
    Debug.Print "CodePage  ";
    Debug.Print "BodyName            ";
    Debug.Print "HeaderName          ";
    Debug.Print "WebName             ";
    Debug.Print "Encoding.EncodingName"

    Dim Item    As Variant
    Dim ei      As EncodingInfo
    Dim e       As Encoding

    For Each Item In Encoding.GetEncodings
        Set ei = Item
        Set e = ei.GetEncoding

        If (ei.Name <> e.BodyName) Or (ei.Name <> e.HeaderName) Or (ei.Name <> e.WebName) Then
            Debug.Print CorString.Format("{0,-18}", ei.Name);
            Debug.Print CorString.Format("{0,-9}", e.CodePage);
            Debug.Print CorString.Format("{0,-18}", e.BodyName);
            Debug.Print CorString.Format("{0,-18}", e.HeaderName);
            Debug.Print CorString.Format("{0,-18}", e.WebName);
            Debug.Print e.EncodingName
        End If
    Next
End Sub

' This code produces the following output.
'
'    Name               CodePage  BodyName           HeaderName         WebName            Encoding.EncodingName
'    shift_jis          932       iso-2022-jp        iso-2022-jp        shift_jis          Japanese (Shift-JIS)
'    windows-1250       1250      iso-8859-2         windows-1250       windows-1250       Central European (Windows)
'    windows-1251       1251      koi8-r             windows-1251       windows-1251       Cyrillic (Windows)
'    Windows-1252       1252      iso-8859-1         Windows-1252       Windows-1252       Western European (Windows)
'    windows-1253       1253      iso-8859-7         windows-1253       windows-1253       Greek (Windows)
'    windows-1254       1254      iso-8859-9         windows-1254       windows-1254       Turkish (Windows)
'    csISO2022JP        50221     iso-2022-jp        iso-2022-jp        csISO2022JP        Japanese (JIS-Allow 1 byte Kana)
'    iso-2022-kr        50225     iso-2022-kr        euc-kr             iso-2022-kr        Korean (ISO)

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: Equals

Equals

Determines whether the specified value is equal to the current UTF8Encoding object.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare with the current instance.

Return Values

Boolean - True if value is an instance of UTF8Encoding and is equal to the current object; otherwise, False.

Remarks

Two UTF8Encoding objects are considered equal if all of the following conditions are true:

  • Both objects use the same byte order.
  • Both objects provide the byte order mark, or both do not.
  • Both objects throw an exception when encountering invalid encoding, or both do not.

Examples

The following example demonstrates how to use the Equals method to test whether the current UTF8Encoding object is equal to a different UTF8Encoding object. Four UTF8Encoding objects are created and compared and the results of the comparisons are displayed.

Public Sub Main()
    Dim UTF8 As UTF8Encoding
    Dim UTF8True As UTF8Encoding
    Dim UTF8TrueTrue As UTF8Encoding
    Dim UTF8FalseTrue As UTF8Encoding

    Set UTF8 = New UTF8Encoding
    Set UTF8True = NewUTF8Encoding(True)
    Set UTF8TrueTrue = NewUTF8Encoding(True, True)
    Set UTF8FalseTrue = NewUTF8Encoding(False, True)

    DescribeEquivalence UTF8.Equals(UTF8)
    DescribeEquivalence UTF8.Equals(UTF8True)
    DescribeEquivalence UTF8.Equals(UTF8TrueTrue)
    DescribeEquivalence UTF8.Equals(UTF8FalseTrue)
    Console.WriteLine

    DescribeEquivalence UTF8True.Equals(UTF8)
    DescribeEquivalence UTF8True.Equals(UTF8True)
    DescribeEquivalence UTF8True.Equals(UTF8TrueTrue)
    DescribeEquivalence UTF8True.Equals(UTF8FalseTrue)
    Console.WriteLine

    DescribeEquivalence UTF8TrueTrue.Equals(UTF8)
    DescribeEquivalence UTF8TrueTrue.Equals(UTF8True)
    DescribeEquivalence UTF8TrueTrue.Equals(UTF8TrueTrue)
    DescribeEquivalence UTF8TrueTrue.Equals(UTF8FalseTrue)
    Console.WriteLine

    DescribeEquivalence UTF8FalseTrue.Equals(UTF8)
    DescribeEquivalence UTF8FalseTrue.Equals(UTF8True)
    DescribeEquivalence UTF8FalseTrue.Equals(UTF8TrueTrue)
    DescribeEquivalence UTF8FalseTrue.Equals(UTF8FalseTrue)

    Console.ReadKey
End Sub

Private Sub DescribeEquivalence(ByVal IsEquivalent As Boolean)
    Console.WriteLine "{0} equivalent encoding.", IIf(IsEquivalent, "An", "Not an")
End Sub

' This code produces the following output.
'
'    An equivalent encoding.
'    Not an equivalent encoding.
'    Not an equivalent encoding.
'    Not an equivalent encoding.
'
'    Not an equivalent encoding.
'    An equivalent encoding.
'    Not an equivalent encoding.
'    Not an equivalent encoding.
'
'    Not an equivalent encoding.
'    Not an equivalent encoding.
'    An equivalent encoding.
'    Not an equivalent encoding.
'
'    Not an equivalent encoding.
'    Not an equivalent encoding.
'    Not an equivalent encoding.
'    An equivalent encoding.

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: GetByteCount

GetByteCount

Calculates the number of bytes produced by encoding the characters in the specified String or Integer().

 Public Function GetByteCount(
      ByRef Chars As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Chars
[ByRef] Variant. The Integer array or String containing the set of characters to encode.
Index
[ByRef] Optional. Variant. The index of the first character to encode.
Count
[ByRef] Optional. Variant. The number of characters to encode.

Return Values

Long - The number of bytes produced by encoding the specified set of characters.

Remarks

To calculate the exact array size required by GetBytesEx to store the resulting bytes, the application uses GetByteCount. To calculate the maximum array size, the application should use GetMaxByteCount. The GetByteCount method generally allows allocation of less memory, while the GetMaxByteCount method generally executes faster.

With error detection, an invalid sequence causes this method to throw a ArgumentException. Without error detection, invalid sequences are ignored, and no exception is thrown.

Note
To ensure that the encoded bytes are decoded properly, the application should prefix encoded bytes with a preamble.

Exceptions

Exception | Condition
ArgumentNullException | Chars is a null array.
ArgumentOutOfRangeException | Index is less than the lower-bound of Chars. -or- Count is less than zero. -or- Index and Count do not denote a valid range in Chars.
ArgumentException | A fallback occurred -and- EncoderFallback is set to EncoderExceptionFallback.

Examples

The following example demonstrates how to use the GetByteCount method to return the number of bytes required to encode an array of Unicode characters, using UTF8Encoding.

    GetByteCountForString
    GetByteCountForChars
    GetByteCountForSubChars
End Sub

Private Sub GetByteCountForString()
    Const Chars     As String = "UTF8 Encoding Example"
    Dim UTF8        As New UTF8Encoding
    Dim ByteCount   As Long

    ByteCount = UTF8.GetByteCount(Chars)

    Debug.Print "GetByteCount for String."
    Debug.Print CorString.Format("{0} bytes needed to encode string.", ByteCount)
    Debug.Print
End Sub

Private Sub GetByteCountForChars()
    Dim Chars()     As Integer
    Dim UTF8        As New UTF8Encoding
    Dim ByteCount   As Long

    ' The characters to encode:
    '    Latin Small Letter Z (U+007A)
    '    Latin Small Letter A (U+0061)
    '    Combining Breve (U+0306)
    '    Latin Small Letter AE With Acute (U+01FD)
    '    Greek Small Letter Beta (U+03B2)
    '    a high-surrogate value (U+D8FF)
    '    a low-surrogate value (U+DCFF)
    Chars = NewChars("z", "a", &H306, &H1FD, &H3B2, &HD8FF, &HDCFF)

    ByteCount = UTF8.GetByteCount(Chars)

    Debug.Print "GetByteCount for character array."
    Debug.Print CorString.Format("{0} bytes needed to encode characters.", ByteCount)
    Debug.Print
End Sub

Private Sub GetByteCountForSubChars()
    Dim Chars()     As Integer
    Dim UTF8        As New UTF8Encoding
    Dim ByteCount   As Long

    ' Unicode characters: #, %, Pi, Sigma
    Chars = NewChars("#", "%", &H3A0, &H3A3)

    ByteCount = UTF8.GetByteCount(Chars, 1, 2)

    Debug.Print "GetByteCount for character sub-array."
    Debug.Print CorString.Format("{0} bytes needed to encode characters.", ByteCount)
End Sub

' This code example produces the following output.
'
'    GetByteCount for String.
'    21 bytes needed to encode string.
'
'    GetByteCount for character array.
'    12 bytes needed to encode characters.
'
'    GetByteCount for character sub-array.
'    3 bytes needed to encode characters.

See Also

Project CorLib Overview

Class UTF8Encoding Overview

GetBytesEx

GetMaxByteCount

GetEncoder


UTF8Encoding: GetBytes

GetBytes

Encodes all the characters in the specified character array or string into a sequence of bytes.

 Public Function GetBytes(
      ByRef Chars As Variant,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Byte ( )

Parameters

Chars
[ByRef] Variant. The Integer array or String containing the characters to encode.
Index
[ByRef] Optional. Variant. The index of the first character to begin encoding from.
Count
[ByRef] Optional. Variant. The number of characters to be encoded.

Return Values

Byte() - A byte array containing the result of encoding the specified set of characters.

Remarks

If the data to be converted is available only in sequential blocks (such as data read from a stream) or if the amount of data is so large that it needs to be divided into smaller blocks, the application should use the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively.

The GetByteCount method determines how many bytes result in encoding a set of Unicode characters, and the GetBytes method performs the actual encoding. The GetBytes method expects discrete conversions, in contrast to the Encoder.GetBytes method, which handles multiple conversions on a single input stream.

Several versions of GetByteCount, GetBytesEx, and GetBytes are supported. The following are some programming considerations for use of these methods:

  • The application might need to encode many input characters to a code page and process the characters using multiple calls. In this case, your application probably needs to maintain state between calls, taking into account the state that is persisted by the Encoder object being used. (For example, a character sequence that includes surrogate pairs might end with a high surrogate. The Encoder will remember that high surrogate so that it can be combined with a low surrogate at the beginning of a following call. Encoding wont be able to maintain the state, so the character will be sent to the EncoderFallback.)
  • If the application handles string inputs, it is recommended to use the string version of GetBytes.
  • If your application must convert a large amount of data, it should reuse the output buffer. In this case, the GetBytesEx version that supports byte arrays is the best choice.
  • Consider using the Encoder.Convert method instead of GetByteCount. The conversion method converts as much data as possible, and does throw an exception if the output buffer is too small. For continuous encoding of a stream, this method is often the best choice.

Exceptions

Exception | Condition
ArgumentNullException | Chars is an uninitialized array.
ArgumentOutOfRangeException | Index is less than the lower-bound of Chars for an array or zero for a string. -or- Index and Count do not denote a valid range in Chars.
EncoderFallbackException | A fallback occurred -and- EncoderFallback is set to EncoderExceptionFallback.

Examples

The following example determines the number of bytes required to encode a string or a range in the string, encodes the characters, and displays the resulting bytes.

Public Sub Main()
    Dim MyStr   As String
    Dim U7      As Encoding
    Dim U8      As Encoding
    Dim U16LE   As Encoding
    Dim U16BE   As Encoding
    Dim U32     As Encoding

    MyStr = t("za\u0306\u01FD\u03B2\uD8FF\uDCFF")

    Set U7 = Encoding.UTF7
    Set U8 = Encoding.UTF8
    Set U16LE = Encoding.Unicode
    Set U16BE = Encoding.BigEndianUnicode
    Set U32 = Encoding.UTF32

    Console.WriteLine "Encoding the entire string:"
    PrintCountsAndBytes MyStr, U7
    PrintCountsAndBytes MyStr, U8
    PrintCountsAndBytes MyStr, U16LE
    PrintCountsAndBytes MyStr, U16BE
    PrintCountsAndBytes MyStr, U32

    Console.WriteLine

    Console.WriteLine "Encoding the characters from index 4 through 6:"
    PrintCountsAndBytes2 MyStr, 4, 3, U7
    PrintCountsAndBytes2 MyStr, 4, 3, U8
    PrintCountsAndBytes2 MyStr, 4, 3, U16LE
    PrintCountsAndBytes2 MyStr, 4, 3, U16BE
    PrintCountsAndBytes2 MyStr, 4, 3, U32

    Console.ReadKey
End Sub

Private Sub PrintCountsAndBytes(ByVal s As String, ByVal Enc As Encoding)
    Dim IBC     As Long
    Dim IMBC    As Long
    Dim Bytes() As Byte

    Console.WriteValue "{0,-30} :", Enc.ToString

    IBC = Enc.GetByteCount(s)
    Console.WriteValue " {0,-3}", IBC

    IMBC = Enc.GetMaxByteCount(Len(s))
    Console.WriteValue " {0,-3} :", IMBC

    Bytes = Enc.GetBytes(s)

    PrintHexBytes Bytes
End Sub

Private Sub PrintCountsAndBytes2(ByVal s As String, ByVal Index As Long, ByVal Count As Long, ByVal Enc As Encoding)
    Dim IBC     As Long
    Dim IMBC    As Long
    Dim Bytes() As Byte

    Console.WriteValue "{0,-30} :", Enc.ToString

    IBC = Enc.GetByteCount(s, Index, Count)
    Console.WriteValue " {0,-3}", IBC

    IMBC = Enc.GetMaxByteCount(Count)
    Console.WriteValue " {0,-3} :", IMBC

    Bytes = Enc.GetBytes(s, Index, Count)

    PrintHexBytes Bytes
End Sub

Private Sub PrintHexBytes(ByRef Bytes() As Byte)
    Dim i As Long

    If CorArray.IsNullOrEmpty(Bytes) Then
        Console.WriteLine "<none>"
    Else
        For i = LBound(Bytes) To UBound(Bytes)
            Console.WriteValue "{0:X2} ", Bytes(i)
        Next

        Console.WriteLine
    End If
End Sub

' This example code produces the following output.
'
'    Encoding the entire string:
'    CorLib.UTF7Encoding            : 18  23  :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D
'    CorLib.UTF8Encoding            : 12  24  :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
'    CorLib.UnicodeEncoding         : 14  16  :7A 00 61 00 06 03 FD 01 B2 03 FF D8 FF DC
'    CorLib.UnicodeEncoding         : 14  16  :00 7A 00 61 03 06 01 FD 03 B2 D8 FF DC FF
'    CorLib.UTF32Encoding           : 24  32  :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00
'
'    Encoding the characters from index 4 through 6:
'    CorLib.UTF7Encoding            : 10  11  :2B 41 37 4C 59 2F 39 7A 2F 2D
'    CorLib.UTF8Encoding            : 6   12  :CE B2 F1 8F B3 BF
'    CorLib.UnicodeEncoding         : 6   8   :B2 03 FF D8 FF DC
'    CorLib.UnicodeEncoding         : 6   8   :03 B2 D8 FF DC FF
'    CorLib.UTF32Encoding           : 8   16  :B2 03 00 00 FF FC 04 00

See Also

Project CorLib Overview

Class UTF8Encoding Overview

GetBytesEx

GetEncoder

GetByteCount

GetMaxByteCount


UTF8Encoding: GetBytesEx

GetBytesEx

Encodes a set of characters into an array of bytes, returning the number of bytes produced.

 Public Function GetBytesEx(
      ByRef Chars As Variant,
      ByVal CharIndex As Long,
      ByVal CharCount As Long,
      ByRef Bytes ( ) As Byte,
      ByVal ByteIndex As Long ) As Long

Parameters

Chars
[ByRef] Variant. The Integer array or String containing the characters to encode.
CharIndex
[ByVal] Long. The index of the first character to begin encoding from.
CharCount
[ByVal] Long. The number of characters to be encoded.
Bytes
[ByRef] Byte. The byte array to contain the resulting sequence of bytes.
ByteIndex
[ByVal] Long. The index as which to start writing the resulting sequence of bytes.

Return Values

Long - The number of bytes produce by the encoding.

Remarks

To calculate the exact array size required by GetBytesEx to store the resulting bytes, the application uses GetByteCount. To calculate the maximum array size, the application should use GetMaxByteCount. The GetByteCount method generally allows allocation of less memory, while the GetMaxByteCount method generally executes faster.

With error detection, an invalid sequence causes this method to throw a ArgumentException. Without error detection, invalid sequences are ignored, and no exception is thrown.

Data to be converted, such as data read from a stream, might be available only in sequential blocks. In this case, or if the amount of data is so large that it needs to be divided into smaller blocks, the application uses the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively.

Note
To ensure that the encoded bytes are decoded properly, the application should prefix encoded bytes with a preamble.

Exceptions

Exception | Condition
ArgumentNullException | Chars is an unintialized array. -or- Byte is an uninitialized array.
ArgumentOutOfRangeException | CharIndex is less than the lower-bound of Chars. -or- ByteIndex is less than the lower-bound of Bytes. -or- CharCount is less than zero. -or- CharIndex and CharCount do not denote a valid range in Chars. -or- ByteIndex is not a valid index in Bytes.
ArgumentException | Error detection is enabled, and Chars contains an invalid sequence of characters. -or- Bytes does not have enough capacity from ByteIndex to the end of the array to accommodate the resulting bytes.
EncoderFallbackException | A fallback occurred -and- EncoderFallback is set to EncoderExceptionFallback.

Examples

The following example demonstrates how to use the GetBytesEx method to encode a range of characters from a String and store the encoded bytes in a range of elements in a byte array.

Public Sub Main()
    Dim Bytes()             As Byte
    Dim Chars               As String
    Dim ByteCount           As Long
    Dim BytesEncodedCount   As Long
    Dim UTF8                As New UTF8Encoding
    Dim b                   As Variant

    Chars = "UTF8 Encoding Example"

    ByteCount = UTF8.GetByteCount(CorString.ToCharArray(Chars), 0, 13)
    ReDim Bytes(1 To ByteCount)
    BytesEncodedCount = UTF8.GetBytesEx(Chars, 0, 13, Bytes, 1)

    Console.WriteLine "{0} bytes used to encode string.", BytesEncodedCount

    Console.WriteValue "Encoded bytes: "
    For Each b In Bytes
        Console.WriteValue "[{0}]", b
    Next

    Console.WriteLine
    Console.ReadKey
End Sub

' This code produces the following output.
'
'    13 bytes used to encode string.
'    Encoded bytes: [85][84][70][56][32][69][110][99][111][100][105][110][103]

See Also

Project CorLib Overview

Class UTF8Encoding Overview

GetBytes

GetEncoder

GetByteCount

GetMaxByteCount


UTF8Encoding: GetCharCount

GetCharCount

Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.

 Public Function GetCharCount(
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Long

Parameters

Bytes
[ByRef] Byte. The byte array containing the sequence of bytes to decode.
Index
[ByRef] Optional. Variant. The index of the first byte to decode.
Count
[ByRef] Optional. Variant. The number of bytes to decode.

Return Values

Long - The number of characters produced by decoding the specified sequence of bytes.

Remarks

To calculate the exact array size required by GetCharsEx to store the resulting characters, the application uses GetCharCount. To calculate the maximum array size, the application should use GetMaxCharCount. The GetCharCount method generally allows allocation of less memory, while the GetMaxCharCount method generally executes faster.

With error detection, an invalid sequence causes this method to throw a ArgumentException. Without error detection, invalid sequences are ignored, and no exception is thrown.

Exceptions

Exception | Condition
ArgumentNullException | Bytes is uninitialized.
ArgumentOutOfRangeException | Index is less than the lower-bound of Bytes. -or- Count is less than zero. -or- Index and Count do not denote a valid range in Bytes. -or- The resulting number of bytes is greater than the maximum number that can be returned as an integer.
ArgumentException | Error detection is enabled, and Bytes contains an invalid sequence of bytes.
DecoderFallbackException | A fallback occurred -and- DecoderFallback is set to DecoderExceptionFallback.html.

Examples

The following example demonstrates how to use the GetCharCount method to return the number of characters produced by decoding a range of elements in a byte array.

Public Sub Main()
    Dim Bytes()     As Byte
    Dim UTF8        As New UTF8Encoding
    Dim CharCount   As Long

    Bytes = NewBytes(85, 84, 70, 56, 32, 69, 110, 99, 111, 100, 105, 110, 103, 32, 69, 120, 97, 109, 112, 108, 101)

    CharCount = UTF8.GetCharCount(Bytes, 2, 8)

    Console.WriteLine "{0} characters needed to decode bytes.", CharCount

    Console.ReadKey
End Sub

' This code produces the following output.
'
'    8 characters needed to decode bytes.

See Also

Project CorLib Overview

Class UTF8Encoding Overview

GetCharsEx

GetMaxCharCount

GetDecoder


UTF8Encoding: GetChars

GetChars

Decodes a sequence of bytes from the specified byte array into a set of characters.

 Public Function GetChars(
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As Integer ( )

Parameters

Bytes
[ByRef] Byte. The byte array containing the sequence of bytes to decode.
Index
[ByRef] Optional. Variant. The index of the first byte to decode.
Count
[ByRef] Optional. Variant. The number of bytes to decode.

Return Values

Integer() - A character array containing the results of decoding the specified sequence of bytes.

Remarks

Encoding.GetChars gets characters from an input byte sequence. Encoding.GetChars is different than Decoder.GetChars because Encoding expects discrete conversions, while Decoder is designed for multiple passes on a single input stream.

If the data to be converted is available only in sequential blocks (such as data read from a stream) or if the amount of data is so large that it needs to be divided into smaller blocks, the application should use the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively, of an implemented class.

Note This method is intended to operate on Unicode characters, not on arbitrary binary data, such as byte arrays. If your application needs to encode arbitrary binary data into text, it should use a protocol such as uuencode, which is implemented by methods such as Convert.ToBase64CharArray.

The GetCharCount method determines how many characters result in decoding a sequence of bytes, and the GetChars method performs the actual decoding. The Encoding.GetChars method expects discrete conversions, in contrast to the Decoder.GetChars method, which handles multiple passes on a single input stream.

Several versions of GetCharCount and GetChars are supported. The following are some programming considerations for use of these methods:

  • The application might need to decode multiple input bytes from a code page and process the bytes using multiple calls. In this case, your application probably needs to maintain state between calls, because byte sequences can be interrupted when processed in batches. (For example, part of an ISO-2022 shift sequence may end one GetChars call and continue at the beginning of the next GetChars call. Encoding.GetChars will call the fallback for those incomplete sequences, but Decoder will remember those sequences for the next call.)
  • If the application handles string outputs, it is recommended to use the GetString method. Since this method must check string length and allocate a buffer, it is slightly slower, but the resulting String type is to be preferred.
  • If your application must convert a large amount of data, it should reuse the output buffer. In this case, the GetCharsEx version that supports output character buffers is the best choice.
  • Consider using the Decoder.Convert method instead of GetCharCount. The conversion method converts as much data as possible and throws an exception if the output buffer is too small. For continuous decoding of a stream, this method is often the best choice.

Exceptions

Exception | Condition
ArgumentNullException | Bytes is null.
ArgumentOutOfRangeException | Index is less than the lower-bound of Bytes. -or- Count is less than zero. -or- Index and Count do not denote a valid range in Bytes.
DecoderFallbackException | A fallback occurred -and- DecoderFallback is set to DecoderExceptionFallback.

Examples

The following example encodes a string into an array of bytes, and then decodes the bytes into an array of characters.

Public Sub Main()
    Dim U32LE As Encoding
    Dim U32BE As Encoding
    Dim MyStr As String
    Dim BytesLE() As Byte
    Dim BytesBE() As Byte

    Set Console.OutputEncoding = Encoding.UTF8
    Set U32LE = Encoding.GetEncoding("utf-32")
    Set U32BE = Encoding.GetEncoding("utf-32BE")

    ' Use a string containing the following characters:
    '    Latin Small Letter Z (U+007A)
    '    Latin Small Letter A (U+0061)
    '    Combining Breve (U+0306)
    '    Latin Small Letter AE With Acute (U+01FD)
    '    Greek Small Letter Beta (U+03B2)
    MyStr = "za" & ChrW$(&H306) & ChrW$(&H1FD) & ChrW$(&H3B2)

    ' Encode the string using the big-endian byte order.
    BytesBE = U32BE.GetBytes(MyStr)

    ' Encode the string using the little-endian byte order.
    BytesLE = U32LE.GetBytes(MyStr)

    ' Get the char counts, and decode the byte arrays.
    Console.WriteValue "BE array with BE encoding : "
    PrintCountsAndChars BytesBE, U32BE
    Console.WriteValue "LE array with LE encoding : "
    PrintCountsAndChars BytesLE, U32LE

    Console.ReadKey
End Sub

Private Sub PrintCountsAndChars(ByRef Bytes() As Byte, ByVal Enc As Encoding)
    Dim CharCount As Long
    Dim MaxCount As Long
    Dim Chars() As Integer

    ' Display the name of the encoding used.
    Console.WriteValue "{0,-25} :", Enc.ToString

    ' Display the exact character count.
    CharCount = Enc.GetCharCount(Bytes)
    Console.WriteValue " {0,-3}", CharCount

    ' Display the maximum character count.
    MaxCount = Enc.GetMaxCharCount(CorArray.Length(Bytes))
    Console.WriteValue " {0,-3} :", MaxCount

    ' Decode the bytes and display the characters.
    Chars = Enc.GetChars(Bytes)
    Console.WriteLine NewString(Chars)
End Sub

' This example code produces the following output.
'
'BE array with BE encoding : CorLib.UTF32Encoding      : 5   12  :zăǽβ
'LE array with LE encoding : CorLib.UTF32Encoding      : 5   12  :zăǽβ

See Also

Project CorLib Overview

Class UTF8Encoding Overview

GetCharsEx

GetCharCount

GetMaxCharCount

GetDecoder

GetString


UTF8Encoding: GetCharsEx

GetCharsEx

Decodes a sequence of bytes from the specified byte array into the specified character array.

 Public Function GetCharsEx(
      ByRef Bytes ( ) As Byte,
      ByVal ByteIndex As Long,
      ByVal ByteCount As Long,
      ByRef Chars ( ) As Integer,
      ByVal CharIndex As Long ) As Long

Parameters

Bytes
[ByRef] Byte. The byte array containing the sequence of bytes to decode.
ByteIndex
[ByVal] Long. The index of the first byte to decode.
ByteCount
[ByVal] Long. The number of bytes to decode.
Chars
[ByRef] Integer. The character array to contain the resulting set of characters.
CharIndex
[ByVal] Long. The index at which to start writing the resulting set of characters.

Return Values

Long - The actual number of characters written into Chars.

Remarks

To calculate the exact array size required by GetCharsEx to store the resulting characters, the application uses GetCharCount. To calculate the maximum array size, the application should use GetMaxCharCount. The GetCharCount method generally allows allocation of less memory, while the GetMaxCharCount method generally executes faster.

With error detection, an invalid sequence causes this method to throw a ArgumentException. Without error detection, invalid sequences are ignored, and no exception is thrown.

Data to be converted, such as data read from a stream, might be available only in sequential blocks. In this case, or if the amount of data is so large that it needs to be divided into smaller blocks, the application uses the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively.

Exceptions

Exception | Condition
ArgumentNullException | Bytes is uninitialized. -or- Chars is uninitailized.
ArgumentOutOfRangeException | ByteIndex is less than the lower-bound of Bytes. -or- CharIndex is less than the lower-bound of Chars. -or- ByteCount is less than zero. -or- ByteIndex and ByteCount do not denote a valid range in Bytes. -or- CharIndex is not a valid index in Chars.
ArgumentException | Error detection is enabled, and Bytes contains an invalid sequence of bytes. -or- Chars does not have enough capacity from CharIndex to the end of the array to accommodate the resulting characters.
DecoderFallbackException | A fallback occurred -and- DecoderFallback is set to DecoderExceptionFallback.

Examples

The following example demonstrates how to use the GetCharsEx method to decode a range of elements in a byte array and store the result in a character array.

Public Sub Main()
    Dim Bytes()             As Byte
    Dim Chars()             As Integer
    Dim UTF8                As New UTF8Encoding
    Dim CharCount           As Long
    Dim CharsDecodedCount   As Long
    Dim c As Variant

    Bytes = NewBytes(85, 84, 70, 56, 32, 69, 110, 99, 111, 100, 105, 110, 103, 32, 69, 120, 97, 109, 112, 108, 101)

    CharCount = UTF8.GetCharCount(Bytes, 2, 13)
    ReDim Chars(1 To CharCount)
    CharsDecodedCount = UTF8.GetCharsEx(Bytes, 2, 13, Chars, 1)

    Console.WriteLine "{0} characters used to decode bytes.", CharsDecodedCount

    For Each c In Chars
        Console.WriteValue "[{0:$}]", c
    Next

    Console.WriteLine
    Console.ReadKey
End Sub

' This code produces the following output.
'
'    13 characters used to decode bytes.
'    [F][8][ ][E][n][c][o][d][i][n][g][ ][E]

See Also

Project CorLib Overview

Class UTF8Encoding Overview

GetChars

GetCharCount

GetMaxCharCount

GetDecoder

GetString


UTF8Encoding: GetDecoder

GetDecoder

Obtains a decoder that converts a UTF-8 encoded sequence of bytes into a sequence of Unicode characters.

 Public Function GetDecoder ( ) As Decoder

Return Values

Decoder - A Decoder that converts a UTF-8 encoded sequence of bytes into a sequence of Unicode characters.

Remarks

The Decoder.GetChars method converts sequential blocks of bytes into sequential blocks of characters, in a manner similar to the GetCharsEx method of this class. However, a Decoder maintains state information between calls so it can correctly decode byte sequences that span blocks. The Decoder also preserves trailing bytes at the end of data blocks and uses the trailing bytes in the next decoding operation. Therefore, GetDecoder and GetEncoder are useful for network transmission and file operations, because those operations often deal with blocks of data instead of a complete data stream.

If error detection is enabled, that is, the ThrowOnInvalidCharacters parameter of the constructor is set to True, error detection is also enabled in the Decoder returned by this method. If error detection is enabled and an invalid sequence is encountered, the state of the decoder is undefined and processing must stop.

Examples

The following example demonstrates how to use the GetDecoder method to obtain a UTF-8 decoder. The decoder converts a sequence of bytes into a sequence of characters.

Public Sub Main()
    Dim Chars()             As Integer
    Dim Bytes()             As Byte
    Dim UTF8Decoder         As Decoder
    Dim CharCount           As Long
    Dim CharsDecodedCount   As Long
    Dim c                   As Variant

    Set Console.OutputEncoding = Encoding.UTF8
    Bytes = NewBytes(99, 204, 128, 234, 130, 160)
    Set UTF8Decoder = Encoding.UTF8.GetDecoder

    CharCount = UTF8Decoder.GetCharCount(Bytes, 0, CorArray.Length(Bytes))
    ReDim Chars(0 To CharCount - 1)
    CharsDecodedCount = UTF8Decoder.GetChars(Bytes, 0, CorArray.Length(Bytes), Chars, 0)

    Console.WriteLine "{0} characters used to decode bytes.", CharsDecodedCount

    Console.WriteValue "Decoded chars: "
    For Each c In Chars
        Console.WriteValue "[{0:$}]", c
    Next

    Console.WriteLine
    Console.ReadKey
End Sub

' This code produces the following output.
'
'    3 characters used to decode bytes.
'    Decoded chars: [c][`][ꂠ]

See Also

Project CorLib Overview

Class UTF8Encoding Overview

Decoder

GetChars

GetCharsEx

GetString

GetCharCount

GetEncoder


UTF8Encoding: GetEncoder

GetEncoder

Obtains an encoder that converts a sequence of Unicode characters into a UTF-8 encoded sequence of bytes.

 Public Function GetEncoder ( ) As Encoder

Return Values

Encoder - An Encoder that converts a sequence of Unicode characters into a UTF-8 encoded sequence of bytes.

Remarks

The Encoder.GetBytes method converts sequential blocks of characters into sequential blocks of bytes, in a manner similar to the GetBytesEx method. However, an Encoder maintains state information between calls so it can correctly encode character sequences that span blocks. The Encoder also preserves trailing characters at the end of data blocks and uses the trailing characters in the next encoding operation. For example, a data block might end with an unmatched high surrogate, and the matching low surrogate might be in the next data block. Therefore, GetDecoder and GetEncoder are useful for network transmission and file operations, because those operations often deal with blocks of data instead of a complete data stream.

If error detection is enabled, that is, the ThrowOnInvalidCharacters parameter of the constructor is set to true, error detection is also enabled in the Encoder returned by this method. If error detection is enabled and an invalid sequence is encountered, the state of the encoder is undefined and processing must stop.

Examples

The following example demonstrates how to use the GetEncoder method to obtain an encoder to convert a sequence of characters into a UTF-8 encoded sequence of bytes.

Public Sub Main()
    Dim Chars()             As Integer
    Dim Bytes()             As Byte
    Dim UTF8Encoder         As Encoder
    Dim ByteCount           As Long
    Dim BytesEncodedCount   As Long
    Dim b                   As Variant

    Chars = NewChars("a", "b", "c", &H300, &HA0A0)
    Set UTF8Encoder = Encoding.UTF8.GetEncoder

    ByteCount = UTF8Encoder.GetByteCount(Chars, 2, 3, True)
    ReDim Bytes(0 To ByteCount - 1)
    BytesEncodedCount = UTF8Encoder.GetBytes(Chars, 2, 3, Bytes, 0, True)

    Console.WriteLine "{0} bytes used to encode characters.", BytesEncodedCount

    Console.WriteValue "Encoded bytes: "
    For Each b In Bytes
        Console.WriteValue "[{0}]", b
    Next

    Console.WriteLine
    Console.ReadKey
End Sub

' This code produces the following output.
'
'    6 bytes used to encode characters.
'    Encoded bytes: [99][204][128][234][130][160]

See Also

Project CorLib Overview

Class UTF8Encoding Overview

Encoder

GetBytesEx

GetByteCount

GetDecoder


UTF8Encoding: GetHashCode

GetHashCode

Returns the hash code for the current instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - The hash code for the current instance.

Examples

The following example demonstrates how to use the GetHashCode method to return a hash code for an instance of UTF8Encoding. Notice that the hash code returned by this method varies depending on the constructor used to create the UTF8Encoding.

Public Sub Main()
    Dim UTF8A As UTF8Encoding
    Dim UTF8B As UTF8Encoding
    Dim UTF8C As UTF8Encoding
    Dim UTF8D As UTF8Encoding

    ' Many ways to instantiate a UTF8 encoding.
    Set UTF8A = New UTF8Encoding
    Set UTF8B = NewUTF8Encoding(True)
    Set UTF8C = NewUTF8Encoding(True, True)
    Set UTF8D = NewUTF8Encoding(False, True)

    ' But not all are the same.
    Console.WriteLine UTF8A.GetHashCode
    Console.WriteLine UTF8B.GetHashCode
    Console.WriteLine UTF8C.GetHashCode
    Console.WriteLine UTF8C.GetHashCode

    Console.ReadKey
End Sub

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: GetMaxByteCount

GetMaxByteCount

Calculates the maximum number of bytes produced by encoding the specified number of characters.

 Public Function GetMaxByteCount(
      ByVal CharCount As Long ) As Long

Parameters

CharCount
[ByVal] Long. The number of characters to encode.

Return Values

Long - The maximum number of bytes produced by encoding the specified number of characters.

Remarks

To calculate the exact array size required by GetBytesEx to store the resulting bytes, the application uses GetByteCount. To calculate the maximum array size, the application should use GetMaxByteCount. The GetByteCount method generally allows allocation of less memory, while the GetMaxByteCount method generally executes faster.

GetMaxByteCount is a worst-case number, including the worst case for the currently selected EncoderFallback. If a fallback is chosen with a potentially large string, GetMaxByteCount can return large values.

In most cases, this method returns reasonable numbers for small strings. For large strings, you might have to choose between using very large buffers and catching errors in the rare case that a more reasonable buffer is exceeded. You might also want to consider a different approach using GetByteCount or Encoder.Convert. For example, text in English and many other languages often needs only one UTF-8 byte to represent a character, but the number returned by GetMaxByteCount has to allow for the possibility that the string to be converted will consist entirely of characters that each require four bytes.

GetMaxByteCount has no relation to GetCharsEx. If your application needs a similar function to use with GetCharsEx, it should use GetMaxCharCount.

Note
GetMaxByteCount(N) is not necessarily the same value as N* GetMaxByteCount(1).

Exceptions

Exception | Condition
ArgumentOutOfRangeException | CharCount is less than zero. -or- The resulting number of bytes is greater than the maximum number that can be returned as an integer.
EncoderFallbackException | A fallback occurred -and- EncoderFallback is set to EncoderFallbackException.

Examples

The following example demonstrates how to use the GetMaxByteCount method to return the maximum number of bytes required to encode a specified number of characters.

Public Sub Main()
    Const CharCount As Long = 2

    Dim UTF8 As New UTF8Encoding
    Dim MaxByteCount As Long

    MaxByteCount = UTF8.GetMaxByteCount(CharCount)

    Console.WriteLine "Maximum of {0} bytes needed to encode {1} characters.", MaxByteCount, CharCount
    Console.ReadKey
End Sub

' This code produces the following output.
'
'   Maximum of 9 bytes needed to encode 2 characters.

See Also

Project CorLib Overview

Class UTF8Encoding Overview

GetBytesEx

GetByteCount

GetEncoder


UTF8Encoding: GetMaxCharCount

GetMaxCharCount

Calculates the maximum number of characters produced by decoding the specified number of bytes.

 Public Function GetMaxCharCount(
      ByVal ByteCount As Long ) As Long

Parameters

ByteCount
[ByVal] Long. The number of bytes to decode.

Return Values

Long - The maximum number of characters produced by decoding the specified number of bytes.

Remarks

To calculate the exact array size required by GetCharsEx to store the resulting characters, the application uses GetCharCount. To calculate the maximum array size, the application should use GetMaxCharCount. The GetCharCount method generally allows allocation of less memory, while the GetMaxCharCount method generally executes faster.

GetMaxCharCount is a worst-case number, including the worst case for the currently selected DecoderFallback. If a fallback is chosen with a potentially large string, GetMaxCharCount can return large values.

In most cases, this method returns reasonable numbers for small strings. For large strings, you might have to choose between using very large buffers and catching errors in the rare case that a more reasonable buffer is exceeded. You might also want to consider a different approach using GetCharCount or Encoder.Convert.

GetMaxCharCount has no relation to GetBytesEx. If your application needs a similar function to use with GetBytesEx, it should use GetMaxByteCount.

Note
GetMaxCharCount(N) is not necessarily the same value as N* GetMaxCharCount(1).

Exceptions

Exception | Condition
ArgumentOutOfRangeException | ByteCount is less than zero. -or- The resulting number of bytes is greater than the maximum number that can be returned as an integer.
DecoderFallbackException | A fallback occurred -and- DecoderFallback is set to DecoderExceptionFallback.

Examples

The following example demonstrates how to use the GetMaxCharCount method to return the maximum number of characters produced by decoding a specified number of bytes.

Public Sub Main()
    Const ByteCount As Long = 8

    Dim UTF8 As New UTF8Encoding
    Dim MaxCharCount As Long

    MaxCharCount = UTF8.GetMaxCharCount(ByteCount)

    Console.WriteLine "Maximum of {0} characters needed to decode {1} bytes.", MaxCharCount, ByteCount
    Console.ReadKey
End Sub

' This code produces the following output.
'
'   Maximum of 9 characters needed to decode 8 bytes.

See Also

Project CorLib Overview

Class UTF8Encoding Overview

GetCharsEx

GetString

GetCharCount

GetDecoder


UTF8Encoding: GetPreamble

GetPreamble

Returns a Unicode byte order mark encoded in UTF-8 format, if the constructor for this instance requests a byte order mark.

 Public Function GetPreamble ( ) As Byte ( )

Return Values

Byte() - A byte array containing the Unicode byte order mark, if the constructor for this instance requests a byte order mark. Otherwise, this method returns a byte array of length zero.

Remarks

Optionally, the UTF8Encoding object provides a preamble, which is an array of bytes that can be prefixed to the sequence of bytes resulting from the encoding process. If the preamble contains a byte order mark (code point U+FEFF), it helps the decoder determine the byte order and the transformation format or UTF. The Unicode byte order mark (BOM) is serialized as EF BB BF (in hexadecimal).

Your applications are recommended to use the BOM, as it provides nearly certain identification of an encoding for files that otherwise have lost reference to the UTF8Encoding object, for example, untagged or improperly tagged web data or random text files stored when a business did not have international concerns or other data. Often user problems might be avoided if data is consistently and properly tagged.

For standards that provide an encoding type, a BOM is somewhat redundant. However, it can be used to help a server send the correct encoding header. Alternatively, it can be used as a fallback in case the encoding is otherwise lost.

There are some disadvantages to using a BOM. For example, knowing how to limit the database fields that use a BOM can be difficult. Concatenation of files can be a problem also, for example, when files are merged in such a way that an unnecessary character can end up in the middle of data. In spite of the few disadvantages, however, the use of a BOM is highly recommended.

For more information on byte order and the byte order mark, see The Unicode Standard at the Unicode home page.

Caution
To ensure that the encoded bytes are decoded properly, your application should prefix encoded bytes with a preamble.

Examples

The following example demonstrates how to use the GetPreamble method to return the Unicode byte order mark encoded in UTF-8 format. Notice that the default constructor for UTF8Encoding does not provide a preamble.

Public Sub Main()
    Dim UTF8NoPreamble      As UTF8Encoding
    Dim UTF8WithPreamble    As UTF8Encoding
    Dim preamble()          As Byte

    Set UTF8NoPreamble = New UTF8Encoding
    Set UTF8WithPreamble = NewUTF8Encoding(True)

    preamble = UTF8NoPreamble.GetPreamble
    Console.WriteLine "UTF8NoPreamble"
    Console.WriteLine " preamble length: {0}", CorArray.Length(preamble)
    Console.WriteValue " preamble: "
    ShowArray preamble

    preamble = UTF8WithPreamble.GetPreamble
    Console.WriteLine "UTF8WithPreamble"
    Console.WriteLine " preamble length: {0}", CorArray.Length(preamble)
    Console.WriteValue " preamble: "
    ShowArray preamble

    Console.ReadKey
End Sub

Private Sub ShowArray(ByRef Arr() As Byte)
    Dim Element As Variant

    For Each Element In Arr
        Console.WriteValue "[{0:X2}]", Element
    Next

    Console.WriteLine
End Sub

' This code produces the following output.
'
'    UTF8NoPreamble
'     preamble length: 0
'     preamble:
'    UTF8WithPreamble
'     preamble length: 3
'     preamble: [EF][BB][BF]

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: GetString

GetString

Decodes a range of bytes from a byte array into a string.

 Public Function GetString(
      ByRef Bytes ( ) As Byte,
      Optional ByRef Index As Variant,
      Optional ByRef Count As Variant ) As String

Parameters

Bytes
[ByRef] Byte. The byte array containing the sequence of bytes to decode.
Index
[ByRef] Optional. Variant. The index of the first byte to decode.
Count
[ByRef] Optional. Variant. The number of bytes to decode.

Return Values

String - A String containing the results of decoding the specified sequence of bytes.

Remarks

With error detection, an invalid sequence causes this method to throw a ArgumentException. Without error detection, invalid sequences are ignored, and no exception is thrown.

If the range of bytes to be decoded includes the byte order mark (BOM) and the byte array was returned by a method of a non-BOM aware type, the character U+FFFE is included in the character array returned by this method. You can remove it by calling the CorString.TrimStart method.

Data to be converted, such as data read from a stream, might be available only in sequential blocks. In this case, or if the amount of data is so large that it needs to be divided into smaller blocks, the application uses the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively.

Exceptions

Exception | Condition
ArgumentNullException | Bytes is uninitialized.
ArgumentOutOfRangeException | Index is less than the lower-bound of Bytes. -or- Count is less than zero. -or- Index and Count do not denote a valid range in Bytes.
ArgumentException | Error detection is enabled, and Bytes contains an invalid sequence of bytes.
DecoderFallbackException | A fallback occurred -and- DecoderFallback is set to DecoderExceptionFallback.html.

Examples

The following example initializes an array by calling the GetByteCount method to determine exactly how many bytes are required for an encoded string and then adding the size of the byte order mark (BOM). The example then calls the GetPreamble method to store the BOM to the array before calling the GetBytesEx method to store the encoded bytes to the array. The example then calls the GetString method to decode the string.

Public Sub Main()
    Dim UTF8    As UTF8Encoding
    Dim Bytes() As Byte
    Dim s       As String
    Dim s2      As String

    Set UTF8 = NewUTF8Encoding(True, True)

    s = "It was the best of times, it was the worst of times..."

    ' We need to dimension the array, since we'll populate it with 2 method calls.
    ReDim Bytes(0 To UTF8.GetByteCount(s) + CorArray.Length(UTF8.GetPreamble) - 1)

    ' Encode the string
    CorArray.Copy UTF8.GetPreamble, Bytes, CorArray.Length(UTF8.GetPreamble)
    UTF8.GetBytesEx s, 0, Len(s), Bytes, CorArray.Length(UTF8.GetPreamble)

    ' Decode the byte array.
    s2 = UTF8.GetString(Bytes)
    Console.WriteLine s2

    Console.ReadKey
End Sub

' This code produces the following output.
'
'    ?It was the best of times, it was the worst of times...
Note that in this case the decoded string differs from the original string, since it begins with a 16-bit byte order mark U+FFFD. This means that the two strings will compare as unequal, and that if the string is output, the BOM will be displayed as the replacement character "?". To remove the BOM at the beginning of the string, you can call the CorString.TrimStart method.

See Also

Project CorLib Overview

Class UTF8Encoding Overview

GetChars

GetCharsEx

GetDecoder

GetCharCount

GetMaxCharCount


UTF8Encoding: HeaderName (get)

HeaderName

Gets the encoding name to be used in with the mail agent header tags.

 Public Property Get HeaderName ( ) As String

Return Values

String - The header tag compatible encoding name.

Read Only.

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: IsBrowserDisplay (get)

IsBrowserDisplay

Gets if this encoding can be used by browsers to display text.

 Public Property Get IsBrowserDisplay ( ) As Boolean

Return Values

Boolean - The indication for browser display capable.

Read Only.

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: IsBrowserSave (get)

IsBrowserSave

Gets if this encoding can be used to save data with this encoding.

 Public Property Get IsBrowserSave ( ) As Boolean

Return Values

Boolean - The indication for the browser saving capable.

Read Only.

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: IsMailNewsDisplay (get)

IsMailNewsDisplay

Gets if this encoding can be used to display mail and news by mail and news clients.

 Public Property Get IsMailNewsDisplay ( ) As Boolean

Return Values

Boolean - Indication for mail and news client capable.

Read Only.

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: IsMailNewsSave (get)

IsMailNewsSave

Gets if this encoding can be used to save data by mail and news clients.

 Public Property Get IsMailNewsSave ( ) As Boolean

Return Values

Boolean - Indication for the mail and news clients to use this encoding for saving.

Read Only.

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: IsReadOnly (get)

IsReadOnly

When implemented in a derived class, gets a value indicating whether the current encoding is read-only.

 Public Property Get IsReadOnly ( ) As Boolean

Return Values

Boolean - True if the current Encoding is read-only; otherwise, False. The default is True.

Read Only.

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: IsSingleByte (get)

IsSingleByte

Gets if the current encoding uses single-byte code points.

 Public Property Get IsSingleByte ( ) As Boolean

Return Values

Boolean - Returns True for single-byte, False for multi-byte code points.

Read Only.

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: ToString

ToString

Returns a string representation of the current object.

 Public Function ToString ( ) As String

Return Values

String - A string representation of the current object.

Remarks

ToString is the major formatting method in VBCorLib. It converts an object to its string representation so that it is suitable for display.

A default implementation of the ToString method would be to call the MyBase.ToString method as the following example shows.

Implements IObject

Public Function ToString() As String
    ToString = MyBase.ToString(Me, App)
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IObject Implementation
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IObject_ToString() As String
    IObject_ToString = ToString
End Function

Types commonly implement the ToString method to return a string that represents the object instance. For example, the types such as CorDateTime, and StringBuilder provide ToString implementations that return the string form of the value that the object represents. The following example defines a class, Class2, that customizes the ToString method to return the type name along with its value.

Implements IObject

Public Value As Variant

Public Function ToString() As String
    ToString = MyBase.ToString(Me, App) & ": " & Object.ToString(Value)
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IObject Implementation
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IObject_ToString() As String
    IObject_ToString = ToString
End Function

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: WebName (get)

WebName

Gets the encoding name registered with the Internet Assigned Numbers Authority.

 Public Property Get WebName ( ) As String

Return Values

String - The registered encoding name.

Read Only.

See Also

Project CorLib Overview

Class UTF8Encoding Overview


UTF8Encoding: WindowsCodePage (get)

WindowsCodePage

Gets the Windows Operating Systems code page for this encoding.

 Public Property Get WindowsCodePage ( ) As Long

Return Values

Long - The Windows code page for this encoding.

Read Only.

See Also

Project CorLib Overview

Class UTF8Encoding Overview


Version

Version

Represents a version number in the format Major.Minor[.Build[.Revision]].

Implements:

ICloneable
IComparable
IObject

Public:

Properties:

Name | Description
Build (get) | Gets the value of the build component of the version number for the current Version object.
Major (get) | Gets the value of the major component of the version number for the current Version object.
MajorRevision (get) | Gets the high 16 bits of the revision number.
Minor (get) | Gets the value of the minor component of the version number for the current Version object.
MinorRevision (get) | Gets the low 16 bits of the revision number.
Revision (get) | Gets the value of the revision component of the version number for the current Version object.

Methods:

Name | Description
Clone | Returns a new Version object whose value is the same as the current Version object.
CompareTo | Compares the current Version object to a specified Version object and returns an indication of their relative values.
Equals | Returns a value indicating whether the current Version object and a specified Version object represent the same value.
EqualTo | Determines whether two specified Version objects are equal.
GetHashCode | Returns a hash code for the current Version object.
GreaterThan | Determines whether the current Version object is greater than the specified Version object.
GreaterThanOrEqualTo | Determines whether the current Version object is greater than or equal to the specified Version object.
LessThan | Determines whether the current Version object is less than the specified Version object.
LessThanOrEqualTo | Determines whether the current Version object is less than or equal to the specified Version object.
NotEqualTo | Determines whether the current Version object is not equal to the specified Version object.
ToString | Converts the value of the current Version object to its equivalent string representation. A specified count indicates the number of components to return.

See Also

Project CorLib Overview

Class Version Overview

Constructors

VersionStatic


Version: Build (get)

Build

Gets the value of the build component of the version number for the current Version object.

 Public Property Get Build ( ) As Long

Return Values

Long - The build number, or -1 if the build number is undefined.

Remarks

For example, if the version number is 6.2.1.3, the build number is 1. If the version number is 6.2, the build number is undefined.

Read Only.

See Also

Project CorLib Overview

Class Version Overview


Version: Clone

Clone

Returns a new Version object whose value is the same as the current Version object.

 Public Function Clone ( ) As Version

Return Values

Version - A new object whose values are a copy of the current Version object.

See Also

Project CorLib Overview

Class Version Overview


Version: CompareTo

CompareTo

Compares the current Version object to a specified Version object and returns an indication of their relative values.

 Public Function CompareTo(
      ByVal Value As Version ) As Long

Parameters

Value
[ByVal] Version. A Version object to compare to the current Version object, or Nothing.

Return Values

Long - A signed integer that indicates the relative values of the two objects, as shown in the following table.
Value | Meaning
Less than zero | The current Version object is a version before Value.
Zero | The current Version object is the same version as Value.
Greater than zero | The current Version object is a version subsequent to Value. -or- Value is Nothing.

Remarks

The components of Version in decreasing order of importance are: major, minor, build, and revision. An unknown component is assumed to be older than any known component. For example:

  • Version 1.1 is older than version 1.1.0.
  • Version 1.1 is older than version 1.1.1.
  • Version 1.1 is older than version 1.1.2.3.
  • Version 1.1.2 is older than version 1.1.2.4.
  • Version 1.2.5 is newer than version 1.2.3.4.

See Also

Project CorLib Overview

Class Version Overview


Version: Equals

Equals

Returns a value indicating whether the current Version object and a specified Version object represent the same value.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. A Version object to compare to the current Version object, or Nothing.

Return Values

Boolean - True if every component of the current Version object matches the corresponding component of the Value parameter; otherwise, False.

See Also

Project CorLib Overview

Class Version Overview


Version: EqualTo

EqualTo

Determines whether two specified Version objects are equal.

 Public Function EqualTo(
      ByVal Value As Version ) As Boolean

Parameters

Value
[ByVal] Version. The Version object to test equality against.

Return Values

Boolean - True if every component of the current Version object matches the corresponding component of the Value parameter; otherwise, False.

See Also

Project CorLib Overview

Class Version Overview


Version: GetHashCode

GetHashCode

Returns a hash code for the current Version object.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit signed integer hash code.

See Also

Project CorLib Overview

Class Version Overview


Version: GreaterThan

GreaterThan

Determines whether the current Version object is greater than the specified Version object.

 Public Function GreaterThan(
      ByVal Value As Version ) As Boolean

Parameters

Value
[ByVal] Version. The Version object to test the relationship against.

Return Values

Boolean - True if the current Version object is greater than Value; otherwise, False.

See Also

Project CorLib Overview

Class Version Overview


Version: GreaterThanOrEqualTo

GreaterThanOrEqualTo

Determines whether the current Version object is greater than or equal to the specified Version object.

 Public Function GreaterThanOrEqualTo(
      ByVal Value As Version ) As Boolean

Parameters

Value
[ByVal] Version. The Version object to test the relationship against.

Return Values

Boolean - True if the current Version object is greater than or equal to Value; otherwise, False.

See Also

Project CorLib Overview

Class Version Overview


Version: ICloneable

ICloneable

 Implements ICloneable

Return Values

ICloneable -

See Also

Project CorLib Overview

Class Version Overview


Version: IComparable

IComparable

 Implements IComparable

Return Values

IComparable -

See Also

Project CorLib Overview

Class Version Overview


Version: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class Version Overview


Version: LessThan

LessThan

Determines whether the current Version object is less than the specified Version object.

 Public Function LessThan(
      ByVal Value As Version ) As Boolean

Parameters

Value
[ByVal] Version. The Version object to test the relationship against.

Return Values

Boolean - True if the current Version object is less than Value; otherwise, False.

See Also

Project CorLib Overview

Class Version Overview


Version: LessThanOrEqualTo

LessThanOrEqualTo

Determines whether the current Version object is less than or equal to the specified Version object.

 Public Function LessThanOrEqualTo(
      ByVal Value As Version ) As Boolean

Parameters

Value
[ByVal] Version. The Version object to test the relationship against.

Return Values

Boolean - True if the current Version object is less than or equal to Value; otherwise, False.

See Also

Project CorLib Overview

Class Version Overview


Version: Major (get)

Major

Gets the value of the major component of the version number for the current Version object.

 Public Property Get Major ( ) As Long

Return Values

Long - The major version number.

Read Only.

See Also

Project CorLib Overview

Class Version Overview


Version: MajorRevision (get)

MajorRevision

Gets the high 16 bits of the revision number.

 Public Property Get MajorRevision ( ) As Integer

Return Values

Integer - A 16-bit signed integer.

Read Only.

See Also

Project CorLib Overview

Class Version Overview


Version: Minor (get)

Minor

Gets the value of the minor component of the version number for the current Version object.

 Public Property Get Minor ( ) As Long

Return Values

Long - The minor version number.

Read Only.

See Also

Project CorLib Overview

Class Version Overview


Version: MinorRevision (get)

MinorRevision

Gets the low 16 bits of the revision number.

 Public Property Get MinorRevision ( ) As Integer

Return Values

Integer - A 16-bit signed integer.

Read Only.

See Also

Project CorLib Overview

Class Version Overview


Version: NotEqualTo

NotEqualTo

Determines whether the current Version object is not equal to the specified Version object.

 Public Function NotEqualTo(
      ByVal Value As Version ) As Boolean

Parameters

Value
[ByVal] Version. The Version object to test the relationship against.

Return Values

Boolean - True if the current Version object is not equal to Value; otherwise, False.

See Also

Project CorLib Overview

Class Version Overview


Version: Revision (get)

Revision

Gets the value of the revision component of the version number for the current Version object.

 Public Property Get Revision ( ) As Long

Return Values

Long - The revision number, or -1 if the revision number is undefined.

Remarks

For example, if the version number is 6.2.1.3, the revision number is 3. If the version number is 6.2, the revision number is undefined.

Read Only.

See Also

Project CorLib Overview

Class Version Overview


Version: ToString

ToString

Converts the value of the current Version object to its equivalent string representation. A specified count indicates the number of components to return.

 Public Function ToString(
      Optional ByRef FieldCount As Variant ) As String

Parameters

FieldCount
[ByRef] Optional. Variant. The number of components to return. The FieldCount ranges from 0 to 4.

Return Values

String - The string representation of the values of the major, minor, build, and revision components of the current Version object, each separated by a period character (.'). The FieldCount parameter determines how many components are returned.
FieldCount | Return Value
0 | An empty string ("").
1 | Major
2 | Major.Minor
3 | Major.Minor.Build
4 | Major.Minor.Build.Revision
For example, if you create Version object using the constructor Version(1,3,5), ToString(2) returns "1.3" and ToString(4) throws an exception.

Exceptions

Exception | Condition
ArgumentException | FieldCount is less than zero, or more than four. -or- FieldCount is more than the number of components defined in the current Version object.

See Also

Project CorLib Overview

Class Version Overview


VersionStatic

VersionStatic

Provides static methods to help create Version objects.

Public:

Methods:

Name | Description
Parse | Converts the string representation of a version number to an equivalent VersionStatic object.
TryParse | Tries to convert the string representation of a version number to an equivalent Version object, and returns a value that indicates whether the conversion succeeded.

See Also

Project CorLib Overview

Class VersionStatic Overview

Version


VersionStatic: Parse

Parse

Converts the string representation of a version number to an equivalent VersionStatic object.

 Public Function Parse(
      ByRef s As String ) As Version

Parameters

s
[ByRef] String. A string that contains a version number to convert.

Return Values

Version - An object that is equivalent to the version number specified in the s parameter.

Exceptions

Exception | Condition
ArgumentException | s has fewer than two or more than four version components.
ArgumentOutOfRangeException | At least one component in s is less than zero.
FormatException | At least one component in s is not an integer.
OverflowException | At least one component in s represents a number that is greater than the max 32-bit value.

Remarks

The s parameter must have the following format:

   Major.Minor[.Build[.Revision]]
where Major, Minor, Build, and Revision are the string representations of the version numbers four components: major version number, minor version number, build number, and revision number. Optional components are shown in square brackets ([ and ]). The components must appear in the specified order, and must be separated by periods.

See Also

Project CorLib Overview

Class VersionStatic Overview


VersionStatic: TryParse

TryParse

Tries to convert the string representation of a version number to an equivalent Version object, and returns a value that indicates whether the conversion succeeded.

 Public Function TryParse(
      ByRef s As String,
      ByRef Result As Version ) As Boolean

Parameters

s
[ByRef] String. A string that contains a version number to convert.
Result
[ByRef] Version. When this method returns, contains the Version equivalent of the number that is contained in s, if the conversion succeeded, or Nothing if the conversion failed.

Return Values

Boolean - True if the s parameter was converted successfully; otherwise False..

See Also

Project CorLib Overview

Class VersionStatic Overview


WaitHandle

WaitHandle

See Also

Project CorLib Overview

Class WaitHandle Overview


WinResourceReader

WinResourceReader

A class that reads resources out of EXE and DLL files.

Implements:

IEnumerable
IObject
IResourceReader

Public:

Methods:

Name | Description
AddDecoder | Adds additional resource decoders to interpret binary data that is unknown to the ResourceReader.
CloseReader | Closes the reader
Equals | Returns a boolean indicating if the value and this object instance are the same instance.
GetEnumerator | Returns an IDictionaryEnumerator object.
GetHashCode | Returns a pseudo-unique number identifying this instance.
ToString | Returns a string representation of this object instance.

Remarks

Use this class to iterate the resources within an EXE or DLL file.

The only resource types recognized are Strings, Bitmaps, Icons and Cursors. All other resource types are maintained as byte arrays.

Pass this object into the ResourceManager constructor to retrieve specific resources based on ID, Type, and Culture. Or, pass this object into a ResourceSet to retrieve resources for a specific culture.

See Also

Project CorLib Overview

Class WinResourceReader Overview

Constructors

ResourceManager

ResourceSet

ResourceReader

IResourceReader

Win32Resource


WinResourceReader: AddDecoder

AddDecoder

Adds additional resource decoders to interpret binary data that is unknown to the ResourceReader.

 Public Sub AddDecoder(
      ByVal DecoderToAdd As IResourceDecoder )

Parameters

DecoderToAdd
[ByVal] IResourceDecoder. A resource decoder associated with a specific resource type.

Remarks

This allows the ResourceReader to be extended to handle additional resource types. If no decoder exists for the specific resource type, then the raw data is returned in a Byte array.

Resource types can be identified by either a numeric value, or a string name.

See Also

Project CorLib Overview

Class WinResourceReader Overview


WinResourceReader: CloseReader

CloseReader

Closes the reader

 Public Sub CloseReader ( )

See Also

Project CorLib Overview

Class WinResourceReader Overview


WinResourceReader: Equals

Equals

Returns a boolean indicating if the value and this object instance are the same instance.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to compare equalit to.

Return Values

Boolean - Boolean indicating equality.

See Also

Project CorLib Overview

Class WinResourceReader Overview


WinResourceReader: GetEnumerator

GetEnumerator

Returns an IDictionaryEnumerator object.

 Public Function GetEnumerator ( ) As IDictionaryEnumerator

Return Values

IDictionaryEnumerator - An enumerator.

Remarks

The enumerator returns values as DictionaryEntry objects. The Value property in the DictionaryEntry object returns a Win32Resource object which contains details about the specific resource found in the EXE or DLL file. The Key property returns the ID for the specific resource. The keys may not be unique across all resources, os using the Key as a unique identifier is not recommended.

See Also

Project CorLib Overview

Class WinResourceReader Overview


WinResourceReader: GetHashCode

GetHashCode

Returns a pseudo-unique number identifying this instance.

 Public Function GetHashCode ( ) As Long

Return Values

Long - Pseudo-unique number identifying this instance.

See Also

Project CorLib Overview

Class WinResourceReader Overview


WinResourceReader: IEnumerable

IEnumerable

 Implements IEnumerable

Return Values

IEnumerable -

See Also

Project CorLib Overview

Class WinResourceReader Overview


WinResourceReader: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class WinResourceReader Overview


WinResourceReader: IResourceReader

IResourceReader

 Implements IResourceReader

Return Values

IResourceReader -

See Also

Project CorLib Overview

Class WinResourceReader Overview


WinResourceReader: ToString

ToString

Returns a string representation of this object instance.

 Public Function ToString ( ) As String

Return Values

String - String representing this instance.

See Also

Project CorLib Overview

Class WinResourceReader Overview


XmlSyntaxException

XmlSyntaxException

Represents an exception caused by invalid XML syntax.

Implements:

Exception
IObject
SystemException

Public:

Properties:

Name | Description
Data (get) | Returns a key/value collection used to contain user-defined specific information about the exception.
ErrorNumber (get) | Returns the VB error number associated with this exception instance.
HelpLink (get) | Gets a link to a help file associated with the exception.
HelpLink (let) | Sets a link to a help file associated with the exception.
HResult (get) | Gets the HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException (get) | Gets the exception that caused the Subclassed exception to be thrown.
Message (get) | Gets the error message associated with the Subclass exception.
Source (get) | Gets a description of the source of the exception.
Source (let) | Sets a description of the source of the exception.

Methods:

Name | Description
Equals | Provides a basic implementation of the Equals function of the IObject interface.
GetBaseException | Gets the original exception that caused the chain of exceptions to occur.
GetHashCode | Provides a basic implementation of the GetHashcode function of the IObject interface.
ToString | Returns the exception message prepended with the type name of the Subclass Exception.

See Also

Project CorLib Overview

Class XmlSyntaxException Overview


XmlSyntaxException: Data (get)

Data

Returns a key/value collection used to contain user-defined specific information about the exception.

 Public Property Get Data ( ) As IDictionary

Return Values

IDictionary - A key/value collection for user-defined information.

Remarks

This is a public property that is used by the exception classes to allow user-defined information to be included with the exception.

Read Only.

See Also

Project CorLib Overview

Class XmlSyntaxException Overview


XmlSyntaxException: Equals

Equals

Provides a basic implementation of the Equals function of the IObject interface.

 Public Function Equals(
      ByRef Value As Variant ) As Boolean

Parameters

Value
[ByRef] Variant. The value to determine if is the same object instance as the exception.

Return Values

Boolean - Returns True if Value is the same instance as the exception object, False otherwise.

See Also

Project CorLib Overview

Class XmlSyntaxException Overview


XmlSyntaxException: ErrorNumber (get)

ErrorNumber

Returns the VB error number associated with this exception instance.

 Public Property Get ErrorNumber ( ) As Long

Return Values

Long - A VB error that matches the number return by Err.Number.

Read Only.

See Also

Project CorLib Overview

Class XmlSyntaxException Overview


XmlSyntaxException: Exception

Exception

 Implements Exception

Return Values

Exception -

See Also

Project CorLib Overview

Class XmlSyntaxException Overview


XmlSyntaxException: GetBaseException

GetBaseException

Gets the original exception that caused the chain of exceptions to occur.

 Public Function GetBaseException ( ) As Exception

Return Values

Exception - The Exception that caused the chain of exceptions to occur.

Remarks

If exceptions set their InnerException to a previously thrown exception, then a chain of exceptions can be created. Using this function will traverse that chain of exceptions until the original exception is reached. That exception with then be returned to the caller.

When an InnerException of Nothing is reached, then then the exception object is returned as the base exception because it did not have an inner exception, so it is assumed that the exception object is the last in the chain and therefore the cause of the chain of exceptions being iterated.

See Also

Project CorLib Overview

Class XmlSyntaxException Overview


XmlSyntaxException: GetHashCode

GetHashCode

Provides a basic implementation of the GetHashcode function of the IObject interface.

 Public Function GetHashCode ( ) As Long

Return Values

Long - A 32-bit value used to help identify the exception object.

Remarks

The value generated is not unique across all hashcodes. Additional measures must be taken to find a unique value that happens to have the same hashcode as the exception object.

See Also

Project CorLib Overview

Class XmlSyntaxException Overview


XmlSyntaxException: HelpLink (get)

HelpLink

Gets a link to a help file associated with the exception.

 Public Property Get HelpLink ( ) As String

Return Values

String - The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class XmlSyntaxException Overview


XmlSyntaxException: HelpLink (let)

HelpLink

Sets a link to a help file associated with the exception.

 Public Property Let HelpLink(
      ByRef Value As String )

Parameters

Value
[ByRef] String. Set the Uniform Resource Name (URN) or Uniform Resource Locator (URL).

Remarks

The return value, which represents a help file, is a URN or URL. For example, the HelpLink value could be:
"http://www.myhelpsite.com"

Read/Write.

See Also

Project CorLib Overview

Class XmlSyntaxException Overview


XmlSyntaxException: HResult (get)

HResult

Gets the HRESULT, a coded numerical value that is assigned to a specific exception.

 Public Property Get HResult ( ) As Long

Return Values

Long - The value of the associated HResult.

Remarks

An HResult is associated with an error result code. This allows for VB specific error codes to be returned.

Read Only.

See Also

Project CorLib Overview

Class XmlSyntaxException Overview

Exception


XmlSyntaxException: InnerException (get)

InnerException

Gets the exception that caused the Subclassed exception to be thrown.

 Public Property Get InnerException ( ) As Exception

Return Values

Exception - The inner exception that caused the current exception to be thrown.

Remarks

when an exception is thrown and that exception causes another exception to be thrown, then the InnerException of the new Exception object should contain the exception that caused it to be thrown.

Read Only.

See Also

Project CorLib Overview

Class XmlSyntaxException Overview


XmlSyntaxException: IObject

IObject

 Implements IObject

Return Values

IObject -

See Also

Project CorLib Overview

Class XmlSyntaxException Overview


XmlSyntaxException: Message (get)

Message

Gets the error message associated with the Subclass exception.

 Public Property Get Message ( ) As String

Return Values

String - A custom message set by the Subclass, or a default message of "An Error has occurred."

Remarks

Generally this property is set to a meaningful message that is related to the exception that is being thrown. The message should be human readable.

This property can be set in the constructor NewException.

Read Only.

See Also

Project CorLib Overview

Class XmlSyntaxException Overview


XmlSyntaxException: Source (get)

Source

Gets a description of the source of the exception.

 Public Property Get Source ( ) As String

Return Values

String - A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class XmlSyntaxException Overview


XmlSyntaxException: Source (let)

Source

Sets a description of the source of the exception.

 Public Property Let Source(
      ByRef Value As String )

Parameters

Value
[ByRef] String. A description of the source of the exception.

Remarks

The source of an exception generally will contain the name of the function being called when the exception was thrown. This is to help narrow down exactly where the exception had occurred.

Read/Write.

See Also

Project CorLib Overview

Class XmlSyntaxException Overview


XmlSyntaxException: SystemException

SystemException

 Implements SystemException

Return Values

SystemException -

See Also

Project CorLib Overview

Class XmlSyntaxException Overview


XmlSyntaxException: ToString

ToString

Returns the exception message prepended with the type name of the Subclass Exception.

 Public Function ToString ( ) As String

Return Values

String - A formatted message containing the original message and possible type of exception.

Remarks

A general format might look like this:
VBCorLib.SystemException: An Error has occurred.

A listing of all inner exceptions will be included in the return value.

See Also

Project CorLib Overview

Class XmlSyntaxException Overview


MemoryMappedFileStatic: MemoryMappedFileAccess

MemoryMappedFileAccess

Specifies access capabilities and restrictions for a memory-mapped file or view.

 Public Enum MemoryMappedFileAccess

Values

ReadWrite = 0
Read and write access to the file.
ReadOnly
Read-only access to the file.
WriteOnly
Write-only access to file.
CopyOnWrite
Read and write access to the file, with the restriction that any write operations will not be seen by other processes.
ReadExecute
Read access to the file that can store and run executable code.
ReadWriteExecute
Read and write access to the file that can store and run executable code.

Remarks

See Also

Project CorLib Overview
Class MemoryMappedFileStatic Overview
Build on Wednesday, July 24, 2019 by VBDOX
Copyright © 2000 - 2003 M.Stamenov


** VBCorLib **

version 3.0 (BREAKING CHANGES)
    * Renamed cArray to CorArray.
    * Renamed cString to CorString.
    * Renamed cDateTime to CorDateTime.
    * Fixed CorArray.Copy and CorArray.CopyEx for type Double.
    * Added NewDecimals array creator.
    * Fixed CorArray.IndexOf when searching byte arrays.
    * Fixed CorArray.LastIndexOf when searching byte arrays.
    * Fixed array comparison of objects. Would break if element was Nothing.
    * Fixed CorArray.FindIndex. Returned incorrect result when supplying index.
    * Refactored CorArray.BinarySearch signature to include a CorArray.BinarySearchEx, removing need for optional values. *POSSIBLE BREAKING*
    * Updated CorArray.CreateInstance to build multi-dimension arrays in same order as VB6. *BREAKING*
    * Updated CorArray.CreateInstance to support multi-dimension arrays with selected 0 lengths.
    * Removed ciArrayTypes. Replaced with VbVarType. *BREAKING*
    * Removed CorArray.NewArray. *BREAKING*
    * Renamed CorArray.GetLength to CorArray.Length.
    * Renamed CorArray.GetRank to CorArray.Rank.
    * Fixed missing floating point leading zero before decimal.
    * Fixed max negative Long not displaying correct number.
    * Changed Convert.ToString(Nothing) returns "" instead of "Nothing".
    * Removed CorString.CharCount method. *BREAKING*
    * Removed Comparer parameter from Queue.Contains method to align more with .NET.
    * Removed Comparer parameter from Stack.Contains method to align more with .NET.
    * Added LeaveOpen constructor parameter to StreamReader.
    * Added EndOfStream property to StreamReader.
    * Added SafeHandle and SafeHandleBase types.
    * Added SafeFileHandle type.
    * Added MyBase methods to separate IObject implementations from standard Object.* calls.
    * Reordered 'Message' and 'ParamName' arguments in ArgumentException to more align with .NET. **
    * Reordered 'Message', 'ParamName', and 'ActualValue' arguments in ArgumentOutOfRangeException to more align with .NET. **
    * Fixed ArrayList.SetRange when using ICollection source would insert instead of overwriting.
    * Fixed MemoryStream SeekPosition when using FromEnd. Was off by 1.
    * Fixed MemoryStream ReadBlock not honoring lower-bound of output buffer.
    * Refactored ArrayList binary search method into BinarySearch and BinarySearchEx to require the index and count in a separate call. **
    * TimeSpan.Add and TimeSpan.Subtract now support argument of Nothing as equating to zero.
    * Added Guid.TryParse, Guid.TryParseExact and Guid.ParseExact methods.
    * Enhanced Guid parsing methods to support 'B', 'b', 'D', 'd', 'P', 'p', 'N', 'n', 'X', 'x' format specifications.
    * Changed default ToString method for Guid with no format specified from 'B' to 'D' to align with .NET 2.0.
    * Guid objects are now always read-only when using a constructor or parsing.
    * Removed Guid.FromByteArray and Guid.FromMemory methods.
    * NewGuid now accepts a byte array or memory pointer.
    * Added Char static class.
    * Fixed CorDateTime.ToLocalTime and CorDateTime.ToUniversalTime. Were not setting corret DateTimeKind.
    * Removed 'Format' parameter from Convert.ToString to align with .NET.
    * Added StringComparer class with Ordinal and OrdinalIgnoreCase implementations.
    * Removed IHashCodeProvider. *BREAKING*
    * Added IEqualityComparer.
    * Updated Hashtable to use IEqualityComparer instead of IHashCodeProvider/IComparer combination. *BREAKING*
    * Converting as many ByVal string parameters to ByRef as possible. *POSSIBLE BREAKING*
    * Fixed SHA512Managed and SHA384Managed to produce correct .NET 2.0 values instead of broken 1.0 values.
    * Added EnumeratorBase to help easily build list enumerators.
    * Path class will attempt to expand short path formats if the path exists.
    * CorString.Join method signature changed to match .NET. *BREAKING*
    * CorString.Join Separator is now required.
    * CorString.Join improved to support any array or enumerable collection of items.
    * Added CorString.IsNullOrWhiteSpace method.
    * Added Restart method to StopWatch class.
    * Removed RSAParameters InverseQ property from serialization process.
    * Updated SecurityElement Attributes property to match .NET characteristics.
    * Fixed SecurityElement AddAttributes. Should throw ArgumentException when adding duplicate attribute name.
    * Fixed SecurityElement GetAttribute. Was not unescaping escaped sequences.
    * Fixed SecurityElement constructor. Was not validating tag or text.
    * Fixed RijndaelManaged encrypting. TransformFinalBlock when using PaddingMode.None and partial block length of data would still return full block length.
    * Fixed RijndaelManaged encrypting. TransformFinalBlock when using PaddingMode.Zero and full block length of data would return additional block.
    * Removed RegistryKey support for HKEY_DYN_DATA.
    * Removed Registry.GetRootKey to align with .NET framework.
    * Removed Registry.GetSubKey to align with .NET framework.
    * Added DecoderFallback to Encoding interface.
    * Added EncoderFallback to Encoding interface.
    * Fixed UTF8Encoding to error on invalid surrogates.
    * Re-implemented UnicodeEncoding.
    * Added LeaveOpen option to BinaryReader constructor.
    * Fixed BinaryReader ReadChars and ReadBytes now return zero-length arrays if no data can be read instead of throwing an exception.
    * Fixed BinaryReader to use Decoder instead of Encoding when reading data from stream so multi-byte characters are correctly read across reads.
    * Changed CorArray.IsNull to return False for uninitialized array of objects because calling the method will initialize the array to an empty array. *BREAKING*
    * Fixed BigInteger Negate. Would fail to return positive value for boundry aligned values such as 0x80000000.
    * Fixed BigInteger Negate. Would fail to update precision when changing negative value to positive.
    * Fixed BigInteger DevRem. When dividing by a negative value, remainder should still be positive.
    * Renamed BigInteger.ToArray to BigInteger.ToByteArray to match the .net method name. *BREAKING*
    * Updated BigInteger.Parse to match .NET implementation closely. Now utilizes the NumberStyles enum.
    * Fixed CorDateTime.MaxValue to include max ticks.
    * Fixed HebrewCalendar to correctly identify all days in leap month as a leap day.
    * Added Convert.ToDateTime method.
    * Renamed ResByteEncoder to BinaryResourceEncoder. *BREAKING*
    * Renamed ResBitMapEncoder to BitMapResourceEncoder. *BREAKING*
    * Fixed BitMapResourceEncoder Encode. Was crashing because of an improper pointer being passed to an API.
    * Fixed Object.GetHashCode. Would crash with vbNullString.
    * Added additional SpecialFolder enums defined in .NET 4.
    * Added Environment.Is64BitOperatingSystem method.
    * Added StringBuilder.Clear method.
    * Renamed BinaryReader "ReadLong" and "ReadInteger" methods to "ReadInt32" and "ReadInt16" to align with .NET methods. *BREAKING*
    * Renamed IniFile "GetLong" and "GetInteger" methods to "GetInt32" and "GetInt16" to more align with .NET naming. *BREAKING*
    * Renamed IniSectionWriter to IniResourceWriter. *BREAKING*
    * Implemented IResourceWriter.CloseWriter in IniResourceWriter.
    * Fixed tests that would break when run against a compiled VBCorLib.
    * Fixed BitMapResourceDecoder. Was crashing when compiled because of improper release of resources.
    * Removed WeakReference class because it is severely limited and unstable.
    * Added CorArray.IsNullOrEmpty method.
    * Added optional parameters to Path.Combine method.
    * Added Path.CombineArray method.
    * Renamed incorrectly spelled static method TimeSpan.CompareTo to TimeSpan.Compare.
    * Added formatting functionality to TimeSpan.ToString method.
    * Added StringBuilder.AppendFormatArray and StringBuilder.AppendFormatArrayEx methods.
    * Changed StringReader contructor to accept parameter indicating of string should be copied, replacing parameter indicating string should be stolen. *BREAKING*
    * Fixed CorDateTime.ToAODAte. Would round to incorrect time when having enough milliseconds.
    * Added Int64 user-defined type.
    * Added user-defined type support in ObjectStatic.
    * Re-implemented MemoryMappedFile to create a MemoryMappedViewAccessor.
    * Added MemoryMappedViewAccessor to access mapped views of a file.
    * Fixed MemoryStream. Should through ObjectDisposedException when reading Position property when closed.
    * Re-implemented MemoryMappedFile to align with .NET 4.0.
    * Added CopyTo method to Stream interface to align with .NET 4.0.
    * Renamed IVersionableCollection interface to IVersionable.
    * Added ReadInt64 to BinaryReader to support Int64 structure.
    * Added support for Int64 to BinaryWriter.WriteValue method.
    * Renamed BitConverter class ToLong and ToInteger to ToInt32 and ToInt16 to match .NET. *BREAKING*
    * Changed BinaryReader.ReadDate to read binary data that represents ticks to match .NET. *BREAKING*
    * Changed BinaryWriter.WriteDate to write binary data that represents ticks to match .NET. *BREAKING*
    * Changed BitConverter class to handle Date as ticks to match .NET. *BREAKING*
    * Added Int64 static methods for manipulating and creating an Int64 data-type.
    * Added CInt64 for easy conversion to Int64 data-type.
    * Added support for BigInteger to be initialized from an Int64.
    * Fixed NewCultureInfo(String). Should not be case-sensitive.
    * Fixed BinaryWriter.SeekPostion. Was not returning new position.
    * Fixed BinaryWriter.WriteChar. Was not converting large 32-bit values to 16-bit correctly.
    * Added charactor formatting for Long, Integer, Byte, and Int64 to Object.ToString method. '$' forces the numeric value to converted to a character.
    * Replaced CorString.FromCharArray with NewString constructor.

version 2.3
    * Updated ASM code to not trigger DEP protection.
    * Updated ArrayList to include the ArrayList.Adapter method, wrapping an IList object.
    * Fixed the StringBuilder.Remove method.
    * Updated Console class to automatically disable the close button on a command prompt when working in the IDE.
    * Added TryParse to TimeSpan.
    * Added TryParse to cDateTime.

version 2.2
    * Added the BigInteger class
    * Fixed Queue class. Incorrectly zeroed out memory, causing a crash.
    * Fixed Path class. Incorrectly handled files begining with a period.
    * Fixed Path class. Incorrectly handled directory names that include '..' to move up a directory.
    * Fixed HebrewCalendard class. Incorrectly handled day 355 of a leap year.
    * Fixed JapaneseCalender class. Incorrectly handled the start of each year after the first of an era.
    * Fixed DSAParameter class. Now includes the J parameter on XML export.

version 2.1
    * Added Wide Character API support to INIFile and INISectionWriter classes
    * Added EmptyGuid to the GuidStatic class.
    * Fixed the Wide Character support for file API calls used on NT machines.
    * Fixed the return types for SHA384Static and SHA512Static create methods.

version 2.0
    * Many many cryptography classes have been added.
    * This list is only a portion of all the additions and changes to the library.

Symmetric Algorithms
--------------------
Rijndael
DES
Triple DES
RC2

Asymmetric Algorithms
---------------------
RSA

Asymmetric signing and verification algorithms
----------------------------------------------
RSA
DSA

Hash Algorithms
---------------
SHA-1
SHA-256
SHA-384
SHA-512
MD5
RIPEMD160

Message Authentication Code Algorithms
--------------------------------------
HMACSHA-1
HMACSHA-256
HMACSHA-384
HMACSHA-512
HMACMD5
HMACRIPEMD160
TripleDES Mac

Password Generators
-------------------
Rfc2898DeriveBytes

Utility Classes
---------------
CryptoStream
CryptoConfig
SecurityElement
RNGCryptoServiceProvider

Unicode API support
-------------------
All of the file, directory and registry classes support Unicode directly on NT
machines. This allows for long file names (over 32k).

VBCultures.nlp and Resource File
--------------------------------
The VBCultures.nlp file has been included as a resource to be compiled directly
into the library. This is to reduce the dependency of handling multiple files
for distribution.

There are also several code updates through the library.

If you have any questions, please visit the VBCorLib website:
http://www.kellyethridge.com/vbcorlib