---
agentTools:
  projectIndex: https://objectfillernet.readme.io/llms.txt
---

# Export and reuse Setup

[block:api-header]
{
  "type": "basic",
  "title": "Documentation",
  "sidebar": true
}
[/block]

[block:textarea]
{
  "text": "The following example shows how to save the setup of ObjectFiller.NET.\nIn the fluent setup API you can call the Property **`.Result`** which holds the setup of your ObjectFiller.NET configuration. \n\nIn the example the **`.Result`** of the filler setup is saved to a private field with the name \"`_fillerSetup`\". This setup is then reused in the method `FillPerson()` by calling **`.Setup(_fillerSetup)`** with the setup of this private field! \n\nThis is really good if you want to reuse your setup at another place.",
  "sidebar": true
}
[/block]

[block:code]
{
  "codes": [
    {
      "code": "public class Person\n{\n  public string Name { get; set; }\n  public string LastName { get; set; }\n  public int Age { get; set; }\n  public DateTime Birthday { get; set; }\n}\n\npublic class HelloFiller\n{\n  private FillerSetup _fillerSetup;\n  \n  public HelloFiller()\n  {\n    Filler<Person> pFiller = new Filler<Person>();\n\n    _fillerSetup = pFiller.Setup()\n    .OnProperty(x => x.LastName).Use(\"Miller\")\n    .OnProperty(x => x.Name).Use(\"John\")\n    .OnType<int>().Use(new IntRange(18, 75))\n    .Result;\n  }\n  \n  public void FillPerson()\n  {\n    Filler<Person> pFiller = new Filler<Person>();\n    pFiller.Setup(_fillerSetup);\n\n    Person filledPerson = pFiller.Create();\n  }\n}",
      "language": "csharp",
      "name": "Call .Result to save the filler setup and reuse it somewhere else"
    }
  ]
}
[/block]

Another way to create reusable setups is the **`Create`** method of the static **`FillerSetup`** class.
In this case you do not need a specific **´Filler<T>\`** when setting up the configuration. Fillersetups can also be used with the [Randomizer](https://objectfillernet.readme.io/docs/usage-of-static-class-randomizer) .

[block:code]
{
  "codes": [
    {
      "code": "public class Person\n{\n  public string Name { get; set; }\n  public string LastName { get; set; }\n  public int Age { get; set; }\n  public DateTime Birthday { get; set; }\n}\npublic class HelloFiller\n{\n  private FillerSetup _fillerSetup;\n\n  public HelloFiller()\n  {\n    var setup = FillerSetup.Create<Person>();\n    _fillerSetup = setup.OnProperty(x => x.LastName).Use(\"Miller\")\n      .OnProperty(x => x.Name).Use(\"John\")\n      .OnType<int>().Use(new IntRange(18, 75))\n      .Result;\n  }\n\n  public void FillPerson()\n  {\n    Person filledPerson = Randomizer<Person>.Create(_fillerSetup);\n  }\n}",
      "language": "csharp",
      "name": "Use method \"Create\" of the static class FillerSetup to create a setup"
    }
  ]
}
[/block]