Saturday 29 October 2022

Use Template Parameter to Create Array in Bash Task in Azure Pipelines

 Converting Azure pipeline parameter type of object, which contain an array of strings, to an array object in bash script task is not clearly documented. We can use the join expression for Azure pipeline tasks to achive this requirement. Let's look at how to do with an example.

Saturday 22 October 2022

Writing a json Easily and Elegently in in C# 11

 In the previous post "No More " Escaping Needed with C# 11" we have discussed, how the json can be writen in C# code, without having to escape each occurance of double quote, when we use the new C# 11 feature Raw String Literals. You might not want to hardcode the entire json in code, instead may want to use variables dynamically setting the json body content. Let's see how we can use String interpolation, in Raw String Leiterals to write json body elegently, and have variables dynamically set values in the josn.

Saturday 15 October 2022

No More " Escaping Needed with C# 11

Writing json body in C# code as a string variable value to pass on to a method or service, is something you may hate as you need to escape every " that you use in your json specification, even though you could use @ (verbatim string literals) to write multi-line strings.  With new Raw String Literals in c# 11, we can write " as content of the strings wihtout having to escape each instance. Let's explore bit about escaping double qutes with Raw String Literals.

Saturday 8 October 2022

Check The C# Language Version of a Project

 C# Language version used in your project is determined by the .NET Framework you are using. We can set specific language version for a project if required for exxampe if we need to use the preview features we can add in the <LangVersion>preview</LangVersion> .csproj file <PropertyGroup>. If the language version is not specifically set and if you want to check the language versio used by your project, the following explained step can be performed.

Sunday 2 October 2022

Getting Started with GitHub Copilot with VS Code

GitHub Copilot is the AI pair programmer who will assit us in writing code efficiently, while we are working with VS Code, Visual Studio, JetBrains IDEs or Neovim. Let's explore how to get started with GitHub copilot with VS Code and C# using a console application.

Popular Posts