.net

Parsing a comma separated file using powershell

I have a text file which contains several lines, each of which is a comma separated string. The format of each line is: <Name, Value, Bitness, OSType> Bitness and OSType are optional. For example the file can be like this: Name1, Value1, X64, Windows7 Name2, Value2, X86, XP Name3, Value3, X64, XP Name4, Value3, , Windows7 Name4, Va...

How to speed up loading DTD through DOCTYPE

I need to load a number of xhtml files that have this at the top: <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt; Each file will be loaded into a separate System.Xml.XmlDocument. Because of the DOCTYPE declaration they take a very long time to l...

Why .net Threadpool is used only for short time span tasks?

I've read at many places that .net Threadpool is meant for short time span tasks (may be not more than 3secs). In all these mentioning I've not found a concrete reason why it should be not be used. Even some people said that it leads to nasty results if we use for long time tasks and also leads to deadlocks. Can somebody explain it in...

Getting the String Text of SelectedItem in Silverlight Listbox (C#)

I have a listbox in a Silverlight C# app which is binded to some data from a database in XAML: <StackPanel> <TextBlock x:Name="ItemText" Text="{Binding Name}" Foreground="White" FontSize="35" TextAlignment="Left"/> <TextBlock x:Name="DetailsText" Text="{Binding Description}" Foreground="Gray" Margin="0,-6,0,3" /> </StackPane...

Partitioner class usage

After looking to this interesting movie http://channel9.msdn.com/posts/philpenn/Speeding-up-ParallelFor-using-the-Range-Partitioner/ I was wondering how I can change the code below when the collection is a LinkedList not an array: int size = 300000000; int[] data = new int[size]; Parallel.ForEach(Partitioner.Create(0, size), (Tuple<int...

String format question

Hi, I'm using infragistic grid, and setting DisplayFormat of each column. DisplayFormat is type of string, and uses it`s value to show value of cellValue.ToString(DisplayFormat), when showing values to user in a grid (as Infra docs saying) In grid I have doubles, that have many numbers after point, and I don`t know how many. And I need ...

Handling cleaning up on process termination

Hello Am curious.. whether can i handle the cleaning up of an object. If i kill my application from Task Manager. public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if ...

Is it possible to create a WorkFlow (in Workflow-foundation -4) dynamically?

Is it possible to create workflows dynamically? I need to generate a WF dynamically based on a set of business logic and service execution sequence I get as input to the system. Is it possible for me to generate the workflow.xaml dynamically without using the wf designer and execute in the cloud ? ...

Does an asynchronous call require an extra thread in the current process or use another thread in a thread pool?

I'm referring to this answer where it says it's not required, there are few specific assumptions though. That question is general. I'm using C# Asynchronous process is doing nothing but just calling an external API and waiting for the reply. ...

Performance counter created but not working until windows restart

Hello, I have a strange problem creating new counters in existing group. I have a windows service, which does some work and allow me to monitor its state via performance counter. I have performance counters group and some performance counters. Group is created during service install phase (with administrator privileges), and counters ar...

Is it considered acceptable to not call Dispose() on a TPL Task object?

I want to trigger a task to run on a background thread. I don't want to wait on the tasks completion. In .net 3.5 I would have done this: ThreadPool.QueueUserWorkItem(d => { DoSomething(); }); In .net 4 the TPL is the suggested way. The common pattern I have seen recommended is: Task.Factory.StartNew(() => { DoSomething(); }); How...

What does string builder do???

what string builder command do in the asp.net cs file. ...

How to determine path of exlorer.exe in .NET ?

I need to determine the path of the original explorer.exe on both 32-bit and 64-bit Windows in a C# project. What is the most reliable way to achieve that? ...

Do not see MessageBox

Why do I not see the MessageBox with exception details when I run my program by executing exe fine in bin debug folder? I do see the exception when I debug (run) the program from Visual Studio. [STAThread] static void Main() { try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(...

Visual Studio 2008 using incorrect version of mscorlib

A while back a project I'm working on (and all other projects in the solution) were switched over to .Net 3.5. I'm trying to make use of Guid.TryParse which rocked up in .Net 3.5. When I try to use it I get the error: 'System.Guid' does not contain a definition for 'TryParse' The MSDN docs clearly show that TryParse exists in .Net 3.5...

Using the .NET Email API, how do I add an image and then have the ability to decide/determine its placement/location within the email?

I would like to add an image as an attachment to an email and then have control over where the image is actually placed within the email, either by overriding the html to be rendered, or by some other means. Is this possible? ...

What is the best way to store area data for a text adventure?

I'm developing a "Zork" style text adventure in C#, and it's going to have a fairly large number of different areas with descriptions and environmental modifiers. I don't want to have a database, ideally, unless it really is the best way of doing it. I need advice on the best way to store/load this data. It will include: Area descrip...

WPF/Layered Architecture Question -

I'm thinking through the high level architecture of a WPF application. Usually I would think in terms of this A database server A data access layer on its own server A business logic layer on its own server WCF wrapper round the business layer UI Layer for use on the client. E.g. a thin client with all the magic happening on remote...

WCF OData service with Reflection Provider

We need to provide an API for an Activity Feed (think of Facebook) and we decided to give OData a try. We are using .NET so we went for WCF Data Service but we don't use Entity Framework (or any other ORM) so we will use the Reflection Provider. Because we have complex business logic for our retrieval methods we decided to expose them as...

Creating a PDF via C#

Possible Duplicate: Creating pdf files at runtime in c# Possible Duplicate: Creating pdf files at runtime in c# Is this possible, if so how! ...