NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

What is the Common Language Specification?

For objects to be able to understand each other no matter what language compiler they are compiled with, they must expose to callers only those data types and features that are common to all the languages they need to interoperate with. For this reason, the runtime has identified a set of language features called the Common Language Specification (CLS), which includes the basic language features needed by many applications. If your component uses only CLS features in the API that it exposes to other code, including subclasses, the component is guaranteed to be accessible from any object compiled by a language compiler that supports the CLS. Components that adhere to the CLS rules and use only the features included in the CLS are said to be CLS-compliant components.

The following list summarizes the types and features that are in the CLS. This list is intended to be informative, but not comprehensive. The primitive types listed are the types in the NGWS Frameworks, with a description of each type in parentheses.

  CLS Feature Description
Primitive types:   
   System.Boolean (true or false)
   System.Char (2-byte unsigned integer)
   System.Byte (1-byte unsigned integer)
   System.Int16 (2-byte signed integer)
   System.Int32 (4-byte signed integer)
   System.Int64 (8-byte signed integer)
   System.Single (4-byte floating point number)
   System.Double (8-byte floating point number)
   System.String (A string of zero or more characters; null is allowed.)
   System.Object (The root of all class inheritance hierarchies)
Arrays:   
   Can have known type, known ( >= 1) dimension (rank), with zero lower bound.
   Element type must be a CLS type.
Types:   
   Can be abstract or sealed (but not both).
   Can implement zero or more interfaces; different interfaces can have methods with the same name and signature.
   Can be derived from exactly one type and override or hide members provided by that type.
   Can have zero or more members, which are fields, methods, events, or types.
   Can have zero or more constructors.
   Can have public or assembly visibility, but only public members are considered part of the "public" interface of the type.
   Value types must inherit from System.ValueType, unless they are enumerations, in which case they inherit from System.Enum.
Type members:   
   Members can override or hide other members in another type.
   Argument types and return types must be CLS-compliant types.
   Constructors, methods, and properties can be overloaded.
   Members can be abstract, but not if the type is sealed.
   Can have public. private, family, assembly, FamilyAndAssembly, or FamilyOrAssembly visibility, but only Public, Family and FamilyOrAssembly are considered part of the "public" interface of the type.
Methods:   
   Can be one of virtual, instance, or static.
   Virtual and instance methods can be abstract or concrete (static methods must be concrete).
   Virtual methods can be final (or not).
Fields:   
   Can be static or non-static.
   Static fields can be initonly or literal.
Properties:   
   Can be exposed as Get and Set methods instead of using property syntax.
   Return type of the Getter and the first argument of the setter must be identical; this is the "property type."
   Cannot differ by the "property type" alone.
   If an X property is defined, you cannot define Get_X and Set_X methods in the same class.
   Can be indexed.
   Must follow this naming pattern: get_<PropName>, set_<PropName>.
Enumerations:   
   Underlying type must be Byte, Int16, Int32, or Int64.
   Each member is a static literal field of the enum's type.
   Cannot implement any interfaces.
   Multiple fields can be assigned the same value.
   Must inherit from System.Enum.
Exceptions:   
   Can be thrown and caught.
   Must inherit from System.Exception.
Interfaces:   
   Can require implementation of other interfaces.
   Can define properties, events, and virtual methods.
Event:   
   Add and remove methods must be either both provided or both absent; each of these methods take one parameter, which is a class derived from System.Delegate.
   Must following this naming pattern: add_<EventName>, remove_<EventName>, and raise_<EventName>.
Custom Attributes:   
   Can use only the following types: Type, String, Char, Boolean, Byte, Int16, Int32, Int64, Single, Double, Enum (of a CLS type), Object.
Delegates:   
   Can be created and invoked.
Identifiers   
   The first character must come from a restricted set.
   Case cannot be used to distinguish between identifiers within a single name scope (i.e, types within assemblies, members within types).