Skip to content

Instantly share code, notes, and snippets.

@yallie
Created October 13, 2018 20:17
Show Gist options
  • Save yallie/20bcffefd48654d44df17de16823b067 to your computer and use it in GitHub Desktop.
Save yallie/20bcffefd48654d44df17de16823b067 to your computer and use it in GitHub Desktop.
Custom string class example for ApexSharp
// compile using csc.exe test.cs
using static System.Console;
namespace Apex
{
public class Program
{
static void Main()
{
String demoString1 = "Jay2";
String demoString2 = "Jay1";
String demoString3 = demoString1 + demoString2;
System.debug(demoString3);
}
}
public class System
{
public static void debug(string s) => WriteLine(s);
}
public class String
{
private string value { get; }
public String(string s) => value = s;
public static implicit operator string(String s) => s.value;
public static implicit operator String(string s) => new String(s);
public static String operator +(String a, String b) => new String(a.value + b.value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment