.net

Quickest way to find the complement of two collections in C#

I have two collections of type ICollection; c1 and c2. I'd like to find the set of items that are in c2 that are not in c1 where the heuristic for equality is the Id property on MyType. What is the quickest way to perform this in C#. Edit: C# version = 3.0 ...

iTextSharp IOException "Trailer not found"

am using iTextSharp ( .NET 2.0 Vista ). The iTextSharp Version is 4.1.2.0 PdfReader reader = new PdfReader(pdfFile); is causing the library to thrown an exception saying "Trailer not found" The file exists and can be viewed in Adobe no problem Any ideas? ...

C++/CLI use of Action<...,...> and Func<...> unsupported?

Hi, it does look like there is support for the Action and Func delegates in the System namespace in C++/CLI. At least not for multiple generic arguments such as: System::Action<int, int>^ action = nullptr; System::Func<int, int>^ func = nullptr; Both result in errors such as: error C2977: 'System::Action' : too many generic arguments...

tools to detect .net application deadlock

can anybody recommend tools to detect .net application deadlock? EDIT: Chess is what i found from Microsoft. ...

.NET Base Validator and reflection

I am creating .NET validators dynamically and passing the property I am invoking and the value to a method that invokes the property and supplies the value. This is working for most of the properties. But when I try to invoke the Operator method or the Type method of the compare validator, I get an error saying the property cannot be fo...

How to make my program a background process.

I wrote a program in C# .NET, that needs to be run in the background. I mean it should have any user interface. Neither a GUI nor a CLI. It is not also a windows service(because it must run only after user has logged in). It should just run in background. example of such programs are AdobeUpdater.exe , GoogleUpdater.exe etc. ...

.NET best practices for MongoDB connections?

I've been playing with MongoDB recently (It's AMAZINGLY FAST) using the C# driver on GitHub. Everything is working just find in my little single threaded console app I'm testing with. I'm able to add 1,000,000 documents (yes, million) in under 8 seconds running single threaded. I only get this performance if I use the connection outsi...

Language (C# or VB.Net project) Impact on .Net Build Script

I am very new to writing Build Script. I am trying to understand the impact of the using Different languages (c#, vb.net c++) while creating a build script. Build script can written using either Nant or MSBuild. Is the only change in the build script is with regards to compiler switch or even the deployment structure also changes with...

Formatting a String for a SQL IN Clause

Hey Guys, I need to format a string and pass it in as parameter for a SQL IN clause such as: Select * from Table Where X In (@param1) The literal string that is passed in as a param looks like this: "Item1, Item2, Item3" This does not seem to work. Any suggestions? Thanks! ...

Including a fragment with Votive and Wix

I am separating out logical sections into fragment *.wxs files, but how do I include them in my main Product.wxs using Votive and Visual Studio? I am referencing the component in the main wxs file but receive and error that the component is not found. I'm assuming I'm not linking these correctly. Error 13 Unresolved reference to symbo...

Hide / Show Winforms GUI C# from another thread.

This post is continuation of http://stackoverflow.com/questions/2167625/way-to-quickly-show-hide-winforms-gui-c, as it doesn't work for me in this particular case. I've got 2 problems: 1 is that the mainAnnounceWindow gui should start hidden and later on when called by: windowStateChange("Show") it should show, by windowStateChange(...

Create a Icon from a Resources.resx

I have a Icon(.ico file) in the (VB.NET)MyProject>Resources.resx file. How do I extract it in run-time as a Icon object? Thanks ...

IS there a short way to insert dataset into a new MS Access table?

I'm consuming a 3rd-party web service that outputs a Dataset (from XML). I'd like to create a new table in my local MS Access database that contains the DataSet data. Is there a simple way to hand-off the DataSet to a .net object and ask it to "create a table from this"? I know that we can use different parts of ADO to extract schem...

What XML related technologies I should know before learning LINQ to XML?

Hi I’d like to start learning Linq to Xml, but before I do that, are there any technologies I should know prior to learning Linq to Xml? Thus, besides the basics of XML and XML schema, which of the following technologies I must, which I would be advisable to and which I don’t need to learn before trying to learn Linq to XML: • Net Sch...

.NET Localization without directory structure

I'm working to build a .NET program with WPF that will need to be localized. I have looking into localizing the app with LocBaml and by using .resx files. However, both of these options require a specific directory structure to be in place. I would like to deploy the program using IExpress (wikipedia) to allow the end user to download a ...

Initializing private members c#

I have two private lists that need to be initialized when object is created. Second list is dependent on first one. Can I do it like this: public class MyClass { private List<T> myList = new List<T>(); private ReadOnlyCollection<T> myReadOnlyList = myList.AsReadOnly; ... } Second list is read only wrapper arou...

Why does Nullable<T> HasValue property not throw NullReferenceException on Nulls?

Consider the following code: DateTime? ndate = null; Console.WriteLine(ndate.HasValue); I would have expected a NullReferenceException, but HasValue will indeed return false. However, since ndate is null, how does the property invocation succeed, since there is no object to invoke the property HasValue on? ...

Is there something similar to python's enumerate for linq

In python I can easily get an index when iterating e.g. >>> letters = ['a', 'b', 'c'] >>> [(char, i) for i, char in enumerate(letters)] [('a', 0), ('b', 1), ('c', 2)] How can I do something similar with linq? ...

Unmanaged Exports / Robert Giesecke

In the following answer Robert Giesecke describes a way to export managed code to native applications without the need of COM registration: Answer on stackoverflow from Robert Giesecke I downloaded the UnmanagedExportLibrary.zip from and built the samples using Visual C# 2008 Express Edition for the .net part and delphi 2010 for the w...

How to set HotKey system-wide in c#

In AutoIt v3 there's a function called: HotKeySet. It sets a hotkey that calls a user function when pressed. It's system wide hotkey meaning that the key when hotkey is set can't be used for anything else. Basically I would like to catch ESC or any other key like $ ` etc and when user presses it anywhere even outside of the app it shou...