Skip to content

Instantly share code, notes, and snippets.

using System.Collections.Generic;
public interface ITable<THeader, TRow> : IEnumerable<TRow>
{
IEnumerable<THeader> Headers { get; }
}
// This example is adapted from the sample supplied with DynamicObject
// documentation on MSDN:
//
// http://msdn.microsoft.com/en-us/library/system.dynamic.dynamicobject.aspx
//
// The example has been adapted to be case-sensitive by default and
// test the dynamic object implementation across C#, IronPython 2.6.1 and
// IronRuby 1.0.
//
// The configuration needed to run this example is supplied at the bottom.
IronPython 2.6.1 (2.6.10920.0) on .NET 4.0.30319.1
Type "help", "copyright", "credits" or "license" for more information.
>>> import clr
>>>
>>> clr.AddReference('Elmah')
>>> from Elmah.Assertions import AssertionFactory
>>> from Elmah import ErrorMailModule, ErrorLogModule
>>> from Elmah.ErrorFilterModule import AssertionHelperContext
>>>
>>> clr.AddReference('System.Web')
REM http://groups.google.com/group/jayrock/t/c16cb357aa2de12
Imports System.IO
Imports Jayrock.Json
Module MainModule
Sub Main()
Dim jsonText As String = _
open System
open System.Text
open System.Diagnostics
let main () =
let sample = @"
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Ut eget ligula justo, et malesuada diam. Phasellus lobortis
risus a lorem lacinia pulvinar varius nulla molestie. Nullam
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework
InstallRoot REG_SZ C:\Windows\Microsoft.NET\Framework\
DbgJITDebugLaunchSetting REG_DWORD 0x10
DbgManagedDebugger REG_SZ "C:\Windows\system32\vsjitdebugger.exe" PID %d APPDOM %d EXTEXT "%s" EVTHDL %d
DbgPackShimPath REG_SZ c:\Program Files\Microsoft Silverlight\4.0.50917.0\dbgshim.dll
sdkInstallRootv2.0 REG_SZ C:\Program Files\Microsoft.NET\SDK\v2.0\
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\Fusion
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\NGenQueue
IronPython 2.6.1 (2.6.10920.0) on .NET 4.0.30319.1
Type "help", "copyright", "credits" or "license" for more information.
>>> import clr
>>> clr.AddReferenceToFileAndPath(r'C:\Jayrock\bin\net-4.0\debug\Jayrock.Json.dll')
>>> from Jayrock.Json.Conversion import JsonConvert
>>> from Jayrock.Json import JsonText
>>> from System.Collections.Generic import *
>>> json = '{x:123,y:456}'
>>> reader = JsonText.CreateReader(json)
>>> d = JsonConvert.Import(Dictionary[str,int], reader)
Microsoft (R) F# 2.0 Interactive build 2.0.0.0
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
> open System.Xml;;
> let d = XmlConvert.ToDateTime("2010-11-10", XmlDateTimeSerializationMode.Local);;
System.FormatException: Invalid format string
at System.DateTime.ParseExact (System.String s, System.String[] formats, IFormatProvider provider, DateTimeStyles style) [0x00000] in <filename unknown>:0
at System.Xml.XmlConvert.ToDateTime (System.String s, System.String[] formats, DateTimeStyles style) [0x00000] in <filename unknown>:0
open System
let sliceClip len index =
match index with
| _ when index < 0 ->
let index = len + index
if index < 0 then 0 else index
| _ when index > len -> len
| _ -> index
open System
type 'a trial =
| Succeeded of 'a
| Failed of string
module Trial =
let get = function
| Succeeded(v) -> v
| Failed(err) -> failwith err