Skip to content

Instantly share code, notes, and snippets.

@ochsec
Last active October 25, 2023 22:24
Show Gist options
  • Save ochsec/7343813b13386da6c6ad535af212bebd to your computer and use it in GitHub Desktop.
Save ochsec/7343813b13386da6c6ad535af212bebd to your computer and use it in GitHub Desktop.
McNull
using System;
using System.Collections.Generic;
class McNull
{
public string foo { get; set; }
public int bar { get; set; }
public List<int> baz { get; set; }
public McNull(int aBar)
{
bar = aBar;
baz = new List<int>();
}
}
class Program
{
static void Main(string[] args)
{
// Create an instance of McNull with aBar = 42
McNull mcNull = new McNull(42);
// Set the foo property
// actually, I forgot
// Add some values to the baz list
mcNull.baz.Add(1);
mcNull.baz.Add(2);
mcNull.baz.Add(3);
var emporersNewProp = mcNull.foo;
// Print the values of the emperorsNewProp
Console.WriteLine("emporersNewProp: " + emporersNewProp);
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment