.net

Why am I getting a FileNotFound exception when referencing another project from the same solution?

I am learning how to use NUnit. I have my main project in it's solution, and created a separate project in that same solution which will hold my unit tests, with it's own namespace. From that project I add a reference to the main project and add a using MainProjectNamespace; to the top of it. When I go to NUnit, any tests I have t...

Whitelist Model Binding doesn't seem to work with complex properties

I have a POST action that looks like this: public ActionResult Create([Bind(Include="userrole,credentials.emailAddress,credentials.password")]User u, string confirmPassword, bool agreeToTerms) I'm using the default model binder and credentials is a property on my User object. Credentials has two fields (emailAddress & password). If I ...

Can a generic class be forced to have a type inherit from one of two interfaces?

I have a generic class, but I want my type to be forced to inherit from either one or the other interface. For example: public class MyGeneric<T> where T : IInterface1, IInterface2 {} The above will force T to inherti from both IInterface1 and IInterface2 but can I force T to inhert from IInterface1 OR IInterface2 (or both)? ...

LINQ Inner-Join vs Left-Join

Using extension syntax I'm trying to create a left-join using LINQ on two lists that I have. The following is from the Microsoft help but I've modified it to show that the pets list has no elements. What I'm ending up with is a list of 0 elements. I assume that this is because an inner-join is taking place. What I want to end up with is ...

.NET remoting threading model

Hi, I would like to know how threads are handled on the server side using MarshalByRef objects. Given my remoted MarshalByRef class: public class MyRemotedClass : MarshalByRef { public int MyInt; public string MyString; } Client code (single threaded): MyRemotedClass m = GetSomehowMyRemotedClass(); m.MyInt = 5; // Write operat...

Best way to allow the User to define a Table’s Order?

Best way to allow the User to define a Table’s Order? We are using SQL Server 2005 and DevExpress controls. We have a table that contains the following: Process A Process B Process C Report A Report B Report C We want to allow the user to change the order to anything they want. Here is one example: Process C Process A Proce...

The Best Place to Start Learning C++

So I have been a .Net developer for the past decade and am thinking of learning either C or C++ (with a strong preference to C++). Does anyone know a good place where a C# fanboi can get started learning C++ (or C)? With so many tutorial sites on the web, it hard to know where to start, and if there is one which might be more accomodat...

Possible to extend the String class in .net

How to override or extend .net main classes. for example public class String { public boolean contains(string str,boolean IgnoreCase){...} public string replace(string str,string str2,boolean IgnoreCase){...} } after string aa="this is a Sample"; if(aa.contains("sample",false)) {...} is it possible? ...

Using Reflector, why can't I see the app.manifest embedded in my .NET app?

I have a WinForms .NET app that, according to the Vista Task Manager with UAC enabled, runs with virtualization "Disabled" even though I do not recall adding a manifest with "asInvoker" to the app. VS.NET (this project has gone through all four versions of VS.NET) must have added the \Properties\app.manifest file I see in Solution Explor...

Detecting and restarting my crashed .NET application

How can I detect that my .NET application has crashed, and then restart it? ...

Bind POCO to UserControl

Hi I am in the process of writing my first .net gui. I am wondering if there is some specific way I need to apply to my poco objects for them to be bindable to a usercontrol. I have a few objects but I seem to be unable to bind them to my usercontrol. I read somewhere that they need to implement IBindable but I can't shake the feeling ...

Good MVC projects

I'm thinking of building a small web app using the MVC framework as a way to introduce myself to it. The idea of a project to get myself started is a small gambling monitoring piece of software that I can enter a a list of all my small bets I have along with other friends. Some of the things I hope to capture using this web app is: - log...

How can I scan MSIL code to find certain function calls

Hi all, I am to build a SOA gui framework, and I'd like to autodetect services, and service dependencies from client modules. I have code such as this so far, which works using attributes, placed on class modules: [ServiceProvider(typeof(DemoService3))] [ServiceConsumer(typeof(DemoService1))] I am wondering how I can scan for these a...

IronPython performance

I'm considering embedding IronPython as a scripting language for an application that I'm writing. So to try it out, I downloaded IronPython 2.0 and fired up the interactive interpreter. Just starting the thing up takes about 5 seconds on my Intel Quad Core with 6 Gigs of memory. I can hardly imagine how much of a delay this would be f...

Entity Framework: Loading Many to One entity

Say I have a role entity and a site entity. Now there are many roles to one site, so on the Role class there is a Site property that represents that relationship. If I wanted the roles for a site I would do this: Site.Roles.Load() Problems is, since the Site property on the Role class isn't a collection but just a single entity, the...

uint.MaxValue in .NET

uint x = uint.MaxValue - 100; The above line causes visual studio to report "The operation overflows at compile time in checked mode" I'm obviously missing something. Any ideas what? ...

What is the format (schema) of .NET PDB files?

What is the format (schema) of .NET PDB files? I'd like to parse the information out of these files so that I can display the correct lines of code (line numbers) in a debugging application. ...

Common causes of - Access Violation errors under .NET

I'm looking for common causes of Access Violation errors under .NET. Things I have checked so far - Call Dispose on all objects implementing IDisposable Check for valid arguments in calls to COM objects Explicitly remove all manually added event handlers DO NOT explicity call GC.Collect/GC.WaitForPendingFinalizers Add and Remove memor...

Common Causes of - Buffer Overflow Errors under .NET

I'm looking for common causes of Buffer Overflow errors under .NET. I know that buffer overflow is impossible under managed .NET code. However this exception is still possible in the scope of .NET application. Things I thought of - Valid arguments to COM object calls Valid arguments to PInvoke/Win32 calls What is the best method o...

IntPtr, SafeHandle and HandleRef - Explained

Without pointing me to MSDN, could someone give a concise, clear explanation of the purpose of each of these and when to use them. (IntPtr, SafeHandle and HandleRef) ...