Skip to content

Instantly share code, notes, and snippets.

@robertpateii
Created July 21, 2011 21:38
Show Gist options
  • Save robertpateii/1098280 to your computer and use it in GitHub Desktop.
Save robertpateii/1098280 to your computer and use it in GitHub Desktop.
a buddy of mine, Scott, asked if tap could be done in PHP and Perl. Probably, but i wanted to write it in c#. reference - http://moonbase.rydia.net/mental/blog/programming/eavesdropping-on-expressions
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int k = 3;
int q = 5;
int t = 3;
float ans = 0;
ans = (k + 1) / (tap((q - t)) / 2);
Console.WriteLine(ans.ToString());
Console.ReadKey();
}
static dynamic tap (dynamic arg)
{
object returnValue = arg;
Console.WriteLine("tap: " + returnValue.ToString());
return returnValue;
}
}
}
@robertpateii
Copy link
Author

result:
tap: 2
4

@robertpateii
Copy link
Author

p.s.
dynamic is a .NET 4.0 thing. it's not available in previous versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment