.net

Why is the User information stored in two different tables in ASP.NET's default Membership Provider?

There are two tables: aspnet_users and aspnet_membership. Can anyone elaborate on the reasons why they don't use a single table for this? ...

.NET convert number to string representation (1 to one, 2 to two, etc...)

Is there a built in method in .NET to convert a number to the string representation of the number? For example, 1 becomes one, 2 becomes two, etc. ...

Question inheriting from List(of T) class

I want to implement a priority queue class. When an item is added at a higher priority it is pushed to the front of the queue instead adding to the end of queue. Simple few lines of code Public Class PriorityQueue(Of T) Inherits List(Of T) Private _list As New List(Of T) Public Sub Enque(ByVal item As T, Optional ByVal pu...

Parameter type using Generics constraint VS Explicit type declaration

What would be the difference between these two seemingly similar declarations? When would you choose one syntax over another? Is there any specific reason to choose one over the other? Any performance penalties incurred for either case? public void Import<T>( Func<IEnumerable<T>> getFiles, Action<T> import) where T : IFileI...

Why doesn't TransactionScope work with Entity Framework?

See the code below. If I initialize more than one entity context, then I get the following exception on the 2nd set of code only. If I comment out the second set it works. {"The underlying provider failed on Open."} Inner: {"Communication with the underlying transaction manager has failed."} Inner: {"Error HRESULT E_FAIL has been re...

WPF ComboBox custom Scrollbars

I'm looking for a resource on how to change the size (width) of the scrollbar presented by a combobox in WPF. ...

C#/.NET - Custom Binary File Formats - Where to Start?

I need to be able to store some data in a custom binary file format. I've never designed my own file format before. It needs to be a friendly format for traveling between the C#, Java and Ruby/Perl/Python worlds. To start with the file will consist of records. A GUID field and a JSON/YAML/XML packet field. I'm not sure what to use as de...

VSTO: Application Focus

Anyone know of a way to see if the Excel window of a VSTO project is active/in focus? I'm looking for an equivalent of System.Windows.Window.IsActive. ...

Retrieving cached data from existing Crystal Reports file

Is there any way to retrieve the cached data from a previously refreshed report and say, dump it to a file? Basically, I'm looking for the dataset that is being used by the report, and hand-dragging each field onto the canvas or even exporting the file doesn't quite get me where I want. I'm not particular to a specific solution, be i...

How to programatically do file versioning with SVN and .NET?

We have a report generator. Daily, it writes its data into a excel file. For reasons of version controlling and file data safety, we need to alter this file, and commit the changes into a repository. Do you recommend any .net SVN API you've used? ...

.NET namespaces and using statements

What is the difference between namespace x { using y; } and using y; namespace x { } ? ...

How do I position a DataGridView to a specific row (so that the selected row is at the top).

I have an application with a DataGridView on it and I would like to position the rows such that a specific row is at the top of the list. I don't want a sort, I want a way to programmatically tell the DataGridView "scroll to the Nth row." Any ideas? ...

Linq problem with inserting new rows that have references to existing records

(I believe this is the same problem as this one, but there's no answer there, and I think I can express the problem better here...) I have two Linq-to-SQL classes, State and County, where County has a FK to State. Here's some test code: State s = State.GetState("NY"); // here I do a load of a State class via the Linq DataContext Count...

What, if any, is the resource penalty for using System.Diagnostics.Stopwatch?

For example foo() //Some operation bound by an external resource. db,I/O, whatever. vs. var watch = new Stopwatch(); watch.Start(); foo() var time = watch.ElapsedMilliseconds watch.Stop(); ...

Precision timing in .NET

I've just seen this question, where one of the answers indicates that System.Diagnostics.Stopwatch should only be used for diagnosing performance and not in production code. In that case, what would be the best way to get precision timing in .NET. I'm currently in the early stages of building a very simple MIDI sequencer using the MIDI-...

What is the difference between locking the specified object and locking a secondary object?

I was recently asked by a friend of mine who's just starting to play around with threading what the difference between using a secondary object purely for the purpose of locking or just locking the object you're referencing is. I had to admit that I had no idea, can anyone tell me? I will try and demonstrate with a couple of code snipp...

IIS Metabase Path for Source Input option - I don't understand its purpose

Hello, When we install Web Deployment Projects ( WDP ), we also have an option to use it inside VS 2008. By selecting Property Pages we are presented with several options for configuring compilation options. The Use IIS Metabase Path for Source Input option on the Compilation tab of the Property Pages dialog box is important ...

regex: matching same expression unknown number of times

Hi, With the help of some of the guys here I have some regex to match strings in quotes that aren't in brackets: "one" - matches ("two") - doesn't match Is it possible to repeat the match so the input: "one" ("two") "three" would return one and three? The only thing I can think of doing is capturing whatever is left over and reproc...

Public Properties and Private Members C#

What are the benefits of only using public properties instead of using the public property to access a private variable? For example public int iMyInt { get; set; } instead of private int myint; public int iMyInt { get { return myint; } set { myint = value; } } Other than letting .NET manage the variable / memory underneath the ...

FileIoPermission and net permission

I got a program that compile c# script and run them as plugins. And i want to block any possibile damages from plugins so at building time i add to each plugin class the IO permission to read and to write only in his path Somthing like this: [FileIOPermission(SecurityAction.PermitOnly, Write="<pluginpath>", Read="<pluginpath>")] class E...