Table of Contents

Class ProductType

Namespace
L5Sharp.Common
Assembly
L5Sharp.dll

An entity that represents the type of product of a given Module.

public class ProductType
Inheritance
ProductType
Inherited Members

Remarks

This object is a simple entity type wrapper that groups the product type id and name. Product types are defined by Rockwell and assigned unique Id and name. Some known/common types that are available as static members of this class include Discrete, Analog, Controller, and Communications.

Constructors

ProductType(ushort, string?)

Creates a new ProductType entity with the provided id and name.

public ProductType(ushort id, string? name = null)

Parameters

id ushort

The unique Id of the ProductType.

name string

The name of the ProductType. Will default to empty if not provided.

Properties

Analog

Gets the General Purpose Analog I/O ProductType instance (id=10).

public static ProductType Analog { get; }

Property Value

ProductType

Communications

Gets the General Purpose Discrete ProductType instance (id=12).

public static ProductType Communications { get; }

Property Value

ProductType

Controller

Gets the General Purpose Discrete ProductType instance (id=14).

public static ProductType Controller { get; }

Property Value

ProductType

Discrete

Gets the General Purpose Discrete I/O ProductType instance (id=7).

public static ProductType Discrete { get; }

Property Value

ProductType

Id

Gets the value that uniquely identifies the ProductType.

public ushort Id { get; }

Property Value

ushort

Name

Gets the value that represents the ProductType name.

public string Name { get; }

Property Value

string

Unknown

Represents an Unknown ProductType with no id or name.

public static ProductType Unknown { get; }

Property Value

ProductType

Methods

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

Parse(string)

Creates a new ProductType using the provided product Id.

public static ProductType Parse(string productId)

Parameters

productId string

The unique valid that identifies the Product.

Returns

ProductType

A new ProductType object with the provided Id.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Operators

operator ==(ProductType?, ProductType?)

Determines if the provided objects are equal.

public static bool operator ==(ProductType? left, ProductType? right)

Parameters

left ProductType

An object to compare.

right ProductType

An object to compare.

Returns

bool

true if the provided objects are equal; otherwise, false.

implicit operator ushort(ProductType)

Converts a ProductType object to a ushort that represents the Id.

public static implicit operator ushort(ProductType productType)

Parameters

productType ProductType

The ProductType object to convert.

Returns

ushort

A ushort representing the value of the ProductType Id.

implicit operator ProductType(ushort)

Converts a ushort value to a ProductType object that represents the Id.

public static implicit operator ProductType(ushort productTypeId)

Parameters

productTypeId ushort

The ushort value to convert.

Returns

ProductType

A ProductType with the Id of the converted value.

operator !=(ProductType?, ProductType?)

Determines if the provided objects are not equal.

public static bool operator !=(ProductType? left, ProductType? right)

Parameters

left ProductType

An object to compare.

right ProductType

An object to compare.

Returns

bool

true if the provided objects are not equal; otherwise, false.