.net

System.Web.Abstractions: what is it good for?

... absolutely nothing? What part of the puzzle does it fill for ASP.NET WebForms and ASP.NET MVC respectively? Can you somehow create a ASP.NET * base-application which uses System.Web.Abstractions so it can be used in both kinds of ASP.NET-web applications? In that case, how did they retro-fit the classes in System.Web.Abstractions ...

Problem with Z-Order involving TopMost and Invoke

I am showing Dialogs with Form.ShowDialog(). Forms are set to TopMost. Some image processing calculations are performed asynchronly in the background. Their results are rendered in the main form by Invoke. So far so good. Strange thing is that every now and then the modal dialog is moved behind the main form. I guess that happens when th...

How to determine the size of a string given a font.

I have a small form that displays some progress information. Very rarely I have to show a rather long message and I want to be able to resize this form when needed so that this message fits in the form. So how do I find out how wide string S will be rendered in font F? ...

Understanding DataTable with SQL Server DataAdapter for best speed

I have been wondering this and can't really find a straight answer. In .NET when you fill a DataTable with rows from the database using the SQL Server data adapter does it truly load into memory right then and there or does it still read data from the database as you are accessing it in some regard? ...

.NET String.Replace

I am so annoyed. Typically I like replace acting as it does in C# but is there a C++ styled replace where it only replaces one letter at a time or the X amount I specify? ...

Using ToArgb() followed by FromArgb() does not result in the original color

This does not work int blueInt = Color.Blue.ToArgb(); Color fred = Color.FromArgb(blueInt); Assert.AreEqual(Color.Blue,fred); Any suggestions? [Edit] I'm using NUnit and the output is failed: Expected: Color [Blue] But was: Color [A=255, R=0, G=0, B=255] [Edit] This works! int blueInt = Color....

Forcing English language exceptions in .NET framework

Hi, While working with ASP.NET MVC, I have noticed that exception messages issued by the .NET framework installed on my System are in German. I'd really prefer English messages, so I can post them on SO. I know this has been asked before on SO, but strangely enough none of the suggested workarounds seem to work in my case. I have alre...

How can I use non-Silverlight assemblies in a Silverlight app?

I'm working an project (pure hobby, "Sharping my skills") which has one unified back-end and multiple front-ends (ASP.NET MVC 1.0/JQuery and Silverlight 2). When I try to add reference to my business layer assembly in the Silverlight 2 project (VS2008); It gets rejected, because it's not a Silverlight assembly. Is their a way to include...

linq question: querying nested collections

I have a Question class that has public List property that can contain several Answers. I have a question repository which is responsible for reading the questions and its answers from an xml file. So I have a collection of Questions (List) with each Question object having a collection of Answers and I'd like to query this collection o...

dat idx files database recognition

Hi, I have some .dat and .idx files and one .sup file in a directory , and i would like to know if there is any tool or .net programming tecnique to find out what type of database is? I dont know if this could help, but if i open one .dat file as text file, i get this: 0~0904021846460509040218464605>ÀÀX2Ü And the common part of all t...

streaming XML serialization in .net

Hello, I'm trying to serialize a very large IEnumerable<MyObject> using an XmlSerializer without keeping all the objects in memory. The IEnumerable<MyObject> is actually lazy.. I'm looking for a streaming solution that will: Take an object from the IEnumerable<MyObject> Serialize it to the underlying stream using the standard seriali...

How to create xml from another xml meta data?

I am not sure whether the title clearly explains my problem, will try to include as much details I can. I need to convert below xml to a properly formatted one using Xslt 1, so that I can deserialize it to a .net type. Source XML <ax21:result type="test.ws.Result"> <ax21:columnNames>fileName</ax21:columnNames> <ax21:columnN...

Maintain a controls Aspect Ratio on Resize

I have a panel control with a picture box in it. How can I maintain the aspect ratio of the panel control when Resizing the form it's on? ...

How do I convert an .sdf to binary file using C#?

I need to convert an .sdf file to a binary file. (I think with streamreader?) Then I need to convert this binary file back to .sdf. How do I do this? ...

WinForms: variable number of dynamic TextBox controls

I have to create variable number of Labels and next to them TextBox controls - arranging the whole thing into a column, each line a Label and a TextBox. If the my Main window is smaller than the total height of all the TextBox controls, somehow I need a scrollbar which can scroll the list of TextBoxes. Pressing the enter key would have t...

Concatenating an array of strings to "string1, string2 or string3"

Consider the following code: string[] s = new[] { "Rob", "Jane", "Freddy" }; string joined = string.Join(", ", s); // joined equals "Rob, Jane, Freddy" For UI reasons I might well want to display the string "Rob, Jane or Freddy". Any suggestions about the most concise way to do this? Edit I am looking for something that is concis...

What technology should I use to implement a durable subscriber accessible from .NET?

Assuming a green field project, what choice of technologies, libraries, middleware, etc. would make it easiest to implement publish-subscribe messaging with durable subscriptions on Windows and .NET? I found WCF Peer Channel using Google, which seems to do most of what I need, but I do not think it guarantees message ordering, nor does ...

C# DataSet Index

Hello, I need to find records in a dataset that have certain values from more than 1 column. I cannot use the Find or Contains method since they require a primary key and my search values can be non-unique. Do DataSets have indexes (Much like a SQL table) that I can use to speed up my search? Right now I'm looping through the dataSet do...

Any other object-to-object mapping solutions other than AutoMapper in .NET?

I would like to know if the other similar open source solutions in .NET world, especially for 2.0 framework ...

Instantly detect client disconnection from server socket.

How can I detect that a client has disconnected from my server? I have the following code in my AcceptCallBack method static Socket handler = null; public static void AcceptCallback(IAsyncResult ar) { //Accept incoming connection Socket listener = (Socket)ar.AsyncState; handler = listener.EndAccept(ar); } I need to find a way t...