Created
October 13, 2018 20:17
-
-
Save yallie/20bcffefd48654d44df17de16823b067 to your computer and use it in GitHub Desktop.
Custom string class example for ApexSharp
This file contains 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
// 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