.net

How do you add a web reference through a proxy/firewall?

I'm behind a firewall at work at the moment and I was testing something that I had deployed to my website, and the work proxy seems to be blocking it somewhat. Basically I am getting a message of: Operation is not valid due to the current state of the object I've got it down to my proxy interferring, but I can't see any advanced s...

.NET IPC without having a service mediator

I have two unrelated processes that use .NET assemblies as plugins. However, either process can be started/stopped at any time. I can't rely on a particular process being the server. In fact, there may be multiple copies running of one of the processes, but only one of the other. I initially implemented a solution based off of this arti...

IList.Cast<typeof(T)>() returns error, syntax looks ok

public static IList<T> LoadObjectListAll<T>() { ISession session = CheckForExistingSession(); var cfg = new NHibernate.Cfg.Configuration().Configure(); var returnList = session.CreateCriteria(typeof(T)); var list = returnList.List(); var castList = list.Cast<typeof(T)>(); return castList; } So, I'm getting a bui...

Comparing two byte arrays in .NET

How can I do this fast? Sure I can do this: static bool ByteArrayCompare(byte[] a1, byte[] a2) { if(a1.Length!=a2.Length) return false; for(int i=0; i<a1.Length; i++) if(a1[i]!=a2[i]) return false; return true; } but I'm looking for either a BCL function or some highly optimized proven way to do this. [Edit]Tha...

NHibernate ISession Flush: Where and when to use it, and why?

One of the things that get me thoroughly confused is the use of session.Flush,in conjunction with session.Commit, and session.Close. Sometimes session.Close works, e.g., it commits all the changes that I need. I know I need to use commit when I have a transaction, or a unit of work with several creates/updates/deletes, so that I can cho...

What's main differences between "new" ASP.NET MVC framework and typical Java Struts projects ?

I'm more a Java developer than a .Net guy but It seems to me that new Microsoft MVC's framework seems like typical combination of Java existing projects like : Struts (for handling the MVC), Hibernate (for object to SQL mapping, like LINQ), and URL rewriting to handle pretty URLs (that's less common). Also, It seems to me very simila...

When is Control.DestroyHandle called?

When is this called? More specifically, I have a control I'm creating - how can I release handles when the window is closed. In normal win32 I'd do it during wm_close - is DestroyHandle the .net equivalent? ...

Is there a built-in method to compare collections in C#?

I would like to compare the contents of a couple of collections in my Equals method. I have a Dictionary and an IList. Is there a built-in method to do this? Edited: I want to compare two Dictionaries and two ILists, so I think what equality means is clear - if the two dictionaries contain the same keys mapped to the same values, then...

What happened to to the .Net Framework Configuration tool?

Older versions of the .Net Framework used to install "Microsoft .NET Framework v1.0 / v1.1 / v2.0 Configuration" in the Control Panel, under Administrative Tools. I just noticed that there isn't a v3.0 or v3.5 version of this. Is this functionality now hiding somewhere else, or do I have to use the command-line tools instead? ...

C# Dynamic Form Controls

Using C# 2.0 what is the best way to implement dynamic form controls? I need to provide a set of controls per data object, so should i just do it manually and lay them out while increment the top value or is there a better way? ...

Override WebClientProtocol.Timeout via web.config

Is it possible to override default value of WebClientProtocol.Timeout property via web.config? <httpRuntime executionTimeout="500" /> <!-- this doesn't help --> ...

Is there a good WPF diagrammer / toolkit / provider ?

Basically we need a custom diagram component in our new WPF based application. Needs to show text/lines, linked 2D Nodes and custom images apart from the other diagramming features like Undo/Redo, Align, Group, etc.. ala Visio. The initial team did a bit of investigation and settled on the WinForms Northwoods GoDiagrams suite... a solut...

DefaultValue for System.Drawing.SystemColors

I have a line color property in my custom grid control. I want it to default to Drawing.SystemColors.InactiveBorder. I tried: [DefaultValue(typeof(System.Drawing.SystemColors), "InactiveBorder")] public Color LineColor { get; set; } But it doesn't seem to work. How do I do that with the default value attribute? ...

WPF control performance

What is a good (and preferably simple) way to test the rendering performance of WPF custom controls? I have several complex controls in which rendering performance is highly crucial. I want to be able to make sure that I can have lots of them drawwing out in a designer with a minimal impact on performance. ...

Targeting multiple versions of .net framework

Suppose I have some code that would, in theory, compile against any version of the .net framework. Think "Hello World", if you like. If I actually compile the code, though, I'll get an executable that runs against one particular version. Is there any way to arrange things so that the compiled exe will just run against whatever versio...

Do you know any graph visualization libraries for .NET?

Do you know any libraries that would handle displaying of graph structures in .NET? I'm looking for something similar to java libraries: jgraph or Netbeans Visual Library. I'd like to display objects as nodes in the graph. ...

Best way to use a property to reference a Key-Value pair in a dictionary

This is a fairly trivial matter, but I'm curious to hear people's opinions on it. If I have a Dictionary which I'm access through properties, which of these formats would you prefer for the property? /// <summary> /// This class's FirstProperty property /// </summary> [DefaultValue("myValue")] public string FirstProperty { get { ...

Can you use reflection to find the name of the currently executing method?

Like the title says: Can reflection give you the name of the currently executing method. I'm inclined to guess not, because of the Heisenberg problem. How do you call a method that will tell you the current method without changing what the current method is? But I'm hoping someone can prove me wrong there. Update: Part 2: Could ...

Real-time wmv video encoding in C#

How to encode video on the fly and send it trough the network from C#? Can't find a suitable library. I need to encode in WMV and don't mind if the actual encoding is made in C++ as long as the library has a .NET assembly available. Thanks ...

Can .NET check other running programs command line parameters?

We've got an interesting case where we are trying to determine how different instances of our app were launched. Is there any way for .NET to be able to query another running instance and get the command line parameters passed to that instance? I've not been able to find any way to do it in .NET so far, so I thought I'd check here to see...