.net

how to update assemblyBinding section in config file at runtime?

I'm trying to change assembly binding (from one version to another) dynamically. I've tried this code but it doesn't work: Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); ConfigurationSection assemblyBindingSection = config.Sections["assemblyBinding"]; assemblyBindingSec...

Wanted : review of collection libraries features / issues / performance

I know there are couple 3rd party collection libraries out there (C5, PowerCollections and I guess loads more of other not so complete libraries) as well as the System.Collections.Generics classes. I am however quite unsure which library use to when. I have tried the C5 collections, but some sources claim that they are slower then the de...

Where can I get a VB.net - WPF - Trending Graph Control.

We're trying to show 4 trend graphs and will be adding data to them them at a rate of about 1 point every second. In the end each trend needs to show around 600 points. Currently we are using the graphing tools from Syncfusion but they are unable to redraw the graphs at the speed we require. I believe the issue is due to the fact tha...

How to find out which version of .NET Framework executable needs to run?

I've got an executable file, and I would like to know which versions of the .net framework this file needs to be started. Is there an easy way to find this information somewhere? (So far I tried ildasm and dumpbin without any luck) ...

Getting actual file name (with proper casing) on Windows with .NET

I want to do exactly the same as in this question: Windows file system is case insensitive. How, given a file/folder name (e.g. "somefile"), I get the actual name of that file/folder (e.g. it should return "SomeFile" if Explorer displays it so)? But I need to do it in .NET and I want the full path (D:/Temp/Foobar.xml and not just F...

variable.ToString() vs. Convert.ToString(variable)

Let's say I have an integer that I need to convert to a string (I might be displaying the value to the user by means of a TextBox, for example. Should I prefer .ToString() or Convert.ToString(). They both do the same thing (don't they?). int someValue = 4; // You can do this txtSomeValue.Text = someValue.ToString(); // Or this... txt...

How to control Video Cam connected to Firewire using a program

Hi I need to control (play,rewind,stop) my Video Cam connected to firewire of my PC Is this possible. My program is written in .NET Thanks Anon ...

How do you reflect on a Linq extension method with a Func<TSource, bool> parameter?

I am trying to get a MethodInfo object for the method: Any<TSource>(IEnumerable<TSource>, Func<TSource, Boolean>) The problem I'm having is working out how you specify the type parameter for the Func bit... MethodInfo method = typeof(Enumerable).GetMethod("Any", new[] { typeof(Func<what goes here?, Boolean>) }); Help appreciated. ...

Defining templates for common look and feel pragmatically

I have a new project which simply put, is an attempt to formalize the look and feel of all of our departmental pages. I Googled around and found many tutorials which discussed the pros and cons of several techniques. And from what I've been reading, the thing I'm ooking for is controls. Basically, I want a common header and footer. <hea...

Is query to new added object possible in MS Entity Framework

Is there a way to query or just access newly added object (using ObjectContext.AddObject method) in Entity Framework? I mean situation when it is not yet saved to data store using SaveChanges I understand that queries are translated to underlying SQL and executed against data store, and it don't have this new object yet. But anyway, I'm...

How to make a folder in windows explorer activate an external application?

Hello, I need to create an application that when a user copies a file into an specific folder, my application will be activated and the file will be changed, also, when the user reads back any file in the folder, changes will also be made to the file. Is it possible? I'll use .net for this. I think the folder C:\WINDOWS\assembly is s...

How will locking behave in .net?

abstract class Foo { private List<Object> container; private bool update; Foo Foo() { container = new List<object>(); update = false; } public abstract Bar CreateBar(); public void BeginUpdate() { if (!update) { Thread update_thread = new Thread(new ThreadStar...

How do I create this expression tree in C#?

I am trying to create an expression tree that represents the following: myObject.childObjectCollection.Any(i => i.Name == "name"); Shortened for clarity, I have the following: //'myObject.childObjectCollection' is represented here by 'propertyExp' //'i => i.Name == "name"' is represented here by 'predicateExp' //but I am struggling w...

Changing connection string at runtime in Enterprise Library

Is there a way to change the connection string of a DataBase object in Enterprise Library at runtime? I've found this link but its a little bit outdated (2005) I've also found this but it seems to apply to .Net in general, I was wondering if there was something that could be done specifically for EntLib. I was just passing the connecti...

Retrieving a byte array stored in a INT field in the database

Hi, how do I retrieve the byte array stored in an integer column in my database? Do I first case it as int, then as byte[] ? byte[] permissions = (byte) Convert.ToInt(dr["myField"]); ? ...

C# Financial Functions library

I'm looking for an open source C# .NET Financial Functions library. Something that does IRR (Internal Rate of Return) and other common functions that are available in applications like Excel. Suggestions? ...

How to detect if two files are on same "volume"?

I'm trying to use System.IO.File.Replace to update a file, and it's throwing System.IOException if the destination file is on a NAS. According to MSDN, if the destination file is on a different volume, this method throws an exception. It's right, but how do I detect if two files are on "different volumes"? Path.GetPathRoot returns diff...

XmlSerialization of collections

I want to serialize the following Xml structure: <XmlRootElement> <Company name="Acme Widgets LLC"> <DbApplication name="ApplicationA" vendor="oracle"> <ConnSpec environment="DEV" server="DBOraDev1201" database="AppA" userId="MyUser" ...

Do I need to specify a SQL data type when using a SqlCommand?

Is there any provable reason why I should always specify the SQL data type for SqlCommand paramenters? ...

Hopefully simple question about modifying dictionaries in C#

I have a huge dictionary of blank values in a variable called current like so: struct movieuser {blah blah blah} Dictionary<movieuser, float> questions = new Dictionary<movieuser, float>(); So I am looping through this dictionary and need to fill in the "answers", like so: for(var k = questions.Keys.GetEnumerator();k.MoveNext(); ) { ...