.net-3.5

Which .Net collection for adding multiple objects at once and getting notified ?

Was considering the System.Collections.ObjectModel ObservableCollection<T> class. This one is strange because it has an Add Method which takes one item only. No AddRange or equivalent. the Notification event arguments has a NewItems property, which is a IList (of objects.. not T) My need here is to add a batch of objects to a coll...

Handles vs. AddHandler

Is there an advantage to dynamically attaching/detaching event handlers? Would manually detaching handlers help ensure that there isn't a reference remaining to a disposed object? ...

When creating a new GUI, is WPF the preferred choice over Windows Forms?

Most restrictions and tricks with windows forms are common to most programmers. But since .NET 3.0 there is also WPF available, the Windows Presentation Foundation. It is said that you can make "sexy applications" more easy with it and with .NET 3.5 SP1 it got a good speed boost on execution. But on the other side a lot of things are wo...

What is the difference between the WPF TextBlock element and Label control?

Visually both of the following snippets produce the same UI. So why are there 2 controls.. Snippet1 <TextBlock>Name:</TextBlock> <TextBox Name="nameTextBox" /> Snippet2 <Label>Name:</Label> <TextBox Name="nameTextBox" /> (Well I am gonna answer this myself... thought this is a useful tidbit I learnt today from Programming WPF) ...

Copying relational data from database to database

Edit: Let me completely rephrase this, because I'm not sure there's an XML way like I was originally describing. Yet another edit: This needs to be a repeatable process, and it has to be able to be set up in a way that it can be called in C# code. In database A, I have a set of tables, related by PKs and FKs. A parent table, with chi...

Help convert this delegate to an anonymous method or lambda

I am new to all the anonymous features and need some help. I have gotten the following to work: public void FakeSaveWithMessage(Transaction t) { t.Message = "I drink goats blood"; } public delegate void FakeSave(Transaction t); public void SampleTestFunction() { ... Expect.Call(delegate { _dao.Save(t); }).Do(new FakeSave(Fake...

Loading Assemblies from the Network

This is related to the this question and the answer maybe the same but I'll ask anyways. I understand that we can start managed executables from the network from .NET 3.5 SP1 but what about assemblies loaded from inside the executable? Does the same thing apply? ...

Is there a way to asynchronously filter an IList?

Ok, so there has to be a way to do this... no? If not I'd love some ideas. I have two repeaters and an image inside an update panel along with some AJAX dropdowns with link buttons to the left. I want to update the data inside the update panel as fast as possible as values are selected from the dropdowns. What do you think would be t...

.Net 2+: why does if( 1 == null ) no longer throw a compiler exception?

I'm using int as an example, but this applies to any value type in .Net In .Net 1 the following would throw a compiler exception: int i = SomeFunctionThatReturnsInt(); if( i == null ) //compiler exception here Now (in .Net 2 or 3.5) that exception has gone. I know why this is: int? j = null; //nullable int if( i == j ) //this s...

Best way of constructing dynamic sql queries in C#/.NET3.5?

Hello, A project I'm working on at the moment involves refactoring a C# Com Object which serves as a database access layer to some Sql 2005 databases. The author of the existent code has built all the sql queries manually using a string and many if-statements to construct the fairly complex sql statement (~10 joins, >10 sub selects, ~1...

How-To Auto Discovery a WCF Service?

Is there a way to auto discover a specific WCF service in the network? I don want to config my client with the address if this is posible. ...

Best practices for DateTime serialization in .Net framework 3.5/SQL Server 2008

Some 4 years back, I followed this MSDN article for DateTime usage best practices for building a .Net client on .Net 1.1 and ASMX web services (with SQL 2000 server as the backend). I still remember the serialization issues I had with DateTime and the testing effort it took for servers in different time zones. My questions is this: Is t...

How to publish wmi classes in .net?

I've created a seperate assembly with a class that is intended to be published through wmi. Then I've created a windows forms app that references that assembly and attempts to publish the class. When I try to publish the class, I get an exception of type System.Management.Instrumentation.WmiProviderInstallationException. The messag...

.NET 3.5 Linq Datasource and Joins

Have been trying out the new Dynamic Data site create tool that shipped with .NET 3.5. The tool uses LINQ Datasources to get the data from the database using a .dmbl context file for a reference. I am interseted in customizing a data grid but I need to show data from more than one table. Does anyone know how to do this using the LINQ D...

VS2008 Setup Project always requires .NET 3.5 at install time but I don't need it!

1, Create and build a default Windows Forms project and look at the project properties. It says that the project is targetting .NET Framework 2.0. 2, Create a Setup project that installs just the single executable from the Windows Forms project. 3, Run that installer and it always says that it needs to install .NET 3.5 SP1 on the mac...

Should I use a state machine or a sequence workflow in WF?

I have a repeatable business process that I execute every week as part of my configuration management responsibilities. The process does not change: I download change details into Excel, open the spreadsheet and copy out details based on a macro, create a Word document from an agenda template, update the agenda with the Excel data, creat...

Combining two SyndicationFeeds

What's a simple way to combine feed and feed2? I want the items from feed2 to be added to feed. Also I want to avoid duplicates as feed might already have items when a question is tagged with both WPF and Silverlight. Uri feedUri = new Uri("http://stackoverflow.com/feeds/tag/silverlight"); XmlReader reader = XmlReader.Create(feedUri.Abs...

What is best for desktop widgets (small footprint and pretty graphics)?

If I were to want to create a nice looking widget to stay running in the background with a small memory footprint, where would I start building the windows application. It's goal is to keep an updated list of items off of a web service. Similar to an RSS reader. note: The data layer will be connecting through REST, which I already have...

Enabling embedded controls in a FlowDocument

I have a FlowDocument in a standard WPF application window where I have some text, and in this text some hyperlinks and buttons. The problem is, if I put this FlowDocument inside anything except a FlowDocumentPageViewer the hyperlinks and buttons are disabled ("grayed out"). <FlowDocumentScrollViewer> <FlowDocument> <Paragraph>...

Does C# have an equivalent to JavaScript's encodeURIComponent()?

In JavaScript: encodeURIComponent("©√") == "%C2%A9%E2%88%9A" Is there an equivalent for C# applications? For escaping HTML characters I used: txtOut.Text = Regex.Replace(txtIn.Text, @"[\u0080-\uFFFF]", m => @"&#" + ((int)m.Value[0]).ToString() + ";"); But I'm not sure how to convert the match to the correct hexadecimal format t...