我熟悉fparsec的一些基础知识,但它似乎是面向文本文件或流.
还有其他F#库可以有效地解析二进制文件吗?或者可以轻松修改fparsec以便有效地使用二进制流?
我想要做的是创建一个提供的类型,在C#中调用它的基本构造函数:
public class SubclassController : BaseClass
{
public SubclassController (IntPtr handle) : base (handle)
{}
}
Run Code Online (Sandbox Code Playgroud)
我目前最接近的是:
public sealed class SubclassController : BaseClass
{
public SubclassController (IntPtr handle)
{
this;
base..ctor (handle);
}
Run Code Online (Sandbox Code Playgroud)
虽然具有相同的功能但并不完全相同.
我用来构建ProvideConstructor的代码如下:
let providedConstructor = ProvidedConstructor([ProvidedParameter("handle", typeof<IntPtr>)])
let ctorInfo = typeof<SubclassController>.GetConstructor(BindingFlags.Public ||| BindingFlags.Instance, null, [|typeof<IntPtr>|], null)
providedConstructor.BaseConstructorCall <- fun args -> ctorInfo, args
providedConstructor.InvokeCode <- fun args -> <@@ () @@>
Run Code Online (Sandbox Code Playgroud) 我刚刚安装了Xamarin工作室来试用OSX上的F#体验.安装工作正常,我能够创建F#教程项目,但当它尝试打开Tutorial.fs文件时,我收到以下消息:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'Mono.TextEditor.Highlighting.ResourceXmlProvider.Open'.
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0
at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0
at Mono.Addins.TypeExtensionNode.CreateInstance () [0x00000] in /Users/builder/data/lanes/monodevelop-lion-evolve_fixed/a8bf58d3/source/monodevelop/main/external/mono-addins/Mono.Addins/Mono.Addins/TypeExtensionNode.cs:93
at MonoDevelop.SourceEditor.SyntaxModeCodon.get_SyntaxMode () [0x00000] in …Run Code Online (Sandbox Code Playgroud) 我可以访问一个nugget存储库,它有两个不同版本的软件包,一个是32位,一个是64位.
我的开发工具是32位,而构建服务器以64位模式构建解决方案.目前我正在使用ItemGroup条件控制构建过程,有点像这样:
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
Run Code Online (Sandbox Code Playgroud)
在32位模式下构建时,可以配置nuget绑定到一个包,而在64位模式下构建另一个包吗?还是我坚持手动编辑*proj文件?
以下#r命令将在Windows上正常执行
#r "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
在使用Mono 3.0.6的Osx上,即使文件位于搜索路径中,也无法找到该文件.
我猜这可能与延迟签名Mono有关,任何人都可以确认这一点或知道最好的工作是什么?
这个C#的F#等价物是什么:
public T GetNewItem()
{
return new T();
}
Run Code Online (Sandbox Code Playgroud)
另外,如何将新的T()作为ref单元格返回,以便在需要out或ref参数的.Net库中使用?