Skip to content

Polyfills

samatrhea edited this page Mar 16, 2021 · 8 revisions

COMET is the new name for what was previously called the CDP4. We are transitioning the applications and software libraries. The code and documentation will still refer to CDP4 in a number of places while we are updating.

Target Frameworks

The COMET-SDK provides support for the following target frameworks:

  • net45
  • net451
  • net452
  • net46
  • net461
  • net462
  • net47
  • netstandard1.6
  • netstandard2.0

Query* methods

The Type class does not expose the same API in the different target frameworks. A polyfill class is made available to provide exentions methods on the Type class to harmonize the implementation for all the target frameworks of the COMET-SDK.

Methods and properties that are not available using the same .NET libraries or namespaces for all the target frameworks are prefixed with the word Query. These methods are implemented in the same file. Compiler directives are used to differentiate between the implementations that are valid for the different target frameworks specified above.

An example:

NET45
public static bool QueryIsValueType(this Type type)
{
    return type.IsValueType;
}

NETSTANDARD1.6
public static bool QueryIsValueType(this Type type)
{
    return type.GetTypeInfo().IsValueType;
}

kudos to Michael Whelan for an excellent article on porting code to .NET Core.


« CDP4Common-CE Comparers  —  Documentation overview  —  CDP4Common-CE Validation »

Clone this wiki locally