Skip to content

Instantly share code, notes, and snippets.

@carlosschults
carlosschults / csharp8-null-treatment-2.cs
Created December 21, 2017 01:37
csharp8-null-treatment-2cs
public int CalculateSquareOfAge(Person? p)
{
int age = p?.Age ?? 0;
return age * age;
}
@carlosschults
carlosschults / csharp8-prevent-assignment.cs
Created December 21, 2017 01:37
csharp8-prevent-assignment.cs
string? nullableString = "hello";
string nonNullableString = nullableString;
@carlosschults
carlosschults / csharp8-new-operator.cs
Created December 21, 2017 01:39
csharp8-new-operator.cs
public void Foo(string? bar)
{
if (!bar.IsNullOrEmpty())
{
var length = bar.Length;
}
}
@carlosschults
carlosschults / csharp8-using-the-new-operator.cs
Created December 21, 2017 01:40
csharp8-using-the-new-operator.cs
public void Foo(string? bar)
{
if (!bar.IsNullOrEmpty())
{
var length = bar!.Length;
}
}
@carlosschults
carlosschults / security-guidelines.md
Created December 28, 2025 17:50
Security for developers

Code Security Essentials: What Every Developer Should Know

A comprehensive guide based on a conversation with Johannes Doss, VP of Code Security at Sonar

The Evolution of Security Ownership

Security responsibility in software development has undergone a fundamental transformation over the past two decades. Johannes Doss, who has spent 20 years in cybersecurity—from his early days playing capture-the-flag competitions to professional penetration testing and now leading code security at Sonar—has witnessed this evolution firsthand.

His journey into security began personally: his computer got infected with the Sasser worm, sparking both frustration and intrigue about how someone could gain access to his machine. This led him down a path of security exploration, eventually studying IT security in Bochum, Germany, and competing in hacking competitions where university teams would try to hack each other in isolated environments.