# .NET configuration

> Configure your C# .NET SDK generator with Fern. Customize client class names, namespaces, error handling, and pagination settings.

You can customize the behavior of the C#/.NET SDK generator in `generators.yml`:

```yml {6-7} title="generators.yml"
groups: 
  csharp-sdk:
    generators:
      - name: fernapi/fern-csharp-sdk
		    version: 2.20.3
        config:
          client_class_name: YourApiClient
```

<ParamField path="additional-properties" type="boolean" required={false} toc={true}>
  When enabled, allows handling of additional properties not explicitly defined in the API specification. This provides flexibility for APIs that may include extra fields in responses.
</ParamField>

<ParamField path="base-api-exception-class-name" type="string" required={false} toc={true}>
  Customizes the name of the base API exception class that all API-specific exceptions will inherit from. This allows you to define a custom base exception class name for better integration with your existing error handling patterns.
</ParamField>

<ParamField path="base-exception-class-name" type="string" required={false} toc={true}>
  Specifies the name of the base exception class that all generated exceptions will inherit from. This provides a common parent class for all SDK exceptions, enabling consistent exception handling patterns.
</ParamField>

<ParamField path="client-class-name" type="string" required={false} toc={true}>
  Sets the name of the generated API client class. This determines the primary client type name that users will interact with in the generated .NET SDK.
</ParamField>

<ParamField path="custom-pager-name" type="string" required={false} toc={true}>
  Customizes the name of the pagination helper class used for handling paginated API responses. This allows you to specify a custom name that fits your naming conventions.
</ParamField>

<ParamField path="enable-forward-compatible-enums" type="boolean" required={false} toc={true}>
  When enabled, generates enum types that can handle unknown values gracefully. This allows the SDK to process new enum values that may be added to the API without breaking existing client code, improving forward compatibility.
</ParamField>

<ParamField path="environment-class-name" type="string" required={false} toc={true}>
  Specifies the name of the environment configuration class used for managing different API environments (e.g., development, staging, production).
</ParamField>

<ParamField path="explicit-namespaces" type="boolean" required={false} toc={true}>
  When enabled, generates code with explicit namespace declarations throughout the SDK. This can help avoid naming conflicts and improve code clarity in larger projects.
</ParamField>

<ParamField path="exported-client-class-name" type="string" required={false} toc={true}>
  Sets the name of the exported client class that will be used in code examples and documentation. This is useful for customizing how the client appears in generated documentation.
</ParamField>

<ParamField path="generate-error-types" type="boolean" required={false} toc={true}>
  When enabled, generates specific error type classes for different API errors. This provides strongly-typed error handling instead of using generic exception types.
</ParamField>

<ParamField path="generate-mock-server-tests" type="boolean" default="true" required={false} toc={true}>
  Generates [mock server (wire) tests](/sdks/deep-dives/testing#mock-server-tests) to verify that the SDK sends and receives HTTP requests as expected.
</ParamField>

<ParamField path="include-exception-handler" type="boolean" required={false} toc={true}>
  When enabled, includes built-in exception handling utilities in the generated SDK. This provides convenience methods for common error handling scenarios.
</ParamField>

<ParamField path="inline-path-parameters" type="boolean" required={false} toc={true}>
  When enabled, path parameters are included as properties in the request object instead of being passed as separate method parameters. This creates a more unified request structure where all parameters are grouped together.
</ParamField>

<ParamField path="namespace" type="string" required={false} toc={true}>
  Specifies the root namespace for all generated .NET code. This determines the namespace hierarchy that users will import when using the SDK.
</ParamField>

<ParamField path="package-name" type="string" required={false} toc={true}>
  Sets the NuGet package identifier for the generated SDK. This is used when publishing the SDK to NuGet or other package repositories.
</ParamField>

<ParamField path="read-only-memory-types" type="List<string>" required={false} toc={true}>
  Specifies a list of types that should be generated using ReadOnlyMemory\<T> instead of regular arrays or collections. This can improve performance for large data transfers by reducing memory allocations.
</ParamField>

<ParamField path="root-client-class-access" type="'public' | 'internal'" required={false} toc={true}>
  Controls the access modifier for the root client class. Use 'public' to make the client accessible from other assemblies, or 'internal' to restrict access within the same assembly.
</ParamField>

<ParamField path="root-namespace-for-core-classes" type="boolean" required={false} toc={true}>
  When enabled, places core SDK classes (like base client classes and utilities) in the root namespace instead of nested namespaces. This can simplify imports for commonly used types.
</ParamField>

<ParamField path="use-discriminated-unions" type="boolean" required={false} toc={true}>
  When enabled, generates discriminated union types for API responses that can contain multiple different object types. This provides type-safe handling of polymorphic responses.
</ParamField>