.net

How to sort an List collection of classes with properties in them?

Hi I have a List of classes in my collection like List<MyClass> test = new List<MyClass>(); In my classes I have just some properties public string id {get; set;} public DateTime date {get; set;} Now I make these classes by getting some queries from 2 different database tables. I then take those 2 results from the database tables ...

Using RegisterDeviceNotification in a .NET app

I have seen some examples on how to use RegisterDeviceNotification from the Windows API, but I have not seen any .NET examples. I want to write a C# app that is notified when a new drive appears (specifically through USB, firewire, etc). This app needs to be a Windows service, so I can't use WM_DEVICECHANGE messages without some bad-prac...

How can I get a list of files loaded by my process?

I'm trying to do a quick and dirty deployment of a project. I thought it would be easy to run my process, use some tool to grab a list of all loaded files (DLLs) and use that list to create a copy file list for my test deployment. Thought about using filemon but there is a lot of noise in there. Its a .net project. Thanks. ...

Class versioning to support backwards compatibility

In the project I work on, we handle Medical Billing. Every time the state makes a change to the official form (which our data classes represent), in order to maintain backward compatibility with previous forms, we add the new properties but leave the old ones intact, and have a document version property which is used to determine what v...

Windows Azure - Framework Specs?

I'm playing around with a test project in Visual Studio 2010 and tried to publish it to Azure, but it was rejected as, out-of-the-box, VS2010 defaults to using .Net Framework 4.0 and Azure currently only runs 3.5 SP1 stuff. Any other restrictions on the level of software you can use in there? ...

Is it possible to have C# and vb.net in the same asp.net website?

Is it possible to have C# and vb.net in the same asp.net website? without separating in class libraries. ...

changing a node type to #text whilst keeping the innernodes with the HtmlAgilityPack

I'm using the HtmlAgilityPack to parse an XML file that I'm converting to HTML. Some of the nodes will be converted to an HTML equivalent. The others that are unnecessary I need to remove while maintaining the contents. I tried converting it to a #text node with no luck. Here's my code: private HtmlNode ConvertElementsPerDatabase(Ht...

How to save a human readable file

Currently i have an application that reads and writes several properties from one or two basic classes to a .txt file using the Binary Serializer. I've opened up the .txt file in NotePad and as it's formatted for the application it's not very readable to the human eye, not for me anyway =D I've heard of using XML but pretty much most o...

Will .NET be portable some day?

Not only Compact Framework. I know about Mono, but it will always be one step behind .NET. ...

Microsoft Enterprise Logging Application Block - Reading Log File

Hi, I'm using MS log application block for logging my application event into a file called app-trace.log which located on the c:\temp folder. I'm trying to find the best way to read this file at runtime and display it when the user asks for it. now i have 2 issues: it seems that this kind of feature is not supported by the framework,...

DB lib to convert classes into a scheme and auto generate some queries?

Hey i am looking for a lib that can take the class below and generate these two tables with a reference/foreign key and allow me to tweak the default logic. Like below, unless i specify otherwise when i do sqlClass.Insert(imglist) it will not create another entry for user_id but try to find an existing one in the database. class ima...

Twain driver sometimes giving "Cannot create a file when that file already exists"

I have a WPF application that works on XP and usually(?) works on Windows 7. The twain library is raising a Win32Exception when I try to enable the twain GUI. On-screen, I see the GUI come up and start to give images (this is a USB 2820 video, for what that's worth), but it quickly crashes. The exception's message is that it "Cannot c...

.NET - Problem with printing

Presently I am having a problem with printing in C#. I have a pre-printed bill, and I need to print values into some specific points of that bill. Any suggestions? ...

Connection Pool returns Same Exception Instance to Two Threads Using the Same Bad Connection String?

Ok this looks like a major fundamental bug in .NET: Consider the following simple program, which purposely tries to connect to a non-existent database: class Program { static void Main(string[] args) { Thread threadOne = new Thread(GetConnectionOne); Thread threadTwo = new Thread(GetConnectionTwo); ...

Is it possible to bypass a file lock in C# when another thread/process is unecessarily using an exclusive lock?

Is there a way to bypass or remove the file lock held by another thread without killing the thread? I am using a third-party library in my app that is performing read-only operations on a file. I need a second thread read the file at the same time to extract out some extra data the third-party library is not exposing. Unfortunately, the...

How can I get a list of all threads in a .Net application?

I'm trying to troubleshoot a larger multiprocessing issue -- I suspect a client library is creating a foreground thread, and I'm trying to see if that theory is correct. In order to do that, I'd like to be able to log a list of all threads in a process, what their state is, and whether they are background or foreground. I've seen Proce...

I set IDENTITY_INSERT to ON but I get a SqlException saying it's OFF

I'm trying to grab thousands of invoices (and other stuff) from a text file and insert them into SQL Server 2008. I wrote a little console app to do this and it uses LINQ to SQL. After I insert all the existing invoices I want the Invoice_ID to be an identity column and auto-increment, so I have it designed as such: CREATE TABLE [dbo]...

Server-Side Redirect in PHP

I have a Java application that I need to integrate our existing PHP website with. The vendor wants us to do a server-side redirect to allow for secure authentication and single-sign-on, but I'm not sure how to do that in PHP. The vendor explained the workflow as follows: User clicks on a 'Open Application' link on our PHP site The PHP ...

Why String.IsNullOrEmpty(str) and not str.IsNullOrEmpty()?

Possible Duplicate: string.IsNullOrEmpty() vs string.NotNullOrEmpty() Can someone explain to me why in .NET I would write String.IsNullOrEmpty(str) instead of str.IsNullOrEmpty()? There must be a logical reason but I don't know it. It sounds like you guys are saying You can't call methods from objects that are null in C#/.NET...

System Design / Architecture Best Approach

Hi, I have a system, that has 3 general parts to aid my description. 1) DATABASE- to store all tables, this same database will store data for other services as well including a web application, silverlight etc... (Needs to be flexible, if on a remote server, can be exposed via a web service, if locally, can connect locally or via TCP t...