.net

Capture email content

Does someone know how can i (using .net) capture the content of any incoming or outgoing email from all the free email providers? ...

XmlSerializer chokes on xsi:type?

EDIT: See Pavel's answer below -- the 'type not recognized error' was caused by a mismatch between the class heirarchy in my parsing code (which I did not include here) and my XML schema. The 'type not recognized' error was something of a red herring, but once I fixed things the parsing works just fine. If you get to this question bec...

.NET Unhandled Exception Dialog not Appearing

I'm working on a .NET 4.0 Beta 1 application. When the app its run without a debugger attached and there an unhandled exception occurs, the application crashes without never showing the Unhandled Exception dialog (the one that showed the callstack and the exception that was thrown). I understand this behavior is desirable in production...

ASP.NET Security Exception

I moved an ASP.NET application from a XP to a new server and now I have this exception: 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, On this line code: System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("it-IT"); My server is so con...

Remove Entity from DataContext so that its not inserted (Linq-to-SQL)

In my application I have 2 entities that are defined as: public class A { public B ClassB { get; set; } // Bunch of code } public class B { // Bunch of code } When I create a new instance of class A, assign it a new instance of B and insert A into the DataContext, the instance of B is also inserted into the DataC...

For C# resources, why is Properties is undefined?

When I try try to access a string property in one of my C# project resources, I get the following error: 'ORG.PRJ.MOD.MyClass2' does not contain a definition for 'Properties' The code that produces the error is: string s = MyClass2.Properties.Resources.TestString2; The really bizarre thing is that another project in my solution (...

Please suggest a PDF viewer for WPF

I am looking into a PDF viewer control than can be used in WPF application. I saw some examples using WindowsFormHost but I am interested in rotating/resizing the pdf file. Please let me know if there is a solution. ...

What does .NET stand for? Is it an acronym?

I've seen pronunciation guides and all sorts of definitions of .NET as a framework, but no definition or explanation of the actual name of the framework. Wikipedia doesn't seem to know. This question didn't cover it. Anybody know? Is it pure marketing-generated nonsense, or does it mean something? ...

PreviewTextInput is not fired when the focus is on checkbox / Handling the PreviewTextInput in Main window and not allowing child control steal the characters

I have the following code. The window has a textbox and a checkbox. If I have focus on the anything other than checkbox and type something like 123-456 then for each character PreviewKeyDown and PreviewTextInput are firing. But if I have the focus to checkbox and then type 123-456 then the PreviewKeyDown is fired for all the characters...

How to use the repository pattern correctly?

Hi I am wondering how should I be grouping my repositories? Like from the examples I seen on the asp.net mvc and in my books they basically use one repository per database table. But that seems like a lot of repositories leading you to have to call up many repositories later on for mocking and stuff. So I am guessing I should group the...

Find and remove Redundant code in Visual Studio 2008

Hi Guys, I have been working on a huge VS 2008 (C#) project. Recently we have been restructoring a section of the solution to use domain driven design in an attempt to increase the quality of the code and architecture. Everything has gone fine, however there will be a large amount of redundant code now nestled in the old business layer...

Checking for nulls

Sorry for such simple question. How would I check this for nulls? obj.DivisionNotes = (string)row["DivisionNotes"]; I'm thinking something like this. obj.DivisionNotes = (string)row["DivisionNotes"]?null:"No notes"; Am I right. Any help much appreciated. ...

Git versus Mercurial for .NET developers?

I've been wondering what is the better DVCS for .NET developers? From reading various information it has sounded like Mercurial works better on Windows, but other information claims that Git has caught up and surpassed Mercurial in offering quality Windows and Visual Studio tools. Does anyone have good recent information or experience ...

.Net DbDataAdapter has wrong primary key on filled datatable and i want to correct this

Hi all, .NET/MSSQL Server Question: I use a System.Data.SqlClient.SqlDataAdapter to connect to a database and read (.Fill) a datatable from a view in the database (select * from v_coolview). The problem is that the view consists of multiple tables (of course) and the resulting DataTable has typically a primary key set (Datatable.Primar...

Work around for lack of Grouping in CompositeCollection

When I try to add a GroupDescriptor to my CompositeCollection I get an exception informing me that the CompositeCollection does not supporting grouping. I would like to know if anyone has found a good work around for this limitation. I have two collections which I am "zipping" together and trying to group. If it is any help, I am not in...

Linq2SQL: Optimize query?

Can I optimized the following query in any way: The goal is to try to find clients of type 4 that also exists as type2 based on their VAT and Email. A client can have one or more clientusers. (I have all the appropriate indexes set, I promise) from e in Clients.Where(h => h.ClientTypeId==4) join u in ClientUsers on e.Id equals u.Clie...

How can you force WCF to use xs:All instead of xs:Sequence so that SOAP element ordering is irrelevant?

How can you make WCF use xs:All instead of xs:Sequence when it defines complex object types in the wsdl/xsd for a web service? The issue I am having is that xs:Sequence requires that calling applications pass the elements in the soap message in the order specified in the WCF generated xsd (this is alphabetical by default). xs:All (or ch...

How to pass an Interface object to a WebMethod?

I have a .Net web service with web method which take a Interface object as parameter, whenever I try to access the method I get exception saying : Cannot serialize member Product IProduct because it is an interface. Any suggestions to solve the problem ?? [WebMethod] Public double CalculateTotal(IProduct product, int Quantity) { ret...

Deserializing data sent via TCP

Hi, I have problem with sending objects via TCPClient. At first, I serialize them into byte array and then I send them. TCPListener recieves some data, but deserializer is throwing exception "Unexpected end of stream". Here is reciever code: public void start() { TcpListener listener = new TcpListener(IPAddress.Any, 80...

Label Text Pair Control in .NET

In .NET we have a label control and a text control, but what about a single control that includes them? I am working on a Windows Form application. Sorry for not making this clear. Edit: I know I can make it myself (everyone, anyone can), but I am looking for a built-in one. ...