.NET instant out of scope notification?
In .NET, is there a simple way for a class to be notified as it falls out of scope? ...
In .NET, is there a simple way for a class to be notified as it falls out of scope? ...
I have a windows form that can be moved around by clicking and dragging on any portion of the form. I used the method of overriding WndProc, and setting the result of the NCHITTEST function to be HTCAPTION, in order to fool the form into thinking I clicked the caption - so it enables dragging. The code for this works great, and is be...
how can i access the summary of a file like music file (any format) and edit it and especially the artwork of this file(the photo that are included in the file) and edit it too? thanks. ...
I am making most of my basic types in my app, immutable. But should the collections be immutable too? To me, this seems like a huge overhead unless I am missing something. I am talking about collections to hold Point3 values, etc which can be added as it goes at different times. So if there are 1M values in a collection, and you needed ...
I have implemented a custom section in my app.config file and am accessing it using ConfigurationSection and ConfigurationElement. When the application starts all data is retrieved correctly. If I manually change the values in the app.config file then my application later calls ConfigurationManager.RefreshSection I still receive the or...
In windows when you click on an icon on your desktop, the icon darkens with a shade that is based on your windows theme that is currently used. I have a custom control that displays an image. I would like to have the same functionality as the windows icon click. How do I obtain the same result in WinForms by selecting my custom control...
I need this to make the finally blocks run /after the debugger breaks at the throw point/. BTW I know how to make it never break on an exception, but I don't want that. ...
Is there an API for loading a large # of non-transactional rows directly into a DB2 table? I know there are some CLI commands for doing this, but it isn't clear what is directly supported from the .Net APIs. ...
I have to following code in VS2008 .net 3.5 using WinForms: byte percent = 70; byte zero = 0; Bitmap copy = (Bitmap)image1.Clone(); ... Color oColor = copy.GetPixel(x, y); byte oR = (byte)(oColor.R - percent < zero ? zero : oColor.R - percent); When I leave the "(byte)" off the last line of code, I get a compiler error saying it "Ca...
I want to write a data access layer for a file based database behind a data driven website. There would be lots of concurrent update and reads going on, I'd like at the very least that access be serialized, so that page request would get in a nice orderly line. What WCF configurations would get me what I want? Does PerSession concurre...
I have come up with the following method to determine is a database is up and running. This trys to open a database connection and if it fails it return false. private static bool IsDatabaseConnectionUp(string connectionString) { System.Data.SqlClient.SqlConnection conn = null; try { conn = new SqlConnection(connec...
I have a C library which I need to call from an ASP.NET / C# app, how do I go about doing this? ...
We have written a C# command line app that gets run as the first step in a script that is executed when users launch our CRM system on citrix (it is a published app). The purpose of the command line is to find the outlook icon on the system tray and hide it. We do this via PInvoke calls to various WIN32 methods and it works great when ...
OK, here's what I'm doing distilled to only the System.Management calls: Simple queries and Method invokes work over the same connection. This query won't. And the file exists on the remote machine. Clues? myQuery = "Select * from CIM_DataFile Where Drive = 'C:' AND Path = '\\Users\\someguy\\Documents\\' AND FileName = 'Default' AND Ex...
I'm trying to figure out how to use the System.Net.WebRequest class to send my credentials when the Apache server has a .htaccess file protecting access. It appears to be something to do with the Credentials property (imagine that!) but I am not sure how to create the correct ICredentials object. Sample code = accepted answer. ...
I'd like to invoke the user's screen saver if such is defined, in a Windows environment. I know it can be done using pure C++ code (and then the wrapping in C# is pretty simple), as suggested here. Still, for curiosity, I'd like to know if such task can be accomplished by purely managed code using the dot net framework (version 2.0 and a...
Is there a method to validate URLs in .Net (or ASP.Net, or ASP.Net MVC)? ...
The closest I could find to this question was this one: http://stackoverflow.com/questions/26733/getting-all-types-that-implement-an-interface-with-c-3-5 But that is for use in code, and to use it I'd have to change the code, recompile and run. I was wondering if there is a simpler way for me to just lookup all classes that implement a ...
When running a web service in Cassini I get this error: The specified module could not be found. (Exception from HRESULT: 0x8007007E) How can I tell exactly which file cannot be found? I've tried ProcMon but I don't see any obvious way there to decide which is the actual error in the thousand of lines it generates. Saw a post about fu...
Hello, Have a long running set of discrete tasks: parsing 10s of thousands of lines from a text file, hydrating into objects, manipulating, and persisting. If I were implementing this in Java, I suppose I might add a new task to an Executor for each line in the file or task per X lines (i.e. chunks). For .Net, which is what I am usi...