Class ProductType
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
ushortThe unique Id of the ProductType.
name
stringThe 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
Communications
Gets the General Purpose Discrete ProductType instance (id=12).
public static ProductType Communications { get; }
Property Value
Controller
Gets the General Purpose Discrete ProductType instance (id=14).
public static ProductType Controller { get; }
Property Value
Discrete
Gets the General Purpose Discrete I/O ProductType instance (id=7).
public static ProductType Discrete { get; }
Property Value
Id
Gets the value that uniquely identifies the ProductType.
public ushort Id { get; }
Property Value
Name
Gets the value that represents the ProductType name.
public string Name { get; }
Property Value
Unknown
Represents an Unknown ProductType with no id or name.
public static ProductType Unknown { get; }
Property Value
Methods
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
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
stringThe 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
ProductTypeAn object to compare.
right
ProductTypeAn 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
ProductTypeThe ProductType object to convert.
Returns
implicit operator ProductType(ushort)
Converts a ushort value to a ProductType object that represents the Id.
public static implicit operator ProductType(ushort productTypeId)
Parameters
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
ProductTypeAn object to compare.
right
ProductTypeAn object to compare.
Returns
- bool
true if the provided objects are not equal; otherwise, false.