.net-3.5

How do I optimize a Linq to Xml query againist attributes?

Given the following Xml fragment: <root> <sheetData> <row r="1" /> <row r="2" /> <row r="3" /> <row r="4" /> <row r="5" /> <row r="6" /> <row r="7" /> </sheetData> </root> Which can be created with the following code: XElement testElement = new XElement("root", new XElement("sheetData", new...

How to get stack trace information for logging in production when using the GAC

I would like to get stack trace (file name and line number) information for logging exceptions etc. in a production environment. The DLLs are installed in the GAC. Is there any way to do this? This article says about putting PDB files in the GAC: You can spot these easily because they will say you need to copy the debug symbols (.pd...

Static compilation in the .NET world

I'll be writing a small desktop app for a client that has WinXP machines and they won't be installing the .NET framework (at least not for me). So my choices are limited to either C++ or VB6, neither of which sound great. I remember reading back in the day that Mono came up with a static compiler, but recently the only thing I could f...

How can I create a group footer in a WPF ListView ( GridView )

I have a ListView that displays sales orders, and groups them by status. In WinForms I had a footer at the bottom of each group that displayed the Total sale price for each group, and I would like to do the same in WPF. I have figured out how to group the orders, but I can't figure out how to create a footer. This is my current group s...

VS2005 and LINQ

Can I use LINQ within VS2005 if I have .NEt 3.5 installed? ...

Winforms datagridview databind to complex type / nested property

Winforms, C#, DataGridView, .Net 3.5 Hello, I am trying to databind a datagridview to a list that contains a class with the following structure: MyClass.SubClass.Property When I step through the code, the SubClass is never requested. I don't get any errors, just don't see any data. Note that I can databind in an edit form with the...

AccessViolation exception when form with AxWindowsMediaPlayer closed

I have a AxWMPLib.AxWindowsMediaPlayer on a form. When I close the form, I get "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." exception. It is OK with hiding the form but not with closing. Everything's fine when the component is removed from the form. This is Winforms .Net3.5. A...

Getting configuration settings from web.config/app.config using class library

Configuration settings in 3.5 is driving me nuts... Help! ;) I have a class library (Named ADI), that needs some configuration settings from the project using it (like connectionstring, filesystem locations etc). I want to define these settings in my Windows Forms/Web Projects App.Config or Web.Config, like other settings. Here is par...

Build VS2008 projects with .Net 2.0/.Net 3.5 using NAnt

I'm trying to write a build file to build a simple C# solution but it is failing with the error: Unknown task or datatype. My solution is written in VS2008 but targeted at .Net 2.0 (I'm using Vista if that helps). I've already seen the other question running-builds-using-net-3-5-msbuild-and-nantcontrib and have tried the suggested solu...

LINQ Conflict Detection: Setting UpdateCheck attribute

I've been reading up on LINQ lately to start implementing it, and there's a particular thing as to how it generates UPDATE queries that bothers me. Creating the entities code automatically using SQLMetal or the Object Relational Designer, apparently all fields for all tables will get attribute UpdateCheck.Always, which means that for ev...

Is passive logging possible in .NET?

I'm frequently frustrated by the amount of logging I have to include in my code and it leads me to wonder if there's a better way of doing things. I don't know if this has been done or if someone has come up with a better idea but I was wondering is there a way anyone knows of to "inject" a logger into an application such that it passiv...

Is it possible to somehow upgrade .NET versions without upgrading Visual Studio versions?

I currently use Visual Studio 2005 for all my personal projects, which means I'm also working with the .NET 2.0 framework. As one could imagine, it's getting that outdated feeling to it. I got this version of VS for free through MSDN's academic alliance program when I was in school. Now that I'm out of school, I sadly don't have access t...

Removing an item from a collection after some timeout

I want is to remove a Notification from a ObservableCollection<Notification> after some timeout. Is there a better way than starting a new ThreadPool thread for each added item and Thread.Sleep in there? Final code based on Nidonocu's answer: public class NotificationCollection : ObservableCollection<Notification> { private reado...

Linq-to-SQL With XML Database Fields -- Why does this work?

Some background: I have an database that I want to use linq-to-sql to update through a C# application. One of the columns in this table has an XML datatype. Every other column in that table (that isn't of an XML datatype) updates perfectly fine, but when I went to make changes to the XML field, the program executes (seemingly) correctl...

Updating your edmx to reflect changes made in your db (.net linq-to-entities)

So I have my edmx made. Then I change my database a little bit, changing a column to from being a NOT NULL to allowing NULL. I go into my edmx, right click and choose "Update Model from Database" Now I go into my program and it hasnt actually updated... I can't put a null in the column. What do I have to do to update the edmx prope...

How to pass in runtime a index of row for DataView ?

Hello everyone, I have an question, On my page i have a DataView control, I also have a button that has CommandArgument. I know i can read the DataView as : myDataView.Rows[i].FindControl("FaqQuestion"); I want to add index value in runtime to the CommantParameter, so when i go to the Function onCommand i will know exactly from what ...

How can I refactor these 2 methods into 1?

I am trying to refactor some Entity Framework code where I have a Products entity and related entities for the Product's series, family, brand, etc. The series, family, and brand entities all have the same basic structure with an Id and Text property. The two methods below are very similar and should be able to be refactored to a sin...

How to pass in runtime a index of row for ListView ?

Hello everyone, I have an question, On my page i have a ListView control, I also have a button that has CommandArgument. I know i can read and find a control in the ListView as : ListView.Items[i].FindControl("controlname"); and my button in ListView is like that asp:Button ID="WisdomButton" runat="server" CommandName="UpdateWisdom...

.NET Framework 3.0 Service Pack 1

Hello everyone, I am so confused that there is no 64-bit .NET Framework 3.0 Service Pack 1 download? If there is, could anyone send me a link please? My OS is Windows Server 2003 x64. Thanks. thanks in advance, George ...

WPF/C# Calling Event after Command Executes

Hello, I am looking for a way to be able to have an event run after a command executes. I am working with EditingCommands (ToggleBold, ToggleItalic...ect.) and would like to be able to have a method called directly after the command finishes whatever it is doing. An example would be that I have some text selected and press Ctrl+B and tha...