Show / Hide Table of Contents

Class LambdaFactoryBlueprint<TBlueprintID, TProduced>

An implementation of IFactoryBlueprint<TBlueprintID, TProduced> that allows you to specify a Func object to use as the factory method.

Inheritance
object
LambdaFactoryBlueprint<TBlueprintID, TProduced>
Implements
IFactoryBlueprint<TBlueprintID, TProduced>
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: GoRogue.Factories
Assembly: GoRogue.dll
Syntax
public class LambdaFactoryBlueprint<TBlueprintID, TProduced> : IFactoryBlueprint<TBlueprintID, TProduced>
Type Parameters
Name Description
TBlueprintID

The type being used to identify what object to produce.

TProduced

The type of object being produced.

Remarks

This class may be useful for simple cases where your blueprint has no state, and you simply need to specify some code to run to create the object. For more complex cases, you may want to implement your own IFactoryBlueprint.

Constructors

View Source

LambdaFactoryBlueprint(TBlueprintID, Func<TProduced>)

Constructor.

Declaration
public LambdaFactoryBlueprint(TBlueprintID id, Func<TProduced> factoryMethod)
Parameters
Type Name Description
TBlueprintID id

A unique identifier for this factory blueprint definition.

Func<TProduced> factoryMethod

The method to call when Create() is used in order to get the object to return.

Properties

View Source

ID

A unique identifier of this factory definition.

Declaration
public TBlueprintID ID { get; }
Property Value
Type Description
TBlueprintID

Methods

View Source

Create()

Creates an object of the type specified by TProduced.

Declaration
public TProduced Create()
Returns
Type Description
TProduced

The created object.

Implements

IFactoryBlueprint<TBlueprintID, TProduced>

Extension Methods

Utility.Yield<T>(T)
  • View Source
In this article
Back to top Generated by DocFX