.net

Saving Bitmap Images in WPF via C#

Hey I display images in my WPF app using BitmapImage. However, I would like an easy way to save these (as JPG) to a different location (ideally into a Stream or object that can be passed around) Is it possible using BitmapImage or do I have to use other means? If so what other means are there for either loading an Image and saving as J...

How many instances exists when a InstanceContextMode.Single WCF service exposes multiple endpoints?

Does the ServiceBehavior setting InstanceContextMode.Single sets a single instance regardless of the number of endpoints? ...

Howto get started with C# 4.0 and .NET 4.0?

I don't want to download Visual Studio 2010. How can I start studying (not developing real applications) C# 4.0 and .NET 4.0 with just a text editor? Can I just download C# 4.0 compiler and .NET 4.0 framework and get started? How? I have got Visual Studio 2008 but I learn from SO questions that it can't do the job. ...

.net / winforms: remember windows size and location

hello, i have a windowsfroms application with a normal window. now when i close the application and restart it, i want that the main window appears at the same location on my screen with the same size of the moment when it was closed. is there an easy way in winforms to remember the screenlocation and windowsize (and if possible the wi...

string.Compare behavior

How this can be ? (This is taken from the immediate window in VS2008) ?string.Compare("-", "+") -1 ?string.Compare("-0", "+0") 1 ...

WCF: Exposing readonly DataMember properties without set?

I have a server side class which I make available on the client side through a [DataContract]. This class has a readonly field which I'd like to make available through a property. However, I'm unable to do so because it doesn't seem that I'm allowed to add a [DataMember] property without having both get and set. So - is there a way to ...

Which ORM tools support this version of Queryable.Select extension method

Do you know an ORM supporting this extension method: public static IQueryable<TResult> Select<TSource, TResult>( this IQueryable<TSource> source, Expression<Func<TSource, int, TResult>> selector) Basically, it allows to add row number (index of result in sequence) to the projection. Example of its usage with IEnumerable is here. ...

Copying data from a Winforms ListView

Is there a way to copy the text of the selected subitem from a ListView in .NET Winforms? ...

Why does ReSharper want to use 'var' for everything?

I've just started using ReSharper with Visual Studio (after the many recommendations on SO). To try it out I opened up a recent ASP.NET MVC project. One of the first and most frequent things I've noticed it suggesting is to change most/all my explicit declarations to var instead. For example: //From This: MyObject foo = DB.MyObjects.Sin...

Check when the application has gone fullscreen. (DXGI/DirectX10)

Hi, this is my question... There is a way to check when the application has gone fullscreen in DXGI (DX10/11). For going Fullscreen I mean that the system has COMPLETED the mode change. Cause i need it for my application to prevent deadlock and to adjust timing. (I have a multithreaded engine and the Present is not on the message pump ...

Register managed assemblies with COM without using the GAC

I'm wondering if it possible to register assemblies with COM without having to register it with the GAC. We need to deploy some .net libraries that are exposed to classic asp using a CCW. But deployments are a nightmare. ...

Difference between casting in C# and VB.Net

The next code works fine in C#: Int32 a, b; Int16 c; a = 0x7FFFFFFF; b = a & 0xFFFF; c = (Int16)b; But this code crash with a OverflowException in VB.Net. Dim a, b As Int32 Dim c As Int16 a = &H7FFFFFFF b = a And &HFFFF c = CType(b, Int16) Both codes seems the same to me. What is the differ...

How to remove all comment tags from XmlDocument

How would i go about to remove all comment tags from a XmlDocument instance? Is there a better way than retrieving a XmlNodeList and iterate over those? XmlNodeList list = xmlDoc.SelectNodes("//comment()"); foreach(XmlNode node in list) { node.ParentNode.RemoveChild(node); } ...

Web Service error which is solved by reboot or re-registering asp.net

Hi to all, We have a web service (c#/.net 3.5/asp.net 2) which after a couple of weeks of use gives a message "System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.IO.FileNotFoundException: Could not find file 'c:\windows\Temp\xxxxxx.dll'" where the filename xxxxxx.dll is a random string which c...

Is there a way to encrypt the configuration file of a Windows Forms application?

Is there a way to encrypt the configuration file of a Windows forms application? All I can find on google is stuff that is dependant on "aspnet_regiis.exe" but I want to do this for a desktop application? e.g. http://msdn.microsoft.com/en-us/library/ms998283.aspx ...

How do I get the XMLSerializer to add namespaces to attributes in nested objects?

Hi, This is what I get: <ex:test soap:mustUnderstand="1" xmlns:ex="http://www.example.com/namespace"&gt; <ex:A Type="lorem">ipsum</ex:A> </ex:test> This is what I want: (Note that the Type-attribute is prefixed with ex.) <ex:test soap:mustUnderstand="1" xmlns:ex="http://www.example.com/namespace"&gt; <ex:A ex:Type="lorem">ipsum<...

How to specify a physical path on disc to a file, but acces a memory location??

Hello Everyone, I'm trying to integrate several components to build a custom reporting solution. One of these components is a template-based report generator. It reads a template consisting on a RTF file with placeholders and perform the substitution. This works great, and generates an RTF report. Although it can generate the results a...

Alternative ways to get a full path of a file

Is there any alternative way to get a full path of a file without using Path.GetFullPath method? ...

Capture mouse clicks on WPF TextBox

Hi all, I want to capture mouse clicks on a TextBox: <Window x:Class="WpfApplication2.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Grid> <TextBox x:Name="t" MouseDown="TextBox_MouseDown" MouseLeftButtonD...

WebRequest POST with both file and parameters

Hi guys, I'm trying to upload a file and a send along a few parameters to my site using .NET / C#. Having read a few tutorials that do either a few parameters or a file, I've tried, unsuccessfully, to combine them. Here is how I try doing it: WebRequest req = WebRequest.Create(baseURL + "upload"); req.Credentials = new NetworkCredentia...