Skip to main content
Commonmark migration
Source Link

##C# - 128 108 104

C# - 128 108 104

Thanks to Compass, BMac and Shawn for suggesting improvements.

First try at Code Golf, and using C# seems to be a handicap here...

By using .Compute() you can use the string values and sum them directly. As a bonus this works for other operators aside from just "+".

Golfed:

static void t(string a,string b){System.Console.Write(new System.Data.DataTable().Compute(a+"+"+b,""));} 

Ungolfed:

static void t(string a, string b) { System.Console.Write(new System.Data.DataTable().Compute(a+"+"+b,"")); } 

Calling t("123","456"); gets you 579.

##C# - 128 108 104

Thanks to Compass, BMac and Shawn for suggesting improvements.

First try at Code Golf, and using C# seems to be a handicap here...

By using .Compute() you can use the string values and sum them directly. As a bonus this works for other operators aside from just "+".

Golfed:

static void t(string a,string b){System.Console.Write(new System.Data.DataTable().Compute(a+"+"+b,""));} 

Ungolfed:

static void t(string a, string b) { System.Console.Write(new System.Data.DataTable().Compute(a+"+"+b,"")); } 

Calling t("123","456"); gets you 579.

C# - 128 108 104

Thanks to Compass, BMac and Shawn for suggesting improvements.

First try at Code Golf, and using C# seems to be a handicap here...

By using .Compute() you can use the string values and sum them directly. As a bonus this works for other operators aside from just "+".

Golfed:

static void t(string a,string b){System.Console.Write(new System.Data.DataTable().Compute(a+"+"+b,""));} 

Ungolfed:

static void t(string a, string b) { System.Console.Write(new System.Data.DataTable().Compute(a+"+"+b,"")); } 

Calling t("123","456"); gets you 579.

added 58 characters in body
Source Link

##C# - 128 characters ---> now 108 First128 108 104

Thanks to Compass, BMac and Shawn for suggesting improvements.

First try at Code Golf, and using C# seems to be a handicap here...

By using .Compute() you can use the string values and sum them directly. As a bonus this works for other operators aside from just "+".

Golfed:

static void t(string a,string b){System.Console.WriteLineWrite(new System.Data.DataTable().Compute(a+"+"+b,""));} 

Ungolfed:

static void t(string a, string b) { System.Console.WriteLineWrite(new System.Data.DataTable().Compute(a+"+"+b,"")); } 

Calling t("123","456"); gets you 579.

##C# - 128 characters ---> now 108 First try at Code Golf, and using C# seems to be a handicap here...

By using .Compute() you can use the string values and sum them directly. As a bonus this works for other operators aside from just "+".

Golfed:

static void t(string a,string b){System.Console.WriteLine(new System.Data.DataTable().Compute(a+"+"+b,""));} 

Ungolfed:

static void t(string a, string b) { System.Console.WriteLine(new System.Data.DataTable().Compute(a+"+"+b,"")); } 

Calling t("123","456"); gets you 579.

##C# - 128 108 104

Thanks to Compass, BMac and Shawn for suggesting improvements.

First try at Code Golf, and using C# seems to be a handicap here...

By using .Compute() you can use the string values and sum them directly. As a bonus this works for other operators aside from just "+".

Golfed:

static void t(string a,string b){System.Console.Write(new System.Data.DataTable().Compute(a+"+"+b,""));} 

Ungolfed:

static void t(string a, string b) { System.Console.Write(new System.Data.DataTable().Compute(a+"+"+b,"")); } 

Calling t("123","456"); gets you 579.

deleted 23 characters in body
Source Link

##C# - 128 characters

First ---> now 108 First try at Code Golf, and using C# seems to be a handicap here...

By using .Compute() you can use the string values and sum them directly. As a bonus this works for other operators aside from just "+".

Golfed:

using System;using System.Data;staticstatic void t(string a,string b){System.Console.WriteLine(new System.Data.DataTable().Compute(a+"+"+b,""));} 

Ungolfed:

using System; using System.Data; static void t(string a, string b) { System.Console.WriteLine(new System.Data.DataTable().Compute(a+"+"+b,"")); } 

Calling t("123","456"); gets you 579.

##C# - 128 characters

First try at Code Golf, and using C# seems to be a handicap here...

By using .Compute() you can use the string values and sum them directly. As a bonus this works for other operators aside from just "+".

Golfed:

using System;using System.Data;static void t(string a,string b){Console.WriteLine(new DataTable().Compute(a+"+"+b,""));} 

Ungolfed:

using System; using System.Data; static void t(string a, string b) { Console.WriteLine(new DataTable().Compute(a+"+"+b,"")); } 

Calling t("123","456"); gets you 579.

##C# - 128 characters ---> now 108 First try at Code Golf, and using C# seems to be a handicap here...

By using .Compute() you can use the string values and sum them directly. As a bonus this works for other operators aside from just "+".

Golfed:

static void t(string a,string b){System.Console.WriteLine(new System.Data.DataTable().Compute(a+"+"+b,""));} 

Ungolfed:

static void t(string a, string b) { System.Console.WriteLine(new System.Data.DataTable().Compute(a+"+"+b,"")); } 

Calling t("123","456"); gets you 579.

deleted 28 characters in body
Source Link
Loading
added 45 characters in body
Source Link
Loading
Source Link
Loading