Skip to content

Instantly share code, notes, and snippets.

View jskeet's full-sized avatar
💭
Very happily employed. I do not wish to hear from recruiters.

Jon Skeet jskeet

💭
Very happily employed. I do not wish to hear from recruiters.
View GitHub Profile
public class Test {
public static void main(String... args) {
String x = "abc";
String y = "def";
String xy = x + y;
xy.intern();
// With this line here, the output is true
// which shows that the literal here is only taken
public class Test {
public static void main(String... args) {
String x = new String(new char[] {'a', 'b', 'c'});
String y = new String(new char[] {'d', 'e', 'f'});
String xy = x + y;
xy.intern();
// With this line here, the output is true
// which shows that the literal here is only taken
public class Test {
public static void main(String[] args) {
int n = 1; // Less than 2
int x = 1;
int y = 2;
while (y < n) {
// This is never reached
System.out.println("In while loop");
if (n % y == 0) {
n = n / y;
using System;
class Message
{
public string Body { get; set; }
public Message GetNewMessage()
{
return new Message
{
using System;
using System.Text.RegularExpressions;
class Test
{
static void Main()
{
string before = @":[email protected] private #timing :\u000314CODEERROR:\u0003 [\u000304X012\u0003] Server time is different than UTC";
string after = Regex.Replace(before, @"\\u0{3}3\d{0,2}", string.Empty);
using System;
public class Program
{
public static void Main()
{
string text = "0|aaaaaa|aaaaaaaaaaa|aaaaaaaaaa|123456|0|0";
string[] parts = text.Split(new char[] { '|' });
for (int i = 0; i < parts.Length; i++)
using System;
public class Program
{
public static void Main()
{
string text = "0|aaaaaa|aaaaaaaaaaa|aaaaaaaaaa|123456|0|0";
string[] parts = text.Split(new char[] { '|' });
for (int i = 0; i < parts.Length; i++)
using System;
using System.Text.RegularExpressions;
class Test
{
static void Main()
{
string text = @"A Foobar is cool stuff, as we can see in Figure 1.1:
Figure 1.1 This is a Foobar";
using System;
using System.Threading;
class Program
{
static int value;
static void Main(string[] args)
{
new Thread(ChangeValueRepeatedly).Start();
using System;
using System.Collections.Generic;
using System.Web.Script.Serialization;
namespace TestApp
{
class Program
{
static void Main()
{