DictionaryBase Introduction

Generated Source Code Base Class

System.Collections.DictionaryBase

Description

The DictionaryBase abstract base class provides the functionality for a "basic" key/value collection, the generated source code enhances this functionality by adding the following, type safe, members: Item or indexer property, Add, Contains, ContainsValue, CopyTo and Remove methods. The generated dictionary class is decorated with the Serializable attribute, therefore, providing that the contained key/value types are also serializable, the entire dictionary can be serialized for storage or transmission.

A private, nested, read only wrapper class can be generated as part of the DictionaryBase derived dictionary class source code. The read only wrapper is derived from the generated dictionary type, therefore it can be returned, transparently, from any property or method that is typed as the generated dictionary class. The read only wrapper class does not allow write operations on the underlying dictionary when called on an instance of the relevant generated dictionary class type or when called explicitly on the IDictionary interface.

A private, nested, thread safe, synchronized wrapper class can be generated as part of the DictionaryBase derived dictionary class source code. The synchronized wrapper is derived from the generated dictionary type, therefore it can be returned, transparently, from any property or method that is typed as the generated dictionary class. The synchronized wrapper class performs thread safe operations on the underlying dictionary when called on an instance of the relevant generated dictionary class type or when called explicitly on the IDictionary interface.

Generated Source Code .Net Framework Version Compatibility

Versions: 3.5, 3.0, 2.0 and 1.1

Generation Properties

You will be required to select/specify the following values in the generation property wizard as part of the source code generation process:

Property Description
Language You can generate either CSharp or Visual Basic source code
Key Class Name The Type or Class name of the objects that are to be used as the dictionary keys
Collected Class Name The Type or Class name of the objects that are to be stored in the dictionary
Dictionary Class Name The Type or Class name of the dictionary
Namespace The dictionary class namespace (CSharp only)
Allow Null Items Specify True if the dictionary is to allow null items to be added, False if not
Wrapper In addition to the dictionary class you can also generate a read only or synchronized wrapper class for the dictionary

Note

The key is assumed to be a reference type and is, therefore, checked for null. If a value type is specified as the key, the single check for a null key needs to removed from the generated source code.

If the collected class is not in the same namespace as the dictionary class, a using (Imports in Visual Basic) statement will need to be added to the generated source code.

Visual Basic Only

If the dictionary class is not in the default (project) namespace i.e. it is in a sub-namespace, a Namespace statement will need to be added to the generated source code.

Terms and Conditions

Blayd Software retain the copyright and other intellectual rights to the source code as originally generated. However, once you have the source code, you may change it by altering members, adding new members or removing members and you may use the source code in your own personal or commercial projects, either in its original form or with your own alterations. We strongly recommend that you read the full terms and conditions for the use of the generated source code before continuing.

Hints and Tips

We have put together a page of hints and tips to help you get the most out of our .Net Framework source code generator. If you have any doubts or queries about the generation properties and their influence on the generated source code or any other queries we recommend that you read the hints and tips before continuing.

DictionaryBase Standard

The generated source code is supplied free of charge for personal use, however, if the source code is to be used in a commercial project we request that you make a donation to help us to cover the cost of developing and testing the source code and the cost of providing the online code generator service. You may also make a donation even if the source code is for personal use. Although we do not expect you to donate for personal use we would appreciate the gesture.

The option to make a donation to help cover the cost of the service is provided on the generated source code page, click the "Continue" button to specify the generation properties and generate your source code.