clr

SQL Server - Using CLR integration to consume a Web Service

这一生的挚爱 提交于 2019-11-27 06:53:32
问题 There are a few tutorials on the web that describe consuming a Web Service using SQL Server 2005's CLR integration. For the most, the process seems pretty convoluted. I've run into several issues including the need to change my database's trust level, and using the sgen tool to create a static XmlSerializer assembly; and I still haven't gotten it working right... (I'm sure I just need to put a little more time and energy into it) What are the security, performance, and maintenance

.NET Collections and the Large Object Heap (LOH)

允我心安 提交于 2019-11-27 06:52:11
问题 Are .NET collections with large number of items apt to be stored in the LOH? I'm curious about List and Dictionary specifically. In my code, I store a large number (40k+) of relatively small objects (lets say 1k) in temporary Lists and Dictionarys for processing. Does the number of items in these collections increase the likelihood of being put on the LOH? For list, assuming that List is implemented as a doubly linked list, then the number of elements should not increase the size of the

What's going on behind the scene of the 'foreach' loop? [duplicate]

你。 提交于 2019-11-27 06:49:47
问题 Possible Duplicate: How do foreach loops work in C#? I've been searching the internet and I'm having trouble finding any answers as to what's really going on behind the scenes with the foreach loop in C#. I know this question doesn't really pertain to actually coding but its bothering me. I'm pretty new to OO programming and especially interfaces. I understand they are contracts and I understand how IEnumerable and IEnumerator work - or so I think. I've been reading this article on MSDN:

Does the .NET CLR JIT compile every method, every time?

与世无争的帅哥 提交于 2019-11-27 06:49:36
I know that Java's HotSpot JIT will sometimes skip JIT compiling a method if it expects the overhead of compilation to be lower than the overhead of running the method in interpreted mode. Does the .NET CLR work based upon a similar heuristic? Note: this answer is on a "per-run" context. The code is normally JITted each time you run the program. Using ngen or .NET Native changes that story, too... Unlike HotSpot, the CLR JIT always compiles exactly once per run. It never interprets, and it never recompiles with heavier optimisation than before based on actual usage. This may change, of course,

Access TimeZoneInfo from SQL 2005 Server

本小妞迷上赌 提交于 2019-11-27 06:48:51
问题 The .NET TimeZoneInfo class is great and I thought it would answer all my issues with recording data from multiple time zones in my SQL 2005 database. To convert a UTC datetime in the database to any other time zone i'd just get the time zone into a TimeZoneInfo class using TimeZoneInfo.FindSystemTimeZoneById() and then call the TimeZoneInfo.ConvertTimeFromUtc(). Brilliant! I'd just call this from the SQL .NET CLR! BUT...TimeZoneInfo has a Host Protection Attribute of MayLeakOnAbort. When I

Project reference work-around .net 4.5 and .net 3.5

我与影子孤独终老i 提交于 2019-11-27 06:32:17
问题 In continue for this thread: Mixing .NET 3.5 with 4/4.5 assemblies in the same solution/project I found a workaround: http://social.msdn.microsoft.com/Forums/en-US/clr/thread/36b1a209-55d5-4323-91dc-0919ba2e1d03/ What it basically do, get my solution compile and determine each project under what CLR to run. Does anyone see disadvantage to this ? It builds the projects, on my 3rd party api that must run on .net 3.5, i explicity write on its App.config to run with CLR 2.0 and not 4.0 <startup>

Is the CLR a virtual machine?

☆樱花仙子☆ 提交于 2019-11-27 06:16:14
I read a book which referred to the .net CLR as a virtual machine ? Can anyone justify this? What is the reason we need the concept of virtual machines on some development platforms? Isn't it possible to develop a native framework [one without virtual machine] that is fully object oriented and as powerful as .net? The book which refers to CLR as virtual machine is " Professional .Net Framework 2.0 ". There are a lot of misconceptions here. I suppose you could think of .Net as a virtual machine if you really wanted, but let's look at how the .Net Framework really handles your code. The typical

How many String objects will be created when using a plus sign?

北城余情 提交于 2019-11-27 06:02:36
How many String objects will be created when using a plus sign in the below code? String result = "1" + "2" + "3" + "4"; If it was as below, I would have said three String objects: "1", "2", "12". String result = "1" + "2"; I also know that String objects are cached in the String Intern Pool/Table for performance improvement, but that's not the question. Surprisingly, it depends. If you do this in a method: void Foo() { String one = "1"; String two = "2"; String result = one + two + "34"; Console.Out.WriteLine(result); } then the compiler seems to emit the code using String.Concat as @Joachim

Equivalent of Class Loaders in .NET

房东的猫 提交于 2019-11-27 06:02:18
Does anyone know if it possible to define the equivalent of a "java custom class loader" in .NET? To give a little background: I am in the process of developing a new programming language that targets the CLR, called "Liberty". One of the features of the language is its ability to define "type constructors", which are methods that are executed by the compiler at compile time and generate types as output. They are sort of a generalization of generics (the language does have normal generics in it), and allow code like this to be written (in "Liberty" syntax): var t as tuple<i as int, j as int, k

How is GetHashCode() implemented for Int32?

大城市里の小女人 提交于 2019-11-27 05:33:47
I've been looking all over the place, but I can't find anything. Can anyone shed some light on this? According to Reflector: public override int GetHashCode() { return this; } Makes sense, does it? Best way to hash 32 bit value to 32 bit is not to invent wheel, use value itself. Very fast, no collisions, indeed a perfect way. 来源: https://stackoverflow.com/questions/3893782/how-is-gethashcode-implemented-for-int32