.net-3.5

How to stop one thread until n threads have completed their work.

Hello, I have an application with one main thread and N worker threads. At some point I need that the main thread waits until all the N threads have completed one section of their work. I normally would use Monitor.Wait() and Monitor.Pulse() but this will prevent the N threads from working at the same time. Any idea on how to do that?...

Managed COM aggregation

It is my understanding building a COM object aggregating an existing COM object implies implementing redirection logic in the IUnknown.QueryInterface method of the outer object. The question I have is how to do that if the object you are building is managed. On managed objects IUnknown is not explicitly implemented COM Interop does it f...

XmlParseException occuring in PresentationFramework for deploys only

I am getting the following exception when I deploy my WPF app to another user's machine: An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll However, the WPF app runs fine when I open it. The app crashes at StartUp with this message. I've double-checked to make sure ...

Custom Serialization using XmlSerializer

I have a class that I need to do some custom XML output from, thus I implement the IXmlSerializable interface. However, some of the fields I want to output with the default serialization except I want to change the xml tag names. When I call serializer.Serialize, I get default tag names in the XML. Can I change these somehow? Here is my...

Testing if a value is contained within a Dictionary<TKey, List<TValue>>

I need to determine if any of the Lists contained in the Dictionary contain the specified value. I'm new to LINQ, so is the following the correct way to achieve this? Dictionary lotsOfStuff = new Dictionary<string, List<string>>(); string searchString; // populate lotsOfStuff and searchString... // detemine if any of the values of lot...

How to synchronize column widths between two nested datagrids?

I have a wpf toolkit datagrid with a few columns, then inside the row details I have another datagrid. Basically I am emulating a treelistview control (example: http://www.codeproject.com/KB/list/treelistview.aspx) but using datagrids. I would like to sync the column widths of the datagrid in the row details with the column widths of th...

Why is DataGrid "Auto" width so huge all the sudden?

I have been working on an app with a datagrid from the wpf toolkit and the width was not specified in the xaml (default to auto), and it was working fine. It would extend the window width as I resized the window. However, all the sudden the "auto" width is massive and I don't know why. When I pull the xaml file up in blend it shows auto ...

Checking "Client-only Framework subset" in C# project properties have no effect (VS2008), is this normal?

Hi, I wanted to try to deploy our project for .net 3.5 client framework (so that we could distribute it with smaller runtime), but when I go to VS 2008 Project properties and check the “Client-only Framework subset” checkbox (and click Save all), it has no effect - the .csproj file does not change (the diff for whole project is empty), a...

Convert List of objects to List of interfaces

if i have objectA that implements ISomeInterface why can't i do this: List<objectA> list = (some list of objectAs . . .) List<ISomeInterface> interfaceList = new List<ISomeInterface>(list); why can't i stick in list into the interfaceList constructor ? Is there any workaround? ...

Add parameter to Button click event

I have a wpf button like this: <Button Click="button1_Click" Height="23" Margin="0,0,5,0" Name="button1" Width="75">Initiate</Button> And I want to pass {Binding Code} passed as parameter to the button1_click handler. How do I go about this? Disclaimer: really new to WPF ...

Linq to SQL (designer) does not understand stored procedure

Why can the Linq to SQL designer not understand the following stored procedure and import it correctly? CREATE PROCEDURE dbo.MartinTest @parameter1 INTEGER AS SET NOCOUNT ON SELECT C1, C2, C3 INTO #myTempTable FROM MyTable SELECT C1, C2, C3 FROM MyOtherTable INNER JOIN #myTempTable ON .... RETURN W...

Is this a covariance problem? Not sure if brick wall.

I wrote ASP.NET pages which will manage forms. They're based on the following base class. public abstract class FormPageBase<TInterface, TModel> : Page, IKeywordProvider where TModel:ActiveRecordBase<MasterForm>, TInterface, new() where TInterface:IMasterForm { public TInterface FormData { get; set; } ...

Exposing class library DLL to COM with generics

For the sake of this question, here is my generic class. [ComVisible(true)] public class HtmlTable<T> where T : class { List<T> listToConvert; public HtmlTable(List<T> listToConvert) { this.listToConvert = listToConvert; } } Essentially, this class is responsibly for converting a List of class T to an HTML tab...

Changing App.config at Runtime

I'm writing a test winforms / C# / .NET 3.5 application for the system we're developing and we fell in the need to switch between .config files at runtime, but this is turning out to be a nightmare. Here's the scene: the Winforms application is aimed at testing a WebApp, divided into 5 subsystems. The test proccess works with messages b...

implicitly casting a generic<T> back to T

If I write a generic class like class MyGeneric<T> is it possible to write an implicit cast to type T, so I can do stuff like: public class MyGeneric<T> { ... } public class GenericProperties { public MyGeneric<string> MyGenericString {get;set;} public void UseMyGeneric() { string sTest = MyGenericString; MyGene...

How do I create a COM (and other device) emulator in C#?

Hi. We have several legacy components that interact with COM ports, USB etc. I would like to create a .NET program that would emulate a COM port and log the traffic, relaying it to a WCF service endpoint somewhere or directly into a database. Maybe also wrapping a real COM port kind of like the decorator pattern. I have looked around...

How to get video frame using DirectShow.net?

As part of a program I have to be able to pull a few random frames from a user specified video file. I do not have any experience with video processing programming, so this is new to me. I've determined that I need to use DirectShow.net to do this on Windows XP using .Net, but I cannot figure out how to get it done. I'm trying to use th...

LINQ to XML with join and GroupBy(). Is this correct?

I am learning LINQ and this seems like a fairly simple problem. I have a semi-working solution but I am sure it could be cleaned up. The propertyAuto node represents a car with id = 606. This node needs to have at least two child propertyValue nodes, one that references a vehicleValuation element with attribute of "Book" and one of "Au...

Subsonic 3.0 Bug?

Hi, I have a table named "data_buckets" and a column in that table named "data_bucket". When I buid the activerecord.cs, subsonic created a class name "data_bucket" (extending IActiveRecord) for the table and obviously a conflict will arise when you try to access the field "data_bucket". Is it a known issue? Is there any workaround with...

Odd Lambda Expression Question

List<string> a = new List<string>() { "a", "b", "c" }; List<string> b = new List<string>() { "a", "b", "c", "d", "e", "f" }; b.RemoveAll(a.Contains); If you loop through b it will now only contain d e and f. Can anyone expand out whats actually happening, because currently it doesnt make any sense at all. Edit: I was more talking abo...