<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-customize-fields-generation-in-visual-studio-2019-gjshnqxyy" -->

---
title: How to customize fields generation in Visual Studio 2019
description: Visual Studio 2019 generates auto-completed readonly fields with default naming when you inject dependencies into a constructor, but you can customize this...
canonical: https://daily.dev/posts/how-to-customize-fields-generation-in-visual-studio-2019-gjshnqxyy
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How to customize fields generation in Visual Studio 2019 | daily.dev
og:description: Visual Studio 2019 generates auto-completed readonly fields with default naming when you inject dependencies into a constructor, but you can customize this...
og:url: https://daily.dev/posts/how-to-customize-fields-generation-in-visual-studio-2019-gjshnqxyy
og:image: https://api.daily.dev/og/posts/GjSHNQxyy.png
og:image:alt: How to customize fields generation in Visual Studio 2019
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How to customize fields generation in Visual Studio 2019

**[Code4IT](https://daily.dev/sources/code4it)** · 5 min read · 0 upvotes · 0 comments

## Summary

Visual Studio 2019 generates auto-completed readonly fields with default naming when you inject dependencies into a constructor, but you can customize this behavior. By navigating to Tools > Options > Text Editor > C# > Code Style > Naming, you can create a custom naming style (e.g., adding an underscore prefix, camelCase) and apply it to private or internal fields, so auto-generated dependencies like IMyDependency become _myDependency instead of myDependency.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.code4it.dev/blog/auto-creating-fields-vs>

## Questions this post answers

### How do I make Visual Studio 2019 auto-generate readonly fields with an underscore prefix instead of the raw parameter name?

Create a custom naming style in Visual Studio by going to Tools > Options > Text Editor > C# > Code Style > Naming, clicking Manage naming styles, adding a new style with a underscore prefix and camelCase capitalization, then creating a specification that applies this style to Private or Internal Fields. Auto-generated dependencies like myDependency then become _myDependency automatically.

_Developers tuning editor conventions for dependency injection patterns often compare IDE tips like this on daily.dev._

## Similar posts on daily.dev

- [9 ReSharper Features Every .NET Developer Should Know](https://daily.dev/posts/9-resharper-features-every-net-developer-should-know-hpcwvfgz9) · JetBrains · 1 upvotes · 0 comments
- [The best new features of C\# 14](https://daily.dev/posts/the-best-new-features-of-c-14-6gsbbjwv4) · InfoWorld · 46 upvotes · 4 comments
- [The Complete Package: Why Debugging Is Only Half the C\# Productivity Story](https://daily.dev/posts/the-complete-package-why-debugging-is-only-half-the-c-productivity-story-nmqnm6oob) · JetBrains .NET Blog · 7 upvotes · 0 comments

---

Tags: [#.net](https://daily.dev/tags/.net), [#c#](https://daily.dev/tags/c#), [#visual-studio](https://daily.dev/tags/visual-studio)

[View this post on daily.dev](https://daily.dev/posts/how-to-customize-fields-generation-in-visual-studio-2019-gjshnqxyy)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How to customize fields generation in Visual Studio 2019","url":"https://daily.dev/posts/how-to-customize-fields-generation-in-visual-studio-2019-gjshnqxyy","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-customize-fields-generation-in-visual-studio-2019-gjshnqxyy"},"datePublished":"2026-10-04T13:05:33.438Z","dateModified":"2026-10-04T13:10:11.193Z","description":"Visual Studio 2019 generates auto-completed readonly fields with default naming when you inject dependencies into a constructor, but you can customize this...","image":"https://media.daily.dev/image/upload/s--OHB84bZF--/f_auto/v1722860399/public/Placeholder%2010","thumbnailUrl":"https://media.daily.dev/image/upload/s--OHB84bZF--/f_auto/v1722860399/public/Placeholder%2010","isAccessibleForFree":true,"articleSection":"Code4IT","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Code4IT","logo":"https://media.daily.dev/image/upload/s--OaaG4G10--/f_auto,q_auto/v1791119049/logos/code4it?_a=BAMAMicg0","url":"https://daily.dev/sources/code4it"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-to-customize-fields-generation-in-visual-studio-2019-gjshnqxyy","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":".net,c#,visual-studio","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Code4IT","item":"https://daily.dev/sources/code4it"},{"@type":"ListItem","position":3,"name":"How to customize fields generation in Visual Studio 2019"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-to-customize-fields-generation-in-visual-studio-2019-gjshnqxyy#faq","mainEntity":[{"@type":"Question","name":"How do I make Visual Studio 2019 auto-generate readonly fields with an underscore prefix instead of the raw parameter name?","acceptedAnswer":{"@type":"Answer","text":"Create a custom naming style in Visual Studio by going to Tools > Options > Text Editor > C# > Code Style > Naming, clicking Manage naming styles, adding a new style with a underscore prefix and camelCase capitalization, then creating a specification that applies this style to Private or Internal Fields. Auto-generated dependencies like myDependency then become _myDependency automatically. Developers tuning editor conventions for dependency injection patterns often compare IDE tips like this on daily.dev."}}]}
```

