For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Book a demoLog inStart for free
  • Overview
    • Introduction
    • How it works
    • Quickstart
    • Customer showcase
  • Working with SDKs
    • Project structure
    • Adding custom code
    • Migrating to Replay
    • Capabilities
  • Generators
      • Generating an SDK
      • Publishing to NuGet
      • Configuration
      • Adding custom code
      • Version compatibility
      • Changelog
      • Customer showcase
  • Reference
    • generators.yml
Checking status...
SOC2Soc 2 Type II
© 2026 Fern • Birch Solutions, Inc., a Postman company

Documentation

SDKsDocsAsk FernCLI Reference

API Definitions

OpenAPIAsyncAPIOpenRPCgRPC

Resources

BlogSupportPricing

Company

Brand KitPrivacy PolicyTerms of Service
LogoLogo
Book a demoLog inStart for free
On this page
  • Adding custom logic
  • Adding custom SDK methods
Generators.NET

Adding custom code

||View as Markdown|
Was this page helpful?
Edit this page
Previous

.NET configuration

Next

.NET compatibility

This page covers how to add custom logic and methods to your .NET SDK.

Adding custom logic

To get started adding custom code:

These steps cover adding a new custom file to the SDK. To preserve line-level edits to a generated file, use Replay instead.
1

Create a new file and add your custom logic

src/YourNamespace/Helper.cs
1namespace YourNamespace;
2
3public static class Helper
4{
5 public static void MyHelper()
6 {
7 Console.WriteLine("Hello World!");
8 }
9}
2

Add your file to .fernignore

.fernignore
1# Specify files that shouldn't be modified by Fern
2
3src/YourNamespace/Helper.cs
3

Consume the helper

Now your users can consume the helper function by importing it from the SDK.

1using YourNamespace;
2
3Helper.MyHelper();

Adding custom SDK methods

Fern also allows you to add custom methods to the SDK itself (e.g. client.my_method() ) by inheriting the Fern generated client and then extending it.

1

Update generators.yml configuration

Name your Fern-generated client something like BaseClient to reflect that this client will be extended.

generators.yml
1- name: fernapi/fern-csharp-sdk
2 version: 2.65.0
3 config:
4 client-class-name: BaseClient
2

Import and extend the generated client

First, import the Fern generated base client and extend it. Then, add whatever methods you want.

src/YourNamespace/MyClient.cs
1namespace YourNamespace;
2
3public class MyClient : BaseClient
4{
5 public MyClient(ClientOptions? clientOptions = null) : base(clientOptions)
6 {
7 }
8
9 public void MyHelper()
10 {
11 Console.WriteLine("Hello World!");
12 }
13}
3

Update .fernignore

Add the MyClient.cs to .fernignore.

.fernignore
1+ src/YourNamespace/MyClient.cs
4

Consume the method

Instead of constructing the generated client, your users will want to construct the extended client.

1using YourNamespace;
2
3var client = new MyClient();

Now your users can consume the helper function by importing it from the SDK.

1client.MyHelper();