.net

How do I unwrap an FSharpOption of unknown depth?

I have an object of type FSharpOption, but I don't know it's depth. It could be any of... FSharpOption<Int32> FSharpOption<FSharpOption<Int32>> FSharpOption<FSharpOption<FSharpOption<Int32>>> FSharpOption<FSharpOption<FSharpOption<FSharpOption<Int32>>>> etc. Edit: Also note that it isn't necessarily an Int32. It could be any underlyin...

If statement weirdness in Visual Studio 2008

Hello, I've come across a problem so strange, that I've recorded my session because I didn't think anyone would belive me. I came across a bug that seems to be at very fundamental level. This is a single threaded application and all im doing is evaluating a boolean. The boolean equals false, however, the if statement is executing as i...

Resource (resx) from an external resources assembly - Disk or Memory IO?

Hi, In .Net, When I fetch a resource from a resx in an external resources assembly - does this involve a fetch from Disk or Memory? Thanks ...

Where is CoverageEye ? Or another free code coverage tool for .Net ...

Hi all, I was looking for CoverageEye that was available on gotdotnet. But after closing, I'm unable to find it elsewhere. Do you know more about it ? Or another good code coverage tool for .net ? Thanks for your help, ...

Protecting from XSLT injection

I use a xsl tranform to convert a xml file to html in dotNet. I transform the node values in the xml to html tag contents and attributes. I compose the xml by using .Net DOM manipulation, setting the InnerText property of the nodes with the arbitrary and possibly malicious text. Right now, maliciously crafted input strings will make my...

How to return an array of C# strings (string[]) to unmanaged C++ code?

How to return an array of C# strings (string[]) to unmanaged C++ code, and then use it from C++? // Is it correct ??? [ComVisible(true)] public string[] Foo() { return new string[] {"A", "B", "C"}; } C++ code ?? ...

.NET assembly loading priorities

I have a solution with 3 projects (GUI, BL and DAL). The DAL assembly is signed and deployed in the GAC. When I build the solution the DAL is compiled and the assembly placed in the bin folder of the main project. But when I run the application, it loads the GAC version instead of the local one. Why is this? I realized that because the...

SL3+RIA Services: what assembly is required to use InvokeOperation<Type>?

Hello, Background: My experience in C# / Silverlight / .Net development is about 4 weeks worth. The official documentation for .Net RIA Services July 2009 Preview, on Page 66 Section 6.2.2.2 states how one would consume the result of a call made on a function marked as [ServiceOperation]. This examples specifically uses 'InvokeOperatio...

Parsing XML in C#

I am looking for a way to read the following XML <Data> <MaxCount>10</MaxCount> <Points> <Point X="10" Y="10"/> <Point X="20" Y="10"/> <Point X="30" Y="10"/> <Point X="40" Y="10"/> <Point X="50" Y="10"/> <Point X="60" Y="10"/> </Points> </Data> Basically I want to read all the point values into an array o...

Does a StreamReader lock a text file whilst it is in use? Can I prevent this?

Does a StreamReader lock a text file whilst it is reading it? If it does, can I force the StreamReader to work in a "read-only" or "non locking" mode? My workaround would be to copy the file to a temp location and read it from there but I would prefer to use the StreamReader directly if possible. Any alternative suggetions? Background:...

Is there any reason VB6 couldn't be ported to .Net?

I'm not talking about porting VB6 application to .Net (that's been talked about plenty here). I just wondered, if you can do IronPython, IronRuby, Phalanger, H#, etc, is there any technical reason that would prevent creating VB6.Net? I'd think there would be a LOT of money in it. UPDATE Sorry for all the purists, I KNOW that VB.Net is...

How to do multiline search using regular expression?

I am new to regular expressions. I want to do multiline search. Here is the example of what I want to do: Suppose I have following text: *Project #1: CVC – Customer Value Creation (Sep 2007 – till now) Time Warner Cable is the world's leading media and entertainment company, Time Warner Cable (TWC) makes coaxial quiver. Client ...

Conditional "orderby" sort order in LINQ

In LINQ, is it possible to have conditional orderby sort order (ascending vs. descending). Something like this (not valid code): bool flag; (from w in widgets where w.Name.Contains("xyz") orderby w.Id (flag ? ascending : descending) select w) ...

Getting different result in Math.Round

ticketPriceInPence = 7360 percentageToRefund = 100 (int)(Math.Round((ticketPriceInPence * 0.01) * (percentageToRefund * 0.01), 2, MidpointRounding.AwayFromZero) * 100) This results in : 73.59 (int)(Math.Round((ticketPriceInPence * 0.01) * (percentageToRefund * 0.01) * 100, 2, MidpointRounding.AwayFromZero)) This results in : 73.60 ...

Is Entity Framework available for Visual Studio 2008 Express Editions?

The title says it all really. I want to use Entity Framework for my data access on a project I'm writing in Visual C# 2008 Express Edition. Can it be done? What do I need to know? Update: My question has been answered, so thanks. As a followup, can you use a visual design tool or are you stuck with the EdmGen.exe command line tool? ...

Developing and using a custom ASP.NET web control in a single solution

Hello everyone, I have a solution with a web site and also a class library with a control which inherits from the WebControl class. When I place the control in the toolbox and use it in the web site, I can no longer build the solution - Visual Studio (the compiler) complains about the class library DLL being used by another process (whi...

How to prevent a .NET application to use an assembly from the GAC?

Can I configure a .NET application in a way (settings in Visual Studio) that it references a "local" assembly (not in GAC) instead of an assembly within the GAC, although both assemblies have the same name and the same version? ...

How to tell if a .Net control is visible using windbg

I got a crashdump where we're debating whether a control was visible to the end user or not. Looking with !do I can't see any explicit field that holds the true/false value matching up with the Visible property, which doesn't surprise that much as we're probably down in win32 teritory. Does anyone know how to deduce what Visible would ha...

.NET Service Application – Sending mail to 2,634,789 users

Hi, We have made a .NET service application to send emails to all the registered users of our website. We have 2,634,789 users and the mail has to go to all of them. In the program I am fetching the information related to 100 users at a time (to avoid database calls) and storing that in the program (in a DataTable) and then sending th...

Data Access Application Block (DAAB) and the SQL IN keyword (multiple criteria)

Hello, I am using the Patterns and Practices Data Access Application Block and I want to be able to perform a SELECT using multiple criteria like you can do in SQL using the IN keyword. Such as: SELECT * FROM SomeTable WHERE PrimaryKey IN (@keys) How can I pass in the @keys values? I do not want to have to dynamically build my SQL. ...