clr

How can I get generics to work in Python.NET with CPython

做~自己de王妃 提交于 2019-12-06 08:51:54
How can I get generics to work in Python.NET with CPython. I get an error when using the subscript syntax from Python.NET Using Generics TypeError: unsubscriptable object With Python 2.7.11 + pythonnet==2.1.0.dev1 >python.exe Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import clr >>> from System import EventHandler >>> from System import EventArgs >>> EventHandler[EventArgs] Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError:

MP3 playing using mci send string c++

有些话、适合烂在心里 提交于 2019-12-06 08:45:58
I'm trying to play some mp3 files as my background music in one of my project which Im doing. I tried to play it using mcisendstring but it just couldnt work :( These what I have done: CMP3_MCI myMp3; std::string address= "C:\\Users\\music embed testing\\test.mp3"; myMp3.Load(address); myMp3.Play(); //Load function void Load(string szFileName) { m_szFileName = szFileName; Load2(); } //load2 function void Load2() { std::string szCommand = "open \"" + GetFileName() + "\" type mpegvideo alias " + GetFileName(); mciSendString(szCommand.c_str(), NULL, 0, 0); } //play function void Play() { std:

How to add reference to a dynamic assembly for compiling another dynamic assembly?

别说谁变了你拦得住时间么 提交于 2019-12-06 07:29:57
In my AppDomain there are few dynamic assembly, when I try codeDom.CompileAssemblyFromSource to Compile another new assembly, I can't figure out a way to add those dynamic assemble to ReferencedAssemblies. foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { compilerParameters.ReferencedAssemblies.Add(assembly.Location); } Failed, as dynamic assembly doesn't have Location. Thanks in advance. PS: I'm actually trying to use ASP.Net MVC 3's new Razor template engine in IronPython. Not test, try use assembly.FullName instead of assembly.Location . tenkod I was having similar issue

How to load CLR into process

泄露秘密 提交于 2019-12-06 07:28:36
问题 I have some question which puzzled me for a long time. What is the relationship between CLR and one process created by OS? What steps the CLR is loaded when we double-click an "Console Application" or "Windows Forms Application"? I found two methods: _CorExeMain() and _CorBindToRuntimeEx(). What's the role of them? 回答1: Please see Hosting the Common Language Runtime, Loading the Common Language Runtime into a Process, _CorExeMain Function, CorBindToRuntimeEx Function. I think the basic answer

Are signed .net assemblies ever fully verified when loaded, to check they haven't been modified?

一曲冷凌霜 提交于 2019-12-06 07:28:07
问题 I used to think that .net assemblies that were signed and/or strong-named were verified by the CLR when loaded, meaning that it wasn't possible for someone to edit the IL and still have a valid assembly. Then I listened to this great Herding Code podcast where Jon McCoy said that doesn't really happen (approx 12:47 in the podcast) - i.e. anyone can edit the IL and mess with your assembly and the CLR will not care. I know this sounds weird, but he seems to know what he's talking about, so

Dealing with kanji characters in C++

烂漫一生 提交于 2019-12-06 06:27:17
I have a windows deskop application (named: Timestamp) written in C++ that use .NET called CLR. I also have DLL project (named: Amscpprest) written in native c++ and uses CPPREST SDK to get json data from server and pass the data to my Timestamp app. Here's the scenario: This is the return json data from my server, its a list of staff name and most of it is japanese names written in Kanji characters. [ { "staff": { "id": 121, "name": "福士 達哉", "department": [ { "_id": 3, "name": "事業推進本部" } ] } }, { "staff": { "id": 12, "name": "北島 美奈", "department": [ { "_id": 4, "name": "事業開発本部" } ] } }, {

Examples of CLR compiler optimizations

允我心安 提交于 2019-12-06 06:00:36
问题 I'm doing a presentation in few months about .Net performance and optimization, I wanted to provide some samples of unnecessary optimization, things that will be done by the compiler anyways. where can I find some explanation on what optimizations the compiler is actually capable of maybe some before and after code? 回答1: check out these links C# Compiler Optimizations compiler optimization msdn Also checkout this book on MSIL 1. Microsoft Intermediate Language: Comparison Between C# and VB

Library to generate .NET XmlDocument from HTML tag soup

一世执手 提交于 2019-12-06 05:36:02
I'm looking for a .NET library that can generate a clean Xml tree, ideally System.Xml.XmlDocument, from invalid HTML code. I.E. it should make the kind of best effort guesses, repairs, and substitutions browsers do when confronted with this situation, and generate a pretend XmlDocument. The library should also be well-maintained. :) I realize this is a lot (too much?) to ask, and I would appreciate any useful leads. There seem to be a fair number of implementations of this for Java, but I would rather not generate my own bindings. So far for .NET I have found http://www.majestic12.co.uk

Managed class with a non-managed member

人走茶凉 提交于 2019-12-06 05:34:58
问题 I'm using this class: public ref class x: public System::Windows::Forms::Form { private: gcroot<std::string> name; } and i am getting the following error: IntelliSense: a member of a managed class cannot be of a non-managed class type I know i can use char* , but if I use lots of char* i will have to manually do the delete[] or some heap corruption issues will rise I've been stuck on this for two days now note: I have to use c++ and have to use UI in c++ 回答1: That's the wrong usage for gcroot

What is the alternative to futures and promises in managed C++

旧时模样 提交于 2019-12-06 05:27:07
问题 When compiling managed C++ code with the /clr flag, the compiler does not allow the include. I am trying to port my unmanaged C++ code into a managed C++ environment. I see that C# has the alternatives Task and TaskCompletionSource to replace futures and promises but I do not see these options available in managed C++. I need to perform interop with some C++ unmanaged libraries so I cannot switch to C# completely. I still need a C++ layer in between. How can I achieve future/promise