diff --git a/src/Kiota.Builder/Refiners/HttpRefiner.cs b/src/Kiota.Builder/Refiners/HttpRefiner.cs
index 2bf6ddfe03..775b9cf81f 100644
--- a/src/Kiota.Builder/Refiners/HttpRefiner.cs
+++ b/src/Kiota.Builder/Refiners/HttpRefiner.cs
@@ -106,7 +106,7 @@ private void AddPathParameters(CodeElement element)
// Retrieve all the parameters of kind CodeParameterKind.Custom
var customParameters = codeIndexer.Parameters
.Where(static param => param.IsOfKind(CodeParameterKind.Custom))
- .ToList();
+ .ToArray();
// For each parameter:
foreach (var param in customParameters)
diff --git a/src/Kiota.Builder/Writers/HTTP/CodeClassDeclarationWriter.cs b/src/Kiota.Builder/Writers/HTTP/CodeClassDeclarationWriter.cs
index 6f77ecd717..8c3adf0a5c 100644
--- a/src/Kiota.Builder/Writers/HTTP/CodeClassDeclarationWriter.cs
+++ b/src/Kiota.Builder/Writers/HTTP/CodeClassDeclarationWriter.cs
@@ -161,8 +161,6 @@ private static void WriteUrlTemplate(CodeProperty urlTemplateProperty, LanguageW
/// The language writer to write the path parameters to.
private static void WritePathParameters(CodeProperty[] pathParameters, LanguageWriter writer)
{
- if (pathParameters is null) return;
-
// Write each path parameter property
foreach (var pathParameter in pathParameters)
{
@@ -177,8 +175,6 @@ private static void WritePathParameters(CodeProperty[] pathParameters, LanguageW
/// The language writer to write the query parameters to.
private static void WriteQueryParameters(CodeProperty[] queryParameters, LanguageWriter writer)
{
- if (queryParameters is null) return;
-
// Write each query parameter property
foreach (var queryParameter in queryParameters)
{