clr

Difference in rounding in sql and clr

I have searched and can not find the answer. I double checked the data types between SQL and CLR and I appear to have that correct. But I am getting a different result between using CLR and SQL. Not much, but enough to be off a penny. And that is not acceptable. Example in VB.NET Dim dLoanAmount As Decimal = 169500 Dim dNetDisc...

CLR - Protect IL from Reverse Engineering

How can i protect my IL from reverse engineering ? Any Obsfuscator tool is available ? will it offer maximum security ? ...

Can you run C# Code from c++?

Can you run C# code from c++? and How? ...

C#: Initialization of instance fields vs. local variables

I have always been wondering about why in the following example it is OK to not initialize the instance field (relying that it will have its default value) and accessing it, while local variables apparently must be initialized, even if I initialize it to default value it would get anyway... public class TestClass { private bool ...

ignore case with regular expression

I have created a CLR in a SQL server 2005 database. It is a simple regular expression user defined function that will check if a pattern exists in the string I pass into the function. The dot net code I use in the CLR is shown below: Return System.Text.RegularExpressions.Regex.IsMatch("Input", "pattern") This returns a bit value of ...

Is the CLR a virtual machine ?

Hi, I read a book which referred .net CLR as 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 ...

Performance surprise with "as" and nullable types

I'm just revising chapter 4 of C# in Depth which deals with nullable types, and I'm adding a section about using the "as" operator, which allows you to write: object o = ...; int? x = o as int?; if (x.HasValue) { ... // Use x.Value in here } I thought this was really neat, and that it could improve performance over the C# 1 equiva...

Different approaches to dynamic typing in the CLR and JVM

.NET 4.0 introduces new support for dispatching invocations on dynamically typed objects. As far as I can make out, this involves: no change to the CLR new types in the BCL new compilers that convert new syntax into usages of the new types In the Java space, folks are discussing adding a new dynamicinvoke bytecode to the JVM such th...

Visual Studio 2010: Embed Interop Types

I found some information about this on Scott Hanselmans Blog Does anybody exactly know what this mean? Is this only for the Office Primary Interop Assemblies, or can I also use this to Embed my Redemption library or other COM libraries? Kind regards ...

C# CLR Stored Proc won't Deploy to SQL Server 2005

I'm developing a C# SQL Server 2005 stored procedure that does data validation for my application. I have a nice framework built, that is working. The validation methods are along the lines of: private void TestDate() { TestFields(delegate (string value) { if (value == String.Empty || value == "") return true; ...

CLR Regex for fractions

I need a CLR Regex for fractions or whole numbers and fractions where 1/2 is correct 12 2/3 is correct too and a minus sign can popup just before any number. I first came up with -?([0-9]* )?-?[0-9]+\/-?[0-9]+ but that seems to allow 2/7 12 too for example. ...

How to test if numeric conversion will change value?

I'm performing some data type conversions where I need to represent uint, long, ulong and decimal as IEEE 754 double floating point values. I want to be able to detect if the IEEE 754 data type cannot contain the value before I perform the conversion. A brute force solution would be to wrap a try-catch around a cast to double looking fo...

Why can't .NET dlls be included with the app using "copy local" - so that installed .NET is not needed

Quite simple question, and I really wanna know the reason (the real reason) behind this. Say you want to distibute a .NET app to computers without .NET installed (not even 1.1). Why can't we just include mscorelib.dll & others with out app? Is it because CLR must be installed in some way, to gain JIT capabilities for intepreting IL? I ...

What is the purpose of the sorted bit vector field in the "~" Metadata header in a .NET assembly?

According to the Partition II metadata, it says that the valid field is a bitmask that notes which CLR metadata tables are present in a .NET executable--but what I can't figure out is what the "sorted" field is for--what is its significance, and what should I emit into this field when creating my own .NET portable executable images? ...

Assembly creation - CLR

I am learning concepts related to .NET framework. I am confused at one point. From what I understand the compilers CSC.exe and AL.exe compiles the files to form assembly based on the switches. So my question is 1) Different compilers in .NET framework targets the CLR. So does this mean that individual files(code) and resource files are c...

Difference between CLR 2.0 and CLR 4.0

I have read countless blogs, posts and StackOverflow questions about the new features of C# 4.0. Even new WPF 4.0 features have started to come out in the open. What I could not find and will like to know: What are the major changes to CLR 4.0 from a C#/WPF developer perspective? What are the major changes to CLR 4.0 as a whole? I th...

Learning C# quickly gathering all necessary concepts

Hi All, I want to learn .NET and I have 2 weeks time of this. I have sound knowledge of CLR, Assemblies and certain basics. I have a copy of "CLR via C#". But I need to learn advanced C# concepts like delegates, reflection, generics and so on. And then I need to quickly jump into coding. Remember, I have 2 weeks time. I suppose a quick g...

CLR question. Why method overloading in C# decides that null is a string?

Possible Duplicate: C#: Passing null to overloaded method - which method is called? Here is a test case object a = null; var b = Convert.ToString (null); var c = Convert.ToString (a); string d = Convert.ToString (null); // CLR chooses Convert.ToString(string value) string e = Convert.ToString (a); // CLR chooses Convert.ToStrin...

Invoking CLR stored procedures

In short, where can I find C#/VB client side sample code that calls CLR stored procedure with some argumnet [like a sqlxml data] and receives a datareader or other form of result ? Also how do I periodically receive information from the running CLR stored proc sent through SQlContext.Pipe.Send() method ? ...

C# Lambda puzzling behaviour

Func<Classification, string> test1 = c => c.Id = "x"; Func<Classification, string> test2 = c => { return c.Id = "x";}; I've worked with lambda's for nearly a year or so now and fairly reasonable with them, but today I was looking at NBuilder and seen a weird Func that didn't seem to match the examples. I had play anyway and it checks ...