.net

XSD and Automatic Class / Message Generation

What avenues are there for using an XSD to generate message instances? I seem to remember reading about generating classes from XSD, but can't find anything specific now. I know you can generate classes and datasets from XSD, but I'm looking for a pattern for automating the actual generation of the messages. BTW, SO is my knowledge sh...

Transitioning from WinForms to AJAX, what do I need to know?

I currently have a functioning in-house Windows Forms application which extensively uses the DataGridView control for data entry. There are some support issues which are expected when we roll this out to more locations, so one of our consultants has recommended putting together an AJAX application with substantially the same functionalit...

Capturing the Console Output in .NET (C#)

Hi i want to invoke the Console application from my application but i would like to capture all the output generated in the console. (Remember, i dont want to save the information first in a file and then relist as i would love to receive it as live) ...

How to prevent an exception in a background thread from terminating an application?

I can hookup to AppDomain.CurrentDomain.UnhandledException to log exceptions from background threads, but how do I prevent them terminating the runtime? ...

Why use ref keyword when passing an Object?

Hi If I am passing an object to a method, why should I use the ref keyword? Isn't this the default behaviour anyway? For example: class Program { static void Main(string[] args) { TestRef t = new TestRef(); t.Something = "Foo"; DoSomething(t); ...

How to expose objects through WCF?

My project is split up into a typical 3 layer structure for a Silverlight app. That is: A base layer, which is a class library that contains all my business objects, logic, data access etc. A middle layer which is a WCF service which communicates with; My Silverlight front end The problem I have is that currently the BO's exposed thr...

Missing Workflow project templates in Visual Studio 2008

I cannot add workflow item to my WPF project. I create a new WPF project and want to add a sequential workflow. When I do "Add new item" there is no item template to select. Any hints? ...

Unit test Custom membership provider with NUnit throws null reference error

Trying to create a user account in a test. But getting a Object reference is not set to an instanve of an object error when running it. Here's my MemberShip provider class, it's in a class library MyCompany.MyApp.Domain.dll: using System; using System.Collections.Generic; using System.Web.Security; namespace MyCompany.MyApp.Domain { ...

Response.Redirect("") inside "using{ }"

Assume the following code: using (SqlConnection conn = new SqlConnection(connectionString)) { ... using (SqlCommand comm = new SqlCommand(...)) { .. do stuff .. if(condition) Response.Redirect("somepage.aspx"); } } Will the Response.Redirect() exit from the using blocks cause it to dispose all connections? ...

Using FromBase64Transform with CryptoStream?

I have a .NET string which is Base64 encoded representation of an array of encrypted bytes. It is produced like this: String Encrypt( String message ) { CryptoStream cryptostream = ... StreamWriter stream = new StreamWriter( cryptostream ); ... return Convert.ToBase64String( ... ); } Now I want a decryption function l...

Configuration Across Multiple Applications

What is recommended for sharing configuration data amongst several related applications in a winforms solution? The two possible solutions I envisage are using a custom section in the machine.config (?) file, and the other is to create an extra config service application that maintains settings via its Properties class, and handles get ...

Insert HTML into OpenXML Word Document (.Net)

Using OpenXML SDK, I want to insert basic HTML snippets into a Word document. How would you do this: Manipulating XML directly ? Using an XSLT ? using AltChunk ? Moreover, C# or VB examples are more than welcome :) ...

How to read assembly attributes

In my program, how can I read the properties set in AssemblyInfo.cs: [assembly: AssemblyTitle("My Product")] [assembly: AssemblyDescription("...")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Radeldudel inc.")] [assembly: AssemblyProduct("My Product")] [assembly: AssemblyCopyright("Copyright @ me 2008")] [assembly:...

Self Signed Certificate in Windows without makecert?

We have a shrink wrap type Windows server application where we need to create a self signed certificate on the server to be used by some WCF web services. From our searches on the web, it appears that the makecert utility in the PlatformSDK from Microsoft cannot be distributed with our application, so we're looking for alternatives. ...

Can a WinForms app be configured to run as "x86" without recompiling?

Can a WinForms app compiled for "Any CPU" be configured to run as "x86" on a 64-bit server without recompiling the app? Specifically, I'm looking for an app.config setting or Control Panel applet to accomplish this end. All the customer's clients are x86, but the server is x64, and we like to install the WinForms app on the server for ad...

How do I tell if a class property has a public set (.NET)?

I have this: public string Log { get { return log; } protected set { if (log != value) { MarkModified(PropertyNames.Log, log); log = value; } } } And my utility class for databinding ...

Can I show file copy progress using FileInfo.CopyTo() in .NET?

I've created a copy utility in c# (.NET 2.0 Framework) that copies files, directories and recursive sub directories etc. The program has a GUI that shows the current file being copied, the current file number (sequence), the total number of files to be copied and the percentage completed for the copy operations. There is also a progress ...

Test Data Builder pattern: more useful or more upkeep?

Let me start by saying I'm a huge fan of the elegance of this pattern -- I have a group of basic entities that I have implemented builders for (specifically for testing). However I have found (and this may be the caveat) that as my program evolved I kept having to go back and re-work the builders. In the end, it really hasn't seemed wo...

.Net Background worker process localization help

I am experiencing some weird behavior with localized messages reported from my background worker process in my windows forms application. The application is a setup application with windows forms. The application launches a background worker to perform and IIS reset and then install MSIs. The first time I run the application on a Spani...

Detecting a Process is already running in windows using C# .net

How do I detect if a process is already running under the Windows Task Manager? I'd like to get the memory and cpu usage as well. ...