Clean up warnings in examples (#1628)

* Refactor examples to streamline code structure and improve readability

* Update LangVersion to 13.0 for improved compatibility
This commit is contained in:
Boshi Lian
2025-04-29 16:55:55 -07:00
committed by GitHub
parent 001189de77
commit ae79be6665
17 changed files with 335 additions and 446 deletions

View File

@@ -2,27 +2,17 @@ using k8s;
using k8s.Models;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace yaml
var typeMap = new Dictionary<string, Type>
{
internal class Program
{
private static async Task Main(string[] args)
{
var typeMap = new Dictionary<string, Type>
{
{ "v1/Pod", typeof(V1Pod) },
{ "v1/Service", typeof(V1Service) },
{ "apps/v1/Deployment", typeof(V1Deployment) },
};
{ "v1/Pod", typeof(V1Pod) },
{ "v1/Service", typeof(V1Service) },
{ "apps/v1/Deployment", typeof(V1Deployment) },
};
var objects = await KubernetesYaml.LoadAllFromFileAsync(args[0], typeMap).ConfigureAwait(false);
var objects = await KubernetesYaml.LoadAllFromFileAsync(args[0], typeMap).ConfigureAwait(false);
foreach (var obj in objects)
{
Console.WriteLine(obj);
}
}
}
foreach (var obj in objects)
{
Console.WriteLine(obj);
}