.net

including regex expressions in XML?

I'm trying to set up a situation where a regular expression can occur in xml I know that the xml parser will complain on several key values (namely, < and &) and from what i understand, attributes can not support CDATA tags. however since in .net the lookbehind uses the < character, things become more difficult. What's the best way t...

Effect of implementing IDisposable on classes that don t need it?

I running my static analysis checks again and I'm getting 100s of nags on Label foo = new Label(); //Where this is an ASP.NET web forms label Do I need to call dispose on these web forms labels? Also, how late in the page life cycle is it safe to call Dispose on these? If a class implements IDisposable, but doesn't actually do anyth...

Does using the default ActiveDirectoryMembershipProvier.ChangePassword method alert the PCNS?

We've got a Identity Lifecycle Management 2007 Feature Pack 1 server setup that is syncing our student email accounts with live@edu. We want to allow the students to change their password via the web. When I use the default "ChangePassword" method inside of the ActiveDirectoryMembershipProvider, it does not trigger the password event t...

Sort Datatable/Dataview/Gridview of files based on File Modified Date

I have a page which lists all the files in a particular folder (all PDFs), using a data-table and gridview. I'm currently sorting this table by the filename (by using a dataview), which isn't that helpful, and I want the gridview of files sorted by the file created or file modified date (as recorded in Windows). If that's not possible,...

Is there a way to change the order of constructors listed in IntelliSense in Visual Studio?

I have defined a class with multiple constructors so that the underlying interfaces are immutable once the object is instantiated. I would like one of the constructors to be the "default" constructor for when a user types the following in Visual Studio: var obj = new MyClass( Dim obj As New MyClass( Currently when I go to instantiat...

mplayer slave mode - can't delete files after watching

Hi I'm using mplayer in my C# app running in .NET on Windows and Mono on Linux. I start mplayer using Process.Start and run it in -slave -idle. To play a video, I write to stdin like this: loadfile {filename} When I'm ready to play the next video, I call loadfile again with the new filename. Problem: if I play a video and then somet...

Convert string to Color in C#

A am encountering a problem which is how do I convert input strings like "RED" to the actual Color type Color.Red in C#. Is there a good way to do this? I could think of using a switch statement and cases statement for each color type but I don't think that is clever enough. ...

ASP.NET UpdatePanel + Wizard Problem

Hello. I'm having troubles on an ASPX form using two ASP default components; The default components are the UpdatePanel (The one that is having troubles I believe) and the Wizard that works fine in many browsers. The form with both components works fine on Firefox but crushes at the second step of the wizard. Is there a documented bug...

Making a graphical element "dock-like"

Specifically, what I am try to is overlap my element on top of everything, including the desktop, similar to the taskbar in Windows. I have a Windows Form Control that looks kind of like a tab. its like 50px wide by like 150px in length. What I would like to do is have that control appear in front of all windows, including the desktop it...

HowTo: Draw a line with an arrow?

I have the following code, that draws me a line with a (very) smile arrow... private void Form1_Paint(object sender, PaintEventArgs e) { Pen p = new Pen(Color.Black); p.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor; e.Graphics.DrawLine(p, 10, 10, 100, 100); p.Dispose(); } I want to ...

c#.net source code

is it possible to see the source code of C# library implementations? such as List or Dictionary implementation source code. ...

How to start programming from scratch?

I've never really had any experience with programming at all, my uncle told me to come to this site for help from total strangers if I wanted to start programming. I know the names of a couple of languages but I don't really know anything at all. I'm fourteen and I can type fast if that counts for anything. One of my uncles wanted me ...

(Why) Is Reflection so expensive in .Net?

Possible Duplicate: What is the cost of reflection? Does anyone have a good explanation of the generally accepted mantra that reflection == bad performance? For example, how expensive is it to iterate over a type's properties collection and extract all property values from an instance of this type compared to just accessing ...

Help me give Entity Framework Navigation Properties meaningful names, not User{1,2,3,4,...}

I have inherited a medium sized database that we are trying to use with Entity Framework in a MVC2 rewrite we are working on. We used the existing database to generate the data model (.edmx file) and all was good. Until I realized that I could not use the dot notation access all the fields. appointment.Employee.name // works fine app...

placing a shortcut in user's Startup folder to start with Windows

I wanted to give my user an option for "Start with Windows". When user check this option it will place a shortcut icon into Startup folder (not in registry). On Windows restart, it will load my app automatically. How can this be done? ...

Convert A XNA Color object to a string

I know how to convert a string to an XNA Color object, but how do I convert a C# Color object like Color.Blue into its string representation(e.g. "Blue"). ...

Changing method of connecting to server C#

I need to change how my C# application connects to a server to send a request and get a response. I'm not great with C# so I apologize if this explanation is confusing. Currently the program appears to use some magic that uses static information from the app.config file: <configuration> <system.serviceModel> <client> <!-- i...

Separating visual attributes from data classes?

I'm trying to figure out the right way to do this. I have a WinForms app that is using a PropertyGrid as one of the controls; I'm using the .SelectedObject property to assign the appropriate object to display attributes for. The PropertyGrid uses declared attributes against this object's class properties to determine visual things, e....

Why delegates generated dynamically from expressions are slower than hard-coded lambdas ?

I would have expected delegates generated from expression trees to achieve roughly the same performance as hard-coded, static, equivalent anonymous methods. However, it seems that dynamically generated delegates are noticeably slower... Here's a simple test program to illustrate the case. It just accesses 3 properties of an object 10000...

.NET app with CR Viewer getting 401 unauthorized on toolbar resources

Hi - I just migrated my .NET MVC 3.5 sp1 app to a VPS running 2008x64 and IIS7. My app uses a Crystal Report Viewer to dynamically display reports. I was able to get the reports to display properly after installing the CR runtime CRRedist2008_x64.exe. From past experience I also copied the aspnet_client folder to the root of my app on th...