Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Newtonsoft.Json can serialize this successfully while System.Text.Json doesn't do it:
```cs
var la = new List<A> { new B() { I = 1, J = 2 } };
Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(la));
Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(la));
class A
{
public int I { get; set; }
@NN---
NN--- / shell_ip_address,sh
Created January 25, 2021 20:46
shell_ip_address
ip=`ip address show | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'`
@NN---
NN--- / .editorconfig
Last active February 21, 2023 15:03 — forked from cezarypiatek/.editorconfig
This snippet set severity level to error for different rules related to the reference nullability
[*.cs]
# Dereference of a possibly null reference.
dotnet_diagnostic.CS8602.severity = error
# Object or collection initializer implicitly dereferences possibly null member.
dotnet_diagnostic.CS8670.severity = error
# Possible null reference assignment.
dotnet_diagnostic.CS8601.severity = error
# Unboxing a possibly null value.
dotnet_diagnostic.CS8605.severity = error
# Possible null reference return.
@NN---
NN--- / custommarshaler.cs
Last active July 26, 2017 21:30
PInvoke SafeHandle via interface
using System;
using System.Runtime.InteropServices;
using FILETIME=System.Runtime.InteropServices.ComTypes.FILETIME;
namespace ConsoleApp4
{
interface ISafeProcessHandle
{
}
class A
{
public static @:(a: A) : int { 0 } // implicit
public static @:>(a: A) : int { 2 } // explicit
}

| | Grouping ||

First Header Second Header Third Header
Content Long Cell
Content Cell Cell

New section | More | Data | And more | And more | [Prototype table]

// Dummy - Define ctor
var Dummy$ctor = {};
// Dummy - Constructors body
Dummy$ctor[""] = function() {}
// Dummy - Init
function Dummy() {
var _nw_self = this;
// Dummy - Properties
using Nemerle.Collections;
using System.Console;
module Program
{
F(l : list[string],
f : string -> list[string]) : list[list[string]]
{
def impl(l, acc)
{
using System;
using System.Console;
using M;
class Test
{
public static @()(this _ : this, s : string) : void
{
}
}