我有以下 C# 类,我想在 F# 中使用
using System;
using System.Collections.Generic;
using System.Text;
namespace DataWrangler.Structures
{
public enum Type { Trade = 0, Ask = 1, Bid = 2 }
public class TickData
{
public string Security = String.Empty;
public uint SecurityID = 0;
public object SecurityObj = null;
public DateTime TimeStamp = DateTime.MinValue;
public Type Type;
public double Price = 0;
public uint Size = 0;
public Dictionary<string, string> Codes;
}
}
我想在 F# 中创建它的一个实例。我用来执行此操作的代码位于 f# 脚本文件中
#r @"C:\Users\Chris\Documents\Visual Studio 2012\Projects\WranglerDataStructures\bin\Debug\WranglerDataStructures.dll"
open System
open System.Collections.Generic;
open System.Text;
open DataWrangler.Structures
type tick = TickData // <- mouse over the "tick" gives me a tooltip with the class structure
// it bombs out on this line
let tickDataTest = tick(Security = "test", TimeStamp = DateTime(2013,7,1,0,0,0), Type = Type.Trade, Price = float 123, Size = uint32 10 )
我得到的错误是:
error FS0193: internal error: Could not load file or assembly 'file:///C:\Users\Chris\Documents\Visual Studio 2012\Projects\WranglerDataStructures\bin\Debug\WranglerDataStructures.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
我检查了文件路径,它们似乎是正确的。我可以将鼠标悬停在“类型刻度”上,它为我提供了 C# 对象的结构。所以它似乎正在寻找 C# 代码。谁能告诉我我在这里做错了什么?句法?对 C# -> F# introp 还是很陌生