[Mono-list] csharp REPL

Steve Lessard s_lessard at yahoo.com
Tue Jun 28 13:58:08 EDT 2011


Hi,

I'm trying to write a shell script in C# using the csharp REPL.  The 
script below works fine as is on OS X, but I would like to pass an 
argument into this script. I haven't been able to find any docs on how 
to do this and all of my experiments have turned up nothing. Is there a 
way to pass an argument into the csharp REPL?

I'm running Mono version 2.10.2 with Mono C# compiler version 4.0.0.0 

-SteveL


#!/usr/bin/env csharp -lib:$PWD

// Initialize the "epoch"
// The "epoch" is 12:00:00 AM UTC, January 1, 1970
DateTime epoch = new DateTime().AddYears(1969).AddHours(-8);

TimeSpan nowDiff = (DateTime.Now - epoch);
System.Console.WriteLine("Current Time (Total Seconds): " + 
nowDiff.TotalSeconds);
System.Console.WriteLine("Current Local Time: " + 
epoch.AddSeconds(nowDiff.TotalSeconds).ToString());
System.Console.WriteLine("Current UTC Time: " + 
epoch.AddSeconds(nowDiff.TotalSeconds).ToUniversalTime().ToString());
 


More information about the Mono-list mailing list