Archive for the ‘csharp’ Category

C# is awesome

April 12, 2018 Leave a comment

I started to play with C# and I really enjoy it. I found a great book that explains the concepts very well: The C# Player’s Guide by RB Whitaker. I found the 2nd edition in our library but it also has a 3rd edition.

I started a C# project, which is a collection of custom extensions. You can find it here:

I also have a little utility (written in Python) that facilitates C# development under Linux in the command-line:

I’m playing with C# under Linux. JetBrains has a cross-platform IDE for .NET called Rider. It works very well for me.


Categories: book, csharp

pretty print a C# source code

March 29, 2018 Leave a comment

I wanted to print the page at, but the produced PDF was black and white, i.e. the syntax highlighting was lost. How to print a source code with colors?

I tried several browsers, several editors, but nothing worked. Then I found a LaTeX solution. The necessary files and the produced PDF output are here:

I put here the LaTeX source:

%% Define your header here.
%% See
\fancyhead[CO,CE]{C\# Summary}

\usepackage[usenames,dvipsnames]{color}  %% Allow color names

%% The listings package will format your source code
  breaklines=true, %% Wrap long lines



The LaTeX tip is from here.

Categories: csharp, latex Tags:

[manjaro] Make C# debugger work in Visual Studio Code

Under Manjaro / Arch you use Visual Studio Code with the C# extension. Everything works fine except the C# debugger.

I found the solution here: . The debugger on Manjaro / Arch is not supported officially, so we need to do some tricks. In VS Code open the user settings and add this line:

"csharp.fallbackDebuggerLinuxRuntimeId": "ubuntu.16.04-x64"

Uninstall the C# extension, restart VS Code, and re-install the C# extension. Open a .cs file and the extension will download some packages, including the debugger for Ubuntu 16.04 (as we specified it in the settings).

However, the *.so files of the Ubuntu debugger rely on a specific version of the package “icu”.

$ cd ~/.vscode/extensions/ms-vscode.csharp-1.11.0/.debugger
$ find *.so -type f | xargs ldd 2> /dev/null | grep not\ found => not found => not found => not found => not found => not found => not found

The last 2 lines are interesting: we need version 55 of the package “icu“. “yaourt icu” revealed that I had version 59 installed, but version 55 can be installed too with “yaourt icu55“. The two versions can co-exist. When installed, restart VS Code and debugging should work now.

The solution was found at . A big thanks for starquake.

Categories: csharp, manjaro Tags:

In C#, ++c and c += 1 are not always equivalent

July 2, 2017 1 comment
csharp> char c = 'a'
csharp> ++c
csharp> c += 1
(1,7): error CS0031: Constant value `1' cannot be converted to a `char'
Categories: csharp Tags: ,