.net

Best way to avoid SQL injection on MSSQL Server from C# code using Linq?

What is the best way to avoid SQL injection on MSSQL Server from C# code using Linq? Should you use a function to strip of security issues or is it handled by the framework? ...

DataGridView sort and e.g. BindingList<T> in .NET

Hi Folks I'm using a BindingList<T> in my Windows Forms that contains a list of "IComparable<Contact>" Contact-objects. Now I'd like the user to be able to sort by any column displayed in the grid. There is a way described on MSDN online which shows how to implement a custom collection based on BindingList<T> which allows sorting. But ...

System.UnauthorizedAccessException when running a test in VS2008

When I run selenium tests (written as nunit tests) from VS2008 I am getting System.UnauthorizedAccessException : Access to the path /bin/Debug is denied. The test is trying to read a entry in App.Config( this file is copied to bin/Debug during compilation). I used unlocker to check file handles and it is VS2008 that has a handle to that ...

As a .NET developer, what exams other than the Microsoft ones are worthwhile?

Hi, I am a developer with no formal training. Having taught myself, I have come quite far but I am consolidating my experience with a lot of practise in making systems of varying sizes and complexity. I am revising for the 70-536 exam because it will make me really appreciate the fundamentals of .NET (surprisingly there were a few smal...

Application Pool from C#

Hi, How can I restart(recycle) IIS Application Pool from C# (.net 2)? Appreciate if you post sample code? Thanks, ...

WPF: How to apply a GeneralTransform to a Geometry data and return the new geometry?

Having some Geometry data and a Transform how can the transform be applied to the Geometry to get a new Geometry with it's data transformed ? Ex: I Have a Path object that has it's Path.Data set to a PathGeometry object, I want to tranform the points of the PathGeometry object in place using a transform, and not apply a transform to the...

Writing my own Auto Updater

When writing my own auto updater, is there a general framework that I should be following? A while ago I was reading up on how one should create a 'boot strapper' that will load first before the main application (since a running appilation can't be updated due to file locks etc.) So any tips/best practices for this? ...

Are LINQ expression trees Turing complete?

As they are in .Net 3.5. I know they are in 4.0, as that's what the DLR works with, but I'm interested in the version we have now. ...

Where does Console.WriteLine go in Debug?

I found this question, but what I want to know is different - does the output from Console.WriteLine go anywhere when debugging? I know that for it to go to the output window I should should Debug.WriteLine() or other methods, but where does the standard Console.WriteLine() go? Edit When debugging, you don't see the black console window...

Should return values and arguments for public methods only be types from within the same assembly?

I am wondering what are the best practices for public methods and their return values. Is it ok to return types from referenced assemblies or should I make sure that all the parameters as well as return values are all from within the same assembly? The reason I ask is that I am in the process of merging assemblies with ILMerge and I wo...

Best practices for merging assemblies?

I am wondering what are the heuristics when creating releases of libraries to be included in other projects in relation to dependencies and if I should include them or not. My problem is the following: I have a CommonUtilities library that provides as the name implies a set of utilities that can be used in more than one place. Dependen...

Inversion of Control with .net

It's rare that I hear someone using Inversion of Control (Ioc) principle with .Net. I have some friends that work with Java that use a lot more Ioc with Spring and PicoContainer. I understand the principle of removing dependencies from your code... but I have a doubt that it's so much better. Why do .Net programmers not use (or use les...

VB.NET: Are events raised even if there are no event handlers?

I have a class that downloads, examines and saves some large XML files. Sometimes I want the UI to tell me what's going on, but sometimes I will use the class and ignore the events. So I have placed lines of code like this in a dozen places: RaiseEvent Report("Sending request: " & queryString) RaiseEvent Report("Saving file: " & fileNa...

Shortest code to calculate list min/max in .NET

I'd like something like int minIndex = list.FindMin(delegate (MyClass a, MyClass b) {returns a.CompareTo(b);}); Is there a builtin way to do this in .NET? ...

How do I add icons next to the nodes in a WPF TreeView?

I have a WPF TreeView with just 1 level of items. The TreeView is data bound to an ObservableCollection of strings. How can I ensure that the same icon appears to the left of each node in the TreeView? ...

MySqlCommand Parameter not Working

In the following code, used to get a list of products in a particular line, the command only returns results when I hard code (concatenate) productLine into the SQL. The parameter substitution never happens. + "lineName = '@productLine' " + "and isVisible = 1 "; MySqlDataAdapter ad...

How do you unit test private methods?

I'm building a class library that will have some public & private methods. I want to be able to unit test the private methods (mostly while developing, but also it could be useful for future refactoring). What is the best way to do this? ...

Which Inversion of control (IoC) containers support .NET 1.1?

(see title) ...

Is anyone aware of any .NET OpenID Provider sample code that might exist?

I need to implement an OpenID Provider in .Net and wondered....Is there's any OpenSource code already written and available? ...

Dotfuscator community edition

Hi, I tried to use this on my class library "mylib.core.data.dll" and got a successful obfuscation, however, when I import this dll into another project via "Reference" and tried imports --- My library "mylib.core.data.dll", doesn't show except for "e" and "h". Can someone tell me what I missed during the obfuscation process? Thanks ...