.net

Does a wrapper class for a COM interop IStream already exist?

I'm about to write a Wrapper for a COM interop IStream so that code that expects a standard .NET Stream can use it. However it occurs to me that this sort of thing may already have been done before (although I haven't been able to find it myself with web searching). So I'm just putting this out here in case I'm about to re-invent the w...

What are some free or inexpensive tools out there to search/index file systems (using .Net)?

I'm looking for a way to search a file system that contains approximately 1TB of documents in either Office or PDF format. Is Lucene.Net pretty much the best way to accomplish this? I've also heard of dtSearch, and was wondering if anyone had used that tool with any success? Are there any other tools out there that would do the job? ...

Should I add the .NET framework directories to my PATH?

I sometimes need to run gacutil.exe or installutil.exe, etc. from the command line. Is it OK to add the .NET framework directories to my system PATH? If so, which ones should I add and in which order? ...

"User Friendly" .net compatible Regex/Text matching tools?

Currently in our software we provide a hook where we call a DLL built by our clients to parse information out of documents we are processing (the DLL takes in some text (or a file) and returns a list of name/value pairs). e.g. We're given a Word doc or Text file to Archive. We do various things to the file, and call a DLL that will retu...

Why do threads waiting on a ManualResetEvent continue waiting even when Close() is called?

We were surprised to learn today that threads waiting on a ManualResetEvent continue waiting on the event even when it's closed. We would have expected that calling Close() would implicitly signal the waiting threads. We tracked this down as a reason some of our windows services were not shutting down as fast as we'd like. We're chang...

Mapping an instance of IList in NHibernate

I'm trying to map a parent-child relationship using NHibernate (2.1.2), MySql.Data (6.2.2) and MySQL Server (5.1). I figured out that this must be done using a <bag> in the mapping file. I build a test app which is running without yielding any errors and is doing an insert for each entry but somehow the foreign key inside the children ta...

Adding web reference is not generating the expected reference.cs file. Absent functions.

I'm working with an old windows app in visual studio 2005. A webserviced referenced in the original app has 2 functions and when i peak inside the auto-generated reference.cs file I notice a couple of other functions to allow async calls have been geenrated i.e. BeginWhateverFunctionNameIsCalled and EndWhateverFunctionNameIsCalled. My ...

Is it safe to install .Net 3.5 SP1 after .Net 4.0 RC has already been installed?

I have a Build Agent that was only dealing in .Net 4.0 RC stuff, and so only had .Net 2.0 (natively) and 4.0 (manually) versions installed. It now needs to support stuff compiled against 3.5 SP1. Does anyone know if I'm asking for trouble trying to install 3.5 SP1 after 4.0 RC has already been installed? Thanks in advance. ...

What's the difference between the [OptionalField] and [NonSerialized]

I came across this question on transcender: What should you apply to a field if its value is not required during deserialization? Me = [NonSerialized], ANSWER = [OptionalField] My gut reaction was NonSerialised, I have no idea why but in the space of 5 seconds thats what I thought but to my surprise, Transcender says I am wrong. OK fa...

Best way to check for string in comma-delimited list with .NET?

I'm reading a comma-delimited list of strings from a config file. I need to check whether another string is in that list. For example: "apple,banana,cheese" If I check for "apple" I should find it, but if I check for "app" I should not. What's the most straight-forward and concise way to do this? It doesn't have to be fast. (I'll ...

How to return an IQueryable<Something> as an IQueryable<ISomething>

I have a class Something that implements ISomething. How can I convert/cast from an IQueryable<Something> to an IQueryable<ISomething>. When I try to cast, I am able to compile, but the result of the cast is always NULL. Background: The reason I am doing this is because my Something class is a CodeSmith-generated class (PLINQO templa...

Setting ProcessStartInfo.WorkingDirectory to an UNC Path

I have a utility that I have written in VB.net that runs as a scheduled tasks. It internally calls another executable and it has to access a mapped drive. Apparently windows has issues with scheduled tasks accessing mapped drives when the user is not logged on, even when the authentication credentials are supplied to the task itself. O...

Is it a good idea to keep all the enums in one place?

When I'm building a class library I usually create a file Enums.cs to hold all the enums used in the assembly. Here is an example: namespace MyNamespace { public enum Colors { Red, Green, Blue } public enum Shapes { Circle, Square, Triangle } } This makes all my e...

Using SqlBulkCopy in a multithread scenario with ThreadPool issue

I'm facing a dilemma (!). In a first scenario, I implemented a solution that replicates data from one data base to another using SQLBulkCopy synchronously and I had no problem at all. Now, using ThreadPool, I implemented the same in a assynchronously scenario, a thread per table, and all works fine, but past some time (usualy 1 hour b...

Why Finalize method not allowed to override

I am new to .net ..and i am confused with the destructor mechanism in C# ..please clarify In C# destructors are converted to finalize method by CLR. If we try to override it (not using destructor ) , will get an error Error 2 Do not override object.Finalize. Instead, provide a destructor. But it seems that the Object calss implementat...

.Net Memory limit

I have a .Net application running on a 32 bit box. The application is a windows service. It consistently hovers around 600-800 MB range. Is this a problem. If an application crosses 1 GB, is it a memory issue ? ...

Can I use mono's AOT feature to natively "pre-compile" .NET DLLs/EXEs to make them harder to reverse engineer?

Can I use mono's AOT (Ahead of Time compilation) feature to natively "pre-compile" all or part of some of my own .NET DLLs (and or EXEs) to make them harder to reverse engineer? I'm using Windows (7 / x64 but I have an x86 XP machine as well) and .NET 3.5 (VS 2008) and I'm curious if mono/AOT can be/has been used for this purpose? (Tying...

How to issue SQL Server lock hints in WCF Entity Framework?

I'm just learning the WCF entity framework (and .net in general), and I'm running into a problem specifying lock hints in an embedded SQL query. I'm trying to specify a query that has lock hints in it (e.g., "SELECT * FROM xyz WITH(XLOCK, ROWLOCK)") and I keep getting errors from the runtime that the query syntax is not valid. The quer...

Emulating a web browser

Hello, we are tasked with basically emulating a browser to fetch webpages, looking to automate tests on different web pages. This will be used for (ideally) console-ish applications that run in the background and generate reports. We tried going with .NET and the WatiN library, but it was built on a Marshalled IE, and so it lacked many...

How serialize Dictionary<int, string>

How I may to serialize Dictionary? ...