Using ChatGPT for .NET and C# Development
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.
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.
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