This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public interface IFoo | |
{ | |
void M(int x = 0); | |
} | |
public class Foo : IFoo | |
{ | |
public void M(int x = 10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test { | |
private void method1() { | |
private void method2() { | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test | |
{ | |
string name; | |
int value; | |
public Test(string name) : this(name, value) | |
{ | |
} | |
public Test(string name, int value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using ConsoleApp1; | |
using System.Reflection; | |
var property = typeof(Resource1).GetProperty("Default", | |
BindingFlags.Public | BindingFlags.NonPublic | | |
BindingFlags.Static | BindingFlags.DeclaredOnly); | |
string value = (string) property.GetValue(null); | |
Console.WriteLine(value); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string original = "{\"name\":\"John\", \"age\":30, \"car\":null}"; | |
string base64 = Base64Encode(original); | |
string decoded = Base64Decode(base64); | |
Console.WriteLine($"Original: {original}"); | |
Console.WriteLine($"Base64: {base64}"); | |
Console.WriteLine($"Decoded: {decoded}"); | |
string Base64Encode(string plainText) | |
{ | |
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System | |
Module Program | |
Sub Main(args As String()) | |
Dim sName As String = "MyName" | |
Console.WriteLine(sName) | |
End Sub | |
End Module |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.stream.*; | |
import javax.swing.*; | |
import java.awt.*; | |
public class Test { | |
public static void main(String[] args) throws Exception { | |
var frame = new JFrame(); | |
var layout = new FlowLayout(); | |
frame.setLayout(layout); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
class Program | |
{ | |
~Program() | |
{ | |
Console.WriteLine("Finalizer executed."); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Q75832457; | |
using System.Text.Json; | |
JsonSerializerOptions JsonSerializerOptions = new() | |
{ | |
PropertyNameCaseInsensitive = true | |
}; | |
string json = @" | |
[ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a perfectly valid complete | |
// program making use of implicit using directives | |
// from C# 10, and top-level statements from C# 9. | |
int x = 10; | |
Console.WriteLine(x); |