Writing .NET for Windows via Linux and Mono

For a long time now, I've largely developed using open source languages, toolkits, etc. on Linux and Mac. A new project, though, is about to shove me into the .NET world. Moreover, a .NET world whose products will be deployed to a Windows infrastructure. In my mind, I made the assumption that I wouldn't be able to develop for this platform combination on Linux using Mono due to underl

通过Linux和Mono编写.NET for Windows

很长一段时间以来,我主要在Linux和Mac上开发使用开源语言,工具包等。 不过,一个新项目即将推动我进入.NET世界。 而且,这个.NET世界的产品将被部署到Windows基础架构中。 在我看来,由于底层的体系结构差异,我做了一个假设,我不能在Linux上使用Mono开发这种平台组合,但这只是一个不知情的假设。 有人可以验证或揭穿这一假设吗? 谢谢。 我认为你可以,只有另一种方式(在.NET上运行并在单声道上运行)是有问题的

Should I use Mono on a real project?

Has anyone used Mono, the open source .NET implementation on a large or medium sized project? I'm wondering if it's ready for real world, production environments. Is it stable, fast, compatible, ... enough to use? Does it take a lot of effort to port projects to the Mono runtime, or is it really, really compatible enough to just take of and run already written code for Microsoft's

我应该在真正的项目中使用Mono吗?

有没有人使用过大型或中型项目的开源.NET实现Mono? 我想知道它是否适合现实世界的生产环境。 它稳定,快速,兼容,......足够使用? 将项目移植到Mono运行时需要花费很多努力吗?还是它确实足够兼容,只需运行已经为Microsoft运行时编写的代码即可? 我已经将它用于许多内部和商业项目,取得了巨大成功。 我的警告: 写很多单元测试,并确保它们都通过单声道 - 这将为您节省很多麻烦。 除非你绝对必须,否则不要使用

Cannot use String.Empty as a default value for an optional parameter

I am reading Effective C# by Bill Wagner. In Item 14 - Minimize Duplicate Initialization Logic, he shows the following example of using the new optional parameters feature in a constructor: public MyClass(int initialCount = 0, string name = "") Notice that he used "" instead of string.Empty . He comments: You'll note [in an example above] that the second construct

不能使用String.Empty作为可选参数的默认值

我正在阅读Bill Wagner的Effective C# 。 在项目14 - 最小化重复初始化逻辑中,他显示了在构造函数中使用新的可选参数特征的以下示例: public MyClass(int initialCount = 0, string name = "") 注意他使用""而不是string.Empty 。 他评论说: 你会注意到[在上面的例子中]第二个构造函数指定name参数的默认值“”,而不是更习惯的string.Empty 。 那是因为string.Empty不是编译时常量。 它是一

How do I set an umanaged dialog as the Owner of a WinForm Form?

I need to be able to get a WinForm dialog's Owner's HWND. In unmanaged I have a background thread that gets the HWND for the window in front. The code then calls ::GetParent(frontHWND) to see if it needs to hide a different non-modal MFC dialog. When the WinForm dialog is the frontHWND, I always get NULL back for the GetParent call. I have also tried GetOwner realizing .Net tried to c

如何将一个不受管理的对话框设置为WinForm表单的所有者?

我需要能够获得WinForm对话框的所有者的HWND。 在unmanaged中,我有一个后台线程获取前面窗口的HWND。 然后代码调用:: GetParent(frontHWND)来查看是否需要隐藏不同的非模态MFC对话框。 当WinForm对话框是frontHWND时,我总是为GetParent调用返回NULL。 我也尝试过GetOwner实现.Net试图清理父母和所有者之间的区别。 看着带有Spy ++的WinForm对话框,它也表示WinForm没有父母或所有者。 我通过了 NativeWindow ^natWin =

ASP.Net MVC3 model binding bug

I've found a wierd scenario that prevents a bool? being posted back to the controller correctly. It's a very specific problem so follow the steps to recreate. The application must be deployed as a virtual folder in IIS so that instead of /Home/Test the URL is /Virtual/Home/Test. Home Controller: [HttpGet] public ActionResult Test(int? temp, bool? testBool) { return View(testBoo

ASP.Net MVC3模型绑定错误

我发现了一个可以阻止bool的奇怪场景? 正确地发送回控制器。 这是一个非常具体的问题,因此请按照重新创建的步骤操作。 该应用程序必须作为虚拟文件夹部署在IIS中,以便/ Home / Test URL不是/ Virtual / Home / Test。 主控制器: [HttpGet] public ActionResult Test(int? temp, bool? testBool) { return View(testBool); } / Home / Test View(Razor cshtml): @model bool? @{ ViewBag.Title = "Test";

Access to Modified Closure

string [] files = new string[2]; files[0] = "ThinkFarAhead.Example.Settings.Configuration_Local.xml"; files[1] = "ThinkFarAhead.Example.Settings.Configuration_Global.xml"; //Resharper complains this is an "access to modified closure" for (int i = 0; i < files.Length; i++ ) { // Resharper disable AccessToModifiedClosure if(Array.Exists(Assembly.GetExecutingAssembly().GetManifestResource

访问修改后的关闭

string [] files = new string[2]; files[0] = "ThinkFarAhead.Example.Settings.Configuration_Local.xml"; files[1] = "ThinkFarAhead.Example.Settings.Configuration_Global.xml"; //Resharper complains this is an "access to modified closure" for (int i = 0; i < files.Length; i++ ) { // Resharper disable AccessToModifiedClosure if(Array.Exists(Assembly.GetExecutingAssembly().GetManifestResource

How to call overloaded C# function through JQuery in Asp.Net MVC 2

I am having a problem while calling overloaded C# function through jquery post method. I have two functions in c# string func(string a) string func(string a, string b) Now when i call function which has one parameter in jquery like this var url = '<%= Url.Action("func", "Team") %>'; $.post(url, { a: "test" }, function (data) { }); It gives me this error The current re

如何在Asp.Net MVC 2中通过JQuery调用重载的C#函数

我在通过jquery post方法调用重载的C#函数时遇到问题。 我在c#中有两个函数 string func(string a) string func(string a, string b) 现在,当我调用这样的jQuery中有一个参数的函数 var url = '<%= Url.Action("func", "Team") %>'; $.post(url, { a: "test" }, function (data) { }); 它给了我这个错误 The current request for action 'func' on controller type 'TeamController' is ambiguo

Do You Use "Fake" Function Overloading In JavaScript?

This question already has an answer here: Function overloading in Javascript - Best practices 29 answers In javascript there is a tendency to pass parameters are attributes of an object, ie there is one parameter which is an object, and thus you can specific anything, in any order. With this approach you can check for 'undefined's, and your function can behave according. If you hav

你使用“假”函数在JavaScript中重载?

这个问题在这里已经有了答案: JavaScript中的函数重载 - 最佳实践29个答案 在JavaScript中,传递参数的趋势是对象的属性,即有一个参数是对象,因此您可以按任意顺序指定任何内容。 有了这种方法,你可以检查'未定义的,你的功能可以按照。 如果你在不同情况下有相当大的行为,你可以扩展这个想法,把每个案例分解成一个单独的函数,然后由你的主“重载”函数调用。 例如: function a (params) { // do for a }

MonoTouch 4.0 throwing ReflectionTypeLoadException using the simulator

Since updating a working MonoTouch 3.x app to MonoTouch 4.0, I have been getting the following error when attempting to start a Debug or Release build on the Simulator: Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded. at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool) at System.Re

MonoTouch 4.0使用模拟器抛出ReflectionTypeLoadException

由于将工作的MonoTouch 3.x应用程序更新为MonoTouch 4.0,因此尝试在模拟器上启动调试或发布版本时出现以下错误: Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded. at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool) at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknow

get average color from bmp

I am developing a taskbar for the 2nd screen(something like displayfusion). However, I'm having difficulty at getting the right average color from the icon. For example Google Chrome/ When I hover it on the main taskbar it backgrounds turns yellow. With my code it turns orange/red. This is what it looks now: How can I get the right dominant/average color? I use this code to calculat

从bmp获得平均颜色

我正在开发第二个屏幕的任务栏(类似于displayfusion)。 但是,我很难从图标中获得正确的平均颜色。 例如Google Chrome /当我将它悬停在主任务栏上时,它的背景变成黄色。 用我的代码变成橙色/红色。 这是它现在的样子: 我怎样才能得到正确的主导/平均颜色? 我使用此代码来计算平均颜色: public static Color getDominantColor(Bitmap bmp) { //Used for tally int r = 0; int g = 0; int b =