.net

C# Unit Testing: Testing a method that uses MapPath

First of all, I am aware that this question is dangerously close to: http://stackoverflow.com/questions/1231860/how-to-mappath-in-a-unit-test-in-c I'm hoping however, that it has a different solution. My issue follows: In my code I have an object that needs to be validated. I am creating unit tests for each validation method to make su...

Are time-zones in sync between Windows and .NET

Occasionaly Windows time zones are updated (e.g. http://support.microsoft.com/default.aspx/kb/970653). Does this also updates time zone information inside .NET framework? ...

Exists query with LINQ

Hi, I'd like to get with LINQ an employee list, these employees must have in the TypeOfWorks list the typeofWork passed (Id) in argument public class Employee { public virtual IList<EmployeeTypeOfWork> TypeOfWorks { get; set; } } public class EmployeeTypeOfWork { public virtual Guid Id { get; set...

how a proxy server can be local ?

hello all , i have a server and i setup vpn server on it, in our country some websites are blocked. but with this proxy server users can not surf websites because the websites URL are still blocked and they see block page , programs like Freegate , Gpass , how can make it for us to surf websites ? it means what happens after connecting...

DataGridView performance - does it depend on the video card?

I have a C#/.Net application which seems to use most of it's CPU time doing updates to a DataGridView. I manually update the data about every 1.5 seconds, updating only the data that has changed. This ends up being about 250 updates every 1.5 seconds. I'd like to reduce that 1.5 seconds to a much smaller number (0.5 seconds maybe). I...

Why is Object.ToString a virtual method?

If it wasn't a virtual method, you can still achieve the same effect by just writing your ToString method normally, right? You could even use the optional new keyword. Wouldn't this have better performance? ...

Optimize finding all classes implementing IInterface<T> and those explicitly implementing it with a specific type

I have an interface ISerializeDeserialize defined and some classes inheriting the generic interface. I also have some code generated assemblies using the CodeDomProvider which generates classes inherited from the same interface but implementing it with a specific Type. What I want to achieve is getting a list of the generic implementati...

How do you display a custom UserControl as a dialog in C#/WPF (.NET 3.5)?

How do you display a custom UserControl as a dialog in C#/WPF (.NET 3.5)? ...

Why can't I open a file using impersonation on a remote machine?

I have a WCF service written in C# being hosted on a remote machine, running as the local administrator account. From my machine logged in as an active directory user, I am sending a command that simply tells it to open a file on the network. I have access to the file, but the administrator account on the host machine does not. I'm using...

LoaderLock error when connecting to Oracle in .NET OLE DB connection

I have an OLE DB connection in VB.NET that I am trying to use to connect to an Oracle database. However, I get the following error on the con.Open() line: LoaderLock was detected Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can ca...

Using SslStream with IOCP

I have written a TCP server using the Socket class's asynchronous/IOCP methods, BeginSend()/BeginRead()/etc. I would like to add SSL capability using SslStream, but from the interface it looks like Socket and SslStream are not intended to work together, in particular because I'm not using Streams at all and SslStream appears to depend o...

Where to place a Sync() call: FormClosed or FormClosing?

I need to kick off a Sync() process whenever my windows form app is being closed. This sync's data between the local SQL instance and a network SQL instance. What is the better event to place this in: Closed or Closing? Are there any factors that might change it from one to the other, as far as being best practice? As a bonus questio...

Asp.Net MVC - Plugins Directory, Community etc?

Good evening everyone, I am currently starting to dive into asp.net mvc and I really like what I see so far.. BUT I am somewhat confused about 'drop-in' functionality (similiar to what rails and it's plugins and nowadays gems are), an active community to contact etc. For rails there's github with one massiv index of plugins/gems/code-e...

How to shuffle a List<T>

I found this piece of Java code at Wikipedia that is supposed to shuffle an array in place: public static void shuffle (int[] array) { Random rng = new Random(); int n = array.length; while (n > 1) { n--; int k = rng.nextInt(n + 1); int tmp = array[k]; array[k] = array[n]; array...

Uploading .msg files with attachments

Currently we are uploading .msg files to an application on the web. If there are attachments in the .msg files - they are listed but you cannot open the attachments. Does anyone know how to make the attachments as they would in the email on the web app? The files are saved on the server and on the server you can click on the attachmen...

C# : So if a static class is bad practice for storing global state info, what's a good alternative that offers the same convenience?

Hi, I've been noticing static classes getting a lot of bad rep on SO in regards to being used to store global information. (And global variables being scorned upon in general) I'd just like to know what a good alternative is for my example below... I'm developing a WPF app, and many views of the data retrieved from my db are filtered b...

How to deploy a desktop .Net application with custom settings per user

This seems like a simple question but the intergoogles have not been kind. I have a C# desktop application. There are certain properties that need to be customized per customer, such as each customer's organization's name, that are otherwise independent of the actual functionality of the application and therefore do not need to be comp...

Int32? with IComparable

I have a DataGridView whose datasource is a BindingList. MyObj has a few nullable properties (like int? and DateTime?) I want to implement sorting to my binding list, so the DataGridView can sort the column when the user clicks on the column header. After some digging around, I found and followed the answer of this question (http://sta...

Is PowerShell a bottleneck

I'm working on a .net application that needs interact with Exchange, specifically creating Exchange objects. Its a web based application, but will have a back end running as a service on the Exchange server. I'm trying to decide the best way to interact with Exchange. My initial thoughts was to use powershell, with some sort of service ...

Need to save block of data in ASP.NET between page refreshes in web farm without using inprpc or state server

I have an asp.net application running in a server farm. So In-proc sessions are out. There's no state server. There's a sql server database (can't be used for state server). There's no forcing same web server serving capabilities so no guarantee which web server will serve next page. I need to save a block of data (big object state) be...