.net

What is wrong with Polling

I have heard a few developers recently say that they are simply polling stuff (db, files etc) to determine when something has changed and then run a task, such as an import. I'm really against this idea and feel that utilising available technology such as Remoting, WCF etc would be far better than polling. However, I'd like to identify...

How does Copy-local work?

I am wondering what copy-local=true for references exactly does. Does it copy the referenced assembly along with all of its dependencies to the output directory? My scenario is the following: I have a custom log wrapper that utilizes log4net. I build a release assembly of MyLogWrapper.dll with log4net.dll reference set to copy-local tru...

Is there a quick way to generate a <%@Register...%> line for a user control?

I make a user control and then want to include it on a page I have to always manually type the @Register line at the top of my .aspx file, e.g. <%@ Register TagPrefix="edward" TagName="GetQuote" src="~/Controls/GetQuote.ascx" %> Is there any way to automatically create these @Register lines? (I tried dragging in the .ascx file fro...

are conversion operators only applicable to numeric types .net

Hi, I was wondering whether overriding conversion operators is only applicable to numeric types? If not in what instances would the implicit or explicit conversion operator be applicable to other value types or reference types. An example would be great. Thanks ...

SAFE Pointer to a pointer (well reference to a reference) in C#

In a C# application I am working on I have a very long identifier as follows:- foo.bar.bwah.blah.whatever.very.very.huge Whenever I to reference this object it's an absolute nightmare, and unfortunately I do need to reference it a lot:- var something = foo.bar.bwah.blah.whatever.very.very.huge.a; var somethingElse = foo.bar.bwah.blah...

Directory/File Permission Issue

Hello, I wrote code to set permission of the folder. Function I developed was public void SetPermission(string user,FileSystemRights rights) { DirectoryInfo dInfo = new DirectoryInfo(folderPath); DirectorySecurity oDirectorySecurity = new DirectorySecurity(); oDirectorySecurity.AddAccessRule(new FileSystemAccessRule(user...

Check status of process

I want to programmatically verify the status of an application to see if it has crashed or stopped. I know how to see if the process exists in C# but can I also see if it is "Not responding"? ...

Do modern-day VisualStudio .NET projects still use Visual SourceSafe, or SVN?

I'm getting back into .NET after numerous years in PHP/MySQL back in 2002 on Microsoft projects we always used Visual SourceSafe and everyone hated it in all my PHP/MySQL projects we used SVN and everyone loved it in modern day .NET projects do teams still use Visual SourceSafe, has it improved? or has (hopefully) SVN become a standar...

DotNet version of Windows Scripting Host

Good morning, I work in a small shop (only two of us) and we currently manage more .vbs scripts that we would like to (we would like to manage zero). One of the nice things about these scripts is that it's quick to make changes (as necessary) and go back to our day jobs. That's all nice and good until we decide that the job needs to...

.net: threading debug

What are some of the techniques available to debug multi threading issues in .net environment. ...

Is the order of an arraylist guaranteed in C#.NET?

If I'm using an ArrayList in C#.NET, is the order guaranteed to stay the same as the order I add items to it? ...

How to open a password protected shared network folder using VB.NET?

I need to open a password protected shared folder on a network to gain access to an Access 97 database. How do I open the folder and pass in the password? Thanks, ...

How can I make the computer beep in C#?

How do I make the computer's internal speaker beep in C# without external speakers? ...

How do I debug IL code generated at runtime using Reflection.Emit

Hi, I am trying to generate some code at runtime using the DynamicMethod class in the Reflection.Emit namespace but for some reason its throwing a "VerificationException". Here is the IL code I am trying to use... ldarg.1 ldarg.0 ldfld, System.String FirstName callvirt, Void Write(System.String) ldarg.1 ldarg.0 ldfld, System.String Las...

WPF PasswordBox: How do I warn a user that Caps Lock is enabled?

Does anyone know how to implement the standard bubble message that warns users whenever Caps Lock is enabled and a password control has focus? Is this built into the .NET framework or do I need to write my own class to do this? Thanks. ...

How to customize an Execute method of ObjectQuery?

I have a partition-like database schema in my database. There's one 'partitioning' table named SITE and every other table has a foreign key to that table (SITE_FK). I wrote a partial class for an ObjectContext adding a SITE_ID property and a constructor that sets this property. Now, after I instantiate an ObjectContext with some SITE_I...

How do I get rid of the red rectangle when my wpf binding validation has failed and the containing panel is no longer visible?

I have a situation where I am using wpf data binding and validation using the ExceptionValidationRule. Another part of the solution invovles collapsing some panels and showing others. If a validation exception is set - i.e. the UI is showing a red border around the UI element with the validation problem, and the containing panel is col...

Reading email from a mail file

I have a huge number of mail archives that I want to de-duplicate and sort out. The archives are either in mbox format or contain a single mail message. To add a bit of complication, some of the files have windows EOL sequences, and some have the unix EOL. Using C#. how do I read an archive and split it into its individual messages, or r...

Best Practices for 3 Tier Development

Does anyone know of any documentation by MS or someone else that lays out the best practices for developing a 3 tier architecture in ASP.NET. I am in the process of trying to convince my boss that the current architecture needs rethought and reworked to provide a flexible and reusable system. I have found a lot of generic documentation...

Drag and Dropping an Object Reference VB.Net

I am trying to 'swap' two cells' contents, and their mappings. To do this, I need to drag and drop a reference to the cell as opposed to the string value itself. I can then use this reference to update a Dictionary as well as get the value. It allows allows me to do the swap as I will have a reference to the old cell to add the value nee...