Search
Star
Feedback
Setup for Free
© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
In my code, it says I have a null parameter, this is my first bit of code, Where am I going wrong? - C#
C
C#
•
3y ago
•
9 replies
weasy
In my code, it says I have a null parameter, this is my first bit of code, Where am I going wrong?
My first code ever
.
using Azure
;
using Azure
.AI
.OpenAI
;
using System
;
using static System
.Environment
;
internal class Program
{
public static string SetEnvironmentVariables
{ get
; private set
;
}
private static void Main
(string
[
] args
)
{
string endpoint
=
"
https://api.openai.com/v1
"
;
string key
= GetEnvironmentVariable
(
"sk
-key
"
)
;
OpenAIClient client
= new OpenAIClient
(new Uri
(endpoint
)
, new AzureKeyCredential
(key
)
)
;
CompletionsOptions completionsOptions
= new
(
)
{
DeploymentName
=
"gpt
-35
-turbo
-instruct
"
,
Prompts
=
{
"When was Microsoft founded
?
"
}
,
}
;
Response
<Completions
> completionsResponse
= client
.GetCompletions
(completionsOptions
)
;
string completion
= completionsResponse
.Value
.Choices
[0
]
.Text
;
Console
.WriteLine
(
$
"Chatbot
:
{completion
}
"
)
;
}
}
C#
Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Similar Threads
Logging code make my code a bit ugly
C
C# / help
3y ago
VS code says my c# code is unsupported
C
C# / help
2y ago
❔ I have a problem in my code and can't find it
C
C# / help
3y ago