.net

Getting started with F#

What's a good way to get into F# programming? What's a good "Hello world" example and what simple examples can show me why I want to use it over C#. Also what tools do I need? I have WindowsXP, Visual Studio 2008 etc. ...

How to use XAML outside of presentation layer (WPF/Silverlight) ?

XAML is supposed to be "Extensible Application Markup Language" - i.e. a generic, flexible framework for creating application markups. However, most searches for XAML yield either WPF or Silverlight-specific materials. The only exception at this time (that I am aware of) is Oslo framework (M-language & co.) - proving that XAML can be us...

What causes System.Drawing.Printing.PrinterSettings.InstalledPrinters to throw Win32Exception "RPC server not available"?

I have an application that I'm working on and I allow the user to select a printer to use as their printer while printing forms from the application. I'm using .NET 2.0 In the settings screen, I call System.Drawing.Printing.PrinterSettings.InstalledPrinters to get the list of available printers. On a client's machine, the property...

Cross system process spawning and interaction.

I've got a piece of software i'm working on that spawns short lived processes on remote systems to run some code (mostly SerialPort IO) that may or may not interact with the spawning application (but it should be assumed it will), and will then terminate on command. What is the best way to spawn a remote process like this (PSExec? WMI? ...

Use of the Keyword Static

Duplicate http://stackoverflow.com/questions/731763/should-c-methods-that-can-be-static-be-static Other then the obvious downsides of inheritance and variable scope, if you have a method that is completely contained should you always declare it as static? Are there any downside to declaring methods as static? Especially in terms ...

What role does XML play in modern nTier architectures?

I have seen a lot of job postings for ASP.NET and server engineer positions, and they always seem to list XML and XSLT as one of the skills that is valuable to them. I am wondering what role XML plays in modern systems. How are people using XSLT with XML in nTier systems? ...

Is it possible to restrict rights of invoked external program to read only file operations?

I use the next code: ... ProcessStartInfo processStartInfo = new ProcessStartInfo(); ... Process process = new Process(); process.StartInfo = processStartInfo; bool processStarted = process.Start(); ... Is it possible in .Net to restrict rights of invoked external program to read only file operations? ...

How do I implement a System.Type property in markup for a User Control?

This is a follow up to another question of mine where I first found this problem. If I create a public property on my User Control, with a type of System.Type, I cannot use a normal string representation of the type, e.g. System.Int32, as a declarative markup attribute value for the property. It seems I need to uncover whatever it is t...

Can you refactor out a common functionality from these two methods?

I have two methods that basically converts underlying checkboxes' text or tag as CSV strings. These two methods GetSelectedTextAsCsv() GetTagAsCsv() differ only by which property to extract value from SelectedCheckBoxes, which is of type IList<CheckBox> public string GetSelectedTextAsCsv() { var buffer = new StringB...

No ConvertAll for LinkedList<T>?

Does anyone have an extension method to quickly convert the types in a LinkedList<T> using a Converter<TInput, TOutput>? I'm a bit surprised, where is the ConvertAll<TOutput>(delegate)? ...

Web Application Accessing Local Filesystem

Hello all, I have a web application (.NET, if it matters) where when one of the pages is loaded, a file on the users local machine needs to be copied (uploaded) to the webserver. This upload needs to be without user intervention. This web application will be running on a kiosk where I would be setting up the original permissions and t...

How do I get the source of a ContextMenu-originated event in WPF?

Hi I have a TreeView with a ContextMenu with Click events. When the click event in the context menu fires, I get the MenuItem as the source of the event, obviously. How can I get which node in the TreeView was the one who triggered the ContextMenu? ...

How to build for Pocket PC 2002 with Visual Studio 2008?

Is there any way to build for Pocket PC 2002 (3.0) with Visual Studio 2008? ...

How inject .NET code to alter return values of functions.

Hi there. I am currently researching how to write .NET code that can be injected into another .NET process and override function return values. The idea is that my code would alter the return values of a method call, like this: Public Function DoSomething() As String Return "Value" End Function My code would intercept calls to DoSo...

Multiple assertions when unit testing constructor?

I'm trying to unit test a class with 2 constructors. Each constructor has multiple parameters that set public properties. My question is, should I have only 2 unit tests with multiple asserts to check that each property was set OR a test for each parameter for each constructor? Public Person(string name, string phone, string birthday)...

Seeking One-Size-Fits-All Context Based Storage

First off, I wish context based storage was consistent across the framework! With that said, I'm looking for an elegant solution to make these properties safe across ASP.NET, WCF and any other multithreaded .NET code. The properties are located in some low-level tracing helpers (these are exposed via methods if you're wondering why they...

Working with singletons in .Net Remoting

I'm having a bit of a problem with a singleton class I'm exposing via remoting. In my server I have: TcpChannel channel = new TcpChannel( Settings.Default.RemotingPort ); ChannelServices.RegisterChannel( channel, false ); RemotingConfiguration.RegisterWellKnownServiceType( typeof( RemotableObject ), "RemotableObject", WellKno...

.NET: Why isn't base 64 in Encoding.GetEncodings()?

I have a function that can decode an array of bytes into a string of characters using a specified encoding. Example: Function Decode(ByVal bytes() As Byte, ByVal codePage As String) As String Dim enc As Text.Encoding = Text.Encoding.GetEncoding(codePage) Return enc.GetString(bytes) End Function If I want to include base64 in ...

What happens to User-Scope Settings when a .NET Assembly is "Referenced"?

I have a stand-alone WinForms application, let's call it "Program A." Program A let's a user create a file and save some information to it. Program A also exposes some public classes. Another stand-alone WinForms application ("Program B") references Program A, and uses some of its public classes. However, some of Program A's classes n...

.net - unable to convert code from c# to vb.net due to incremental operator or automatic string conversion (I think)

I am writing a library in VB.NET in which I have added, among others, a class originally written in C# but converted into VB.NET. I don't know much about C# so therefore I have used online C# to VB.NET-converters. Now I am stuck with some code which I believe the online-converter was not able to "translate" properly. When running the co...