.net

How can a class have no constructor?

Hi, A while back I asked about instantiating a HttpContext object. Now that I have learnt what I didn't know, what confuses me is that you cannot say HttpContext ctx = new HttpContext(); because the object does not have a constructor. But doesn't every class need a constructor? In C#, if you don't provide one, the compiler automaticall...

How do I set a Data Breakpoint in mixed( C#/C++ ) debugging?

I launch my program in C#, which then calls some unmanaged C++. When I break on a line in the unmanaged C++, the 'New Data Breakpoint' menu item is grayed out. Is there anyway around this? ...

Environment.TickCount vs DateTime.Now

Is it ever OK to use Environment.TickCount to calculate time spans? int start = Environment.TickCount; // Do stuff int duration = Environment.TickCount - start; Console.WriteLine("That took " + duration " ms"); Because TickCount is signed and will rollover after 25 days (it takes 50 days to hit all 32 bits, but you have to scrap the s...

How to map Dictionary<enum1,enum2> with Fluent Nhibernate

I was mapping a relation using something like the following <map name="Foo" cascade="all-delete-orphan" lazy="false"> <key column="FooId"/> <index column="FooType" type="Domain.Enum.FooType, Domain"/> <element column ="FooStatus" type="Domain.Enum.FooStatus, Domain"/> </map> The class is like this namespace Domain { public...

Assemblies and when strong naming is not an option?

A while back I asked the following question here on stackoverflow Assembly Names and Versions Now I have come to realize I can't sign my assembly with a strong name as one of the 3rd party dependencies is not a strongly named assembly and therefore mine is not signable. I have tried to simply change the assembly filename MyAssembly.dll...

When will my BackgroundWorker instance be garbage collected

consider this code block public void ManageInstalledComponentsUpdate() { IUpdateView view = new UpdaterForm(); BackgroundWorker worker = new BackgroundWorker(); Update update = new Update(); worker.WorkerReportsProgress = true; worker.WorkerSupportsCancellation = true; ...

How to use an app.config file when calling a C# dll from C++

How do I use an app.config file for the .Net part when calling a .Net dll from C++ and the data in the config-file must be read at the .Net runtime startup. If I use have a foo.dll.config that I call from ConfigurationManager.OpenExeConfiguration("foo.dll") I can access application settings. What I would like to do though is to change s...

How to read a PEM RSA private key from .NET

Hello, I've got an RSA private key in PEM format, is there a straightforward way to read that from .NET and instantiate an RSACryptoServiceProvider to decrypt data encrypted with the corresponding public key? ...

key down in .net

How to validate iscontrolkeys in textbox keydown event in .net? ...

programmatic login with .net membership provider

I'm trying to unit test a piece of code that needs a currently logged in user in the test. Using the .Net 2.0 Membership Provider, how can I programmatically log in as a user for this test? ...

HttpWebRequest over SSL?

I've used HttpWebRequests to post data to HTTPS websites before, and I've never had todo anything different than a regular HTTP Post. Does anyone know if there are any tricks involved that I missed to ensure that this is done properly? ...

How to change HttpApplication.User.Identity.Name on a local environment?

I have a site that requires Windows Authentication the application obtains the credential from the Security.Prinicipal once the user is autenticated the problem is that my credentials on my local environment are different that the ones stored in the DB and the user preferences cannot be obtain. i am doing the following workaround in orde...

How to create a WPF Shape Editor ?

I'm trying to create a WPF Shape (PolyLine) editor, which is a control that I want to use to, edit shapes in a canvas. What the editor needs to do is to be able to display the points and lines of the shape and to move those around. Can anyone provide me with a idea of how I can accomplish this, or a starting point? I haven't found anyt...

Subsonic: Comparing two columns instead of an input parameter

s it possible to do the following in subsonic. SELECT * FROM TABLE1 WHERE Column1 > Column2 or Column1 < Colum3 All examples that I've seen assume you now a value to pass to the where clause. I'm trying to do this without creating a view. Thanks ...

DataGridViewCheckBoxCell is broken for ->Value result

I'm using a DataGridViewCheckBoxCell but I can't figure out how to have the ->Value property working "correctly". for (int i = this->dgvConfigs->Rows->Count - 1; i >= 0 ; i --){ DataGridViewCheckBoxCell^ dgvcbc = (DataGridViewCheckBoxCell^) this->dgvConfigs->Rows[i]->Cells[2]; // This is truely a weird behavior of the DataGridViewCh...

Query antivirus definitions date?

Is it possible at all to query (WMI?) the virus defnintions date of definitions installed on remote computers? I'd like to start specificially with Symantec Endpoint Protection, and then branch out to other antivirus products. This is a WinForms, .NET project. ...

Deleting items from one collection in another collection

I've got two collections (generic Lists), let's call them ListA and ListB. In ListA I've got a few items of type A. In ListB I've got some items of type B that have the SAME ID (but not same type) as the items in ListA, plus many more. I want to remove all the items from ListB that have the same ID as the ones in ListA. What's the best ...

If I have two assemblies with the same name in the GAC, how do I tell .Net which to use?

I have two assemblies with the same name in the Global Assembly cache, but with different version numbers. How do I tell my program which version to reference? For the record, this is a VB.Net page in an ASP.Net web site. ...

How can I tell if my managed code is leaking memory due to native library calls?

I have a managed dll that calls into a native library. This native library generally returns IntPtrs. These can be passed in to other methods in the native library to do things, or to tell the library to free the instance associated with the IntPtr. But only some of the instances need to freed in this way, others are managed by the li...

Is there an alternative to string.Replace that is case-insensitive?

I need to search a string and replace all occurances of %FirstName% and %PolicyAmount% with a value pulled from a database. The problem is the capitalization of FirstName varies. That prevents me from using the String.Replace() method. I've seen web pages on the subject that suggest Regex.Replace(strInput, strToken, strReplaceWith, Rege...