Field

Namespace: Babel.Licensing Assembly: Babel.Licensing.dll

Represents a license field used to store key value pairs in a license.

public class Field : IObservableObject

Inheritance

objectField

Implements

IObservableObject

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

Field()

Specialized default constructor for use only by derived class.

protected Field()

Field(string, string)

Initializes a new instance of the class with the given name and value.

public Field(string name, string value)

Parameters

NameDescription

name string

The field name.

value string

The value stored into this field object.

Examples

ECDsaSignature ecdsa = new ECDsaSignature(ECDsaKeySize.KeySize112bit);
ecdsa.CreateKeyPair();

string licenseKey = new StringLicense()
                        .ForAnyAssembly()
                        .WithField("copyright", "Copyright ACME Ltd. All rights reserved.")
                        .WithField("notes", "For resellers.")
                        .WithFields(new Field("country", "it"), new Field("zip code", "00100"))
                        .SignWith(ecdsa)
                        .ToReadableString();

StringLicenseManager manager = new StringLicenseManager();
StringLicense license = manager.Validate(licenseKey);

Exceptions

NameDescription

Thrown when one or more required arguments are null.

Field(string)

Initializes a new instance of the class with the given field name.

public Field(string name)

Parameters

NameDescription

name string

The field name.

Exceptions

NameDescription

Thrown when the parameter name is null.

Field(Field)

Copy constructor.

public Field(Field other)

Parameters

NameDescription

other Field

The Field object to copy.

Exceptions

NameDescription

Thrown when the parameter other to copy is null.

Properties

Id

Gets or sets the field identifier.

public virtual string Id { get; set; }

Property Value

string

Listeners

Gets the listeners.

public virtual IEnumerable<IObjectListener> Listeners { get; }

Property Value

IEnumerable<IObjectListener>

Name

Gets or sets the field name.

public virtual string Name { get; set; }

Property Value

string

Value

Gets or sets the field value.

public virtual string Value { get; set; }

Property Value

string

Methods

Attach(IObjectListener)

Attaches the given listener.

public virtual void Attach(IObjectListener listener)

Parameters

NameDescription

The listener.

Exceptions

NameDescription

Thrown when one or more required arguments are null.

Detach(IObjectListener)

Detaches the given listener.

public virtual void Detach(IObjectListener listener)

Parameters

NameDescription

The listener.

Exceptions

NameDescription

Thrown when one or more required arguments are null.

Notify(params object[])

Notifies registered listeners.

public virtual void Notify(params object[] args)

Parameters

NameDescription

args object[]

A variable-length parameters list containing arguments.

Last updated