.net

How might I convert a Rectangle to a RectangleF?

What is the easiest way to convert a Rectangle to a RectangleF in .NET? Edit: This sounds trivial and it is, but I was trying to save some typing. The best I could come up with: RectangleF rdest(rsrc.Location, rsrc.Size); // C++/CLI ...or... RectangleF rdest = new RectangleF(rsrc.Location, rsrc.Size) // C# ...

execute/open a program in c#

Hi all, Is there a solution/references on how to open or execute certain window programs in C#? For example if i want to open WinZIP or notepad application? Example on the line of codes are more helpful. But anything are welcomed. thank you. ...

C# WebClient with https

Hello everyone, I want to use https to upload a file using WebClient's UploadData method. And I want to ignore server side certificate verification (always accept server certificate and only use encryption feature of https). I have tried hard but cannot find a similar sample. Could anyone advise me how to implement? Any reference sampl...

Ignore missing dependencies during ReflectionOnlyLoad

I am working on a simple class browser dialog that allows users to open an assembly and choose a static method from within. However, there are some situations where the assembly's dependencies are missing. Since I only need the method name and not its full prototype, is there any way to get past the FileNotFoundException that is raised ...

Tree Data Structure

I am looking for a tree implementation... you can see the me previous question here. but I won't like to implement it myself, example functionalities needed: I need FindElement(node) I need GetParent(node) - will do the find again GetSubTreeFrom(node) - will find the element and return a subtree.. I know C5 - but all the trees there...

.NET memory leak?

I have an MDI which has a child form. The child form has a DataGridView in it. I load huge amount of data in the datagrid view. When I close the child form the disposing method is called in which I dispose the datagridview this.dataGrid.Dispose(); this.dataGrid = null; When I close the form the memory doesn't go down. I use t...

Benefits of Thread.ResetAbort

When a thread is canceled via Thread.Abort() a ThreadAbortException is thrown inside the Thread Thread.Abort was called on. This leads the thread to immediately stop its work and the exception bubbles up the call stack until it leaves the thread's main method. This causes the thread to be aborted. What are the benefits of an ExceptionHa...

looking for WCF basicHttpBinding https tutorial or samples

Hello everyone, I am using VSTS 2008 + .Net 3.5 + C# to develop a console application as a WCF cient, and host WCF service in IIS 7.0 at server side (server using Windows Vista x64). Currently, my WCF client and server works quite well with http. Now I want to add https support and still use basicHttpBinding. Any easy to learn tutorial...

Not able to cast string to int. Error msg: Input string was not in a correct format.

I havethe following code which outputs the number '40': Hashtable ht = new Hashtable(); ht.Add("numRooms", pageData.Property["romtotalt"].ToString()); string str = ht["numRooms"].ToString(); lblMigrate.Text = i.ToString(); Then I try to convert the string to an int, and I get an exception / error: Hashtable ht = new Hashtable(); ht.A...

Server side font library

Hi, I am looking for a library that enables generation of a swf file in .Net containing embedded glyphs for one or a couple of fonts. It is for use in scenarios where Chinese characters are used. It is impossible to use a conventional font swf since it weights around 5-8 MB. I have looked at SwfDotNet and it might do the trick... but t...

What is the use of Field.Set OmitNorms(true); in lucene

Hi All, I have been suggested to use Field.Set OmitNorms(true); when creating the documents for lucenesearch to sort the result according to the number of hits, but I am not clear of what it does and is it safe. sort the result according to the number of hits means that the document in which search text is found maximum number ...

Should I use DuplicateKeyException in my own non-LINQ code?

I'm writing an auditing service for some business-critical operations. The service is being implemented using the IoC pattern: public interface IAuditWriter { void WriteAction(int key, string value); } Because of this, I need it to raise exceptions which are not specific to the implementation. Part of the information in the audi...

Deserializing data from file. Performance issue

I read a table with more than 1 million records from a database. It takes 3 minutes until I have a populated object in memory. I wanted to optimize this process, and serialized this object to a file using binary BinaryFormatter. It created a file with 1/2 GB size. After I deserialized this file back to memory object. This took 11 minutes...

WCF: using streaming with Message Contracts

Hi, I am trying to use the WCF streaming with Message Contracts, because I need additional parameters beside the stream itself. Basically I am creating a file upload and download service, with some additional logic on top. Unfortunately, when I try to hit the service from the browser to check that everything is all right, I get the fo...

Strange 64/32-bit GUID issue under IIS7

One of my team has recently come across an interesting glitch in the matrix. If anyone can help explain this it'd be great. It is possibly a complicated to explain, so bear with me. We are building an ASP.Net application. In it we have a simple "if" statement. Guid adminId = Guid.Empty; if (mRoles.Contains("Admin")) { adminId = mU...

Is there a way to package more than one .NET assembly in a dll?

I'd like to keep my components/assemblies clearly separated from a source code point of view but I also need in some circumstances (probably not relevant to expand) to package them in the same dll. Is it possible to package a number of .NET assemblies in a single dll? If so, How? IF possible, do you think it is a good idea? Why? Any ...

How can I prevent AppDomainUnloadedException after NUnit tests PLINQ code?

How can I diagnose and minimize or prevent AppDomainUnloadedException? NUnit 2.5.2 consistently throws AppDomainUnloadedException after long (>10s) tests involving PLINQ. Back in July 2008, Stephen Toub said: Yes, the scheduler in the CTP doesn't handle thread aborts very well, which frequently causes the process to crash when...

Free Application Lifecycle Management Tools for .NET Development

I would like to achieve the following: I want a free Application Lifecycle Management (ALM) environment surrounding vs2008 sp1. (My company is short of cash). I want all the stuff: CI, BugTracking, task panel, Wiki, Source control... all integrating themselves. If I could have some kind of scrum managing tools it would be better. Any ...

WPF - How to force a Command to re-evaluate 'CanExecute' via its CommandBindings

I have a Menu where each MenuItem in the hierarchy has its Command property set to a RoutedCommand I've defined. The associated CommandBinding provides a callback for the evaluation of CanExecute which controls the enabled state of each MenuItem. This almost works. The menu items initially come up with the correct enabled and disabled...

Configure unity with one config file for multiple applications

I have two closely related applications that are both using the Unity IoC container. They have some custom types in common, but not all of them. At the moment I have two config files that have a lot of duplication. I'd like to have just one Unity config file to rule them all. However, as not all types exist in both applications Unity i...