Using ChatGPT for .NET and C# Development

Oct 21, 2023 /
# .NET
# ChatGPT

ChatGPT is an amazing tool for developers.

But it’s best used as tool to help build parts of your application. Not entire applications on it’s own.

Here are 2 ways you can use ChatGPT to increase your productivity as a C# developer.

1) Pattern matching with regex

Does anyone actually enjoy writing regular expressions? I know I don’t.

Thankfully, ChatGPT is great at it.

Provide context to ChatGPT on what you need the regex to test for and watch it do it’s magic.

Prompt: Given a string, write a function in C# that uses regex to detect if it’s a valid email or not.

ChatGPT Regex Generation

2) Database table schema generation

Describe a table you need a sql create script for. ChatGPT is great at understanding the tables context and providing the correct contraints on the individual columns.

For example, it added the “UNIQUE” constraint to the email column below without even being told to.

Prompt: Write a database schema for a table that holds user accounts. Each user account contains their name, email, password, and timestamps.

ChatGPT table schema generation

If ChatGPT has a reference of your table schema, it’s great at generating data objects around it.

For example, you can tell it to create a model around the users table and it will use the context it has about your users table schema to generate it.

Prompt: Create a .NET model for the above User table ChatGPT model generation

Early Access

Dotnet Engine will be launching in early access soon. Signup with your email now to get notified when early access starts and a special launch price.