.net

Good resources to learn WMI in .NET?

I'm looking for recommendations for good resources are there out there to learn WMI. Interested in all types; books, online, webcasts, etc. ...

Drag and drop from an email file attachment in GroupWise to a .NET application

I'm trying to allow an attachment from an email open in Novell GroupWise to be dropped into my C# WinForms application. The standard .NET functionality doesn't work. In the DragDrop event of a control, e.Data.GetFormats() returns the following. FileGroupDescriptorW FileGroupDescriptor FileContents attachment format I can get the file...

Best way to implement IXmlSerializable ReadXml() using XPath

Hi, I'm implementing the ReadXml() method of IXmlSerializable and I figure using XPath is probably the nicest way to do this. However, ReadXml() needs to handle the reader position properly. So given that my WriteXml() produces something like this: <ObjectName> <SubNode>2</SubNode> <SubNode>2</SubNode> </ObjectName> Is there a ...

How do I project to a dictionary with a custom type using Linq to SQL?

Hi, I am attempting to use Linq to project each row from a DB query into a dictionary that has a custom type as its value. I am unsure of the LINQ syntax to do this? This is my current attempt (which doesn't compile, but should demonstrate what I am trying to do). I am having trouble with the 'select new...' part. public class MyClas...

How to wait on WaitHandle without message pumping?

I want to call WaitHandle.WaitOne(TimeSpan) in .NET, but I'm on the STA thread and it pumps messages while waiting. For reasons that are beyond the scope of this question, I need to wait without pumping. How can I wait for a WaitHandle to be signaled without pumping messages? It seems in some scenarios that WaitHandle.WaitOne does not...

How to load CLR into process

Hello everybody,I have some question which puzzled me for a long time. What is the relationship between CLR and one process created by OS? What steps the CLR is loaded when we double-click an "Console Application" or "Windows Forms Application"? I found two methods: _CorExeMain() and _CorBindToRuntimeEx(). What's the role of them? ...

What is the regular expression for a Spanish word?

Regular expression languages use \B to include A..Z, a..z, 0..9, and _, and \b is defined as a word boundary. How can I write a regular expression that matches all valid Spanish words, including characters such as: á, í, ó, é, ñ, etc.? I'm using .NET. ...

is it better to register dll's to GAC or reference them from bin folder in ASP.NET

and if the answer is "it depends", could you provide a short explanation why ? ...

System.Uri fails to give correct AbsolutePath and LocalPath if the Path contains "#"

I have C# code that is trying to get the LocalPath for a executing assembly using the following line of code Uri uri = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath; This piece of code performs fine for all the variety of paths. It started to fail giving the right AbsolutePath and Localpath because the executing assembly ...

How to run CLR 2 application as CLR 4 application

Lets say I have an old application which will try to load an external assembly. The old application is compiled to CLR 2. The new assembly is compiled to CLR 4. I would like to be able to run that old application inside CLR 4. I remember there was some xml manifest magic involved. How can I create that manifest xml file to tell that...

How do I update text inside CDATA

I want to replace text inside cdata section but when I simply trying to add text to it I lose CDATA definition. I have a XML like this: <title><![CDATA[string]]></title> When I try to update this field with new value: myXmlNode.SelectSingleNode("title").InnerText = TextBoxName.Text; Output is <title>string</title> How do can I...

Can I run DBCC CHECKDB from .NET?

I am writing a scheduled job to mimic a SQL Server maintenance plan for SQL Express. (I have to do this because SQL Agent and related tools don't exist for SQL Express) One of the steps is to do a database integrity check. The TSQL for this is: DBCC CHECKDB(N'Northwind') WITH NO_INFOMSGS How do I know if an error occurred during ex...

Rubygems-style utility for .NET?

Is there anything like Ruby gems for .NET? ...

Undo in WPF Bindings

How to provide an undo / redo using bindings in WPF? e.g. You implement a master-detail view with bindings. After editing your changes were saved automatically using binding. Then you want to undo the changes. Is there something ready-to-use in the binding for WPF? Does WPF provide some structures or interfaces for? This question is n...

How do I sense the end of a user scroll of a .Net TrackBar?

I have a TrackBar and already have the Scroll event treated, but it may trigger 10 times during a user scroll, and I would like to update a file when the user finishes scrolling. How do I sense the "end of scrolling" ? Would MouseUp and KeyUp do for this purpose ? Thx. ...

How reliable are .net timers?

I'm looking at using a System.Timers.Timer in a windows service. I would like to know how reliable and accurate they are. In particular: Are there any guarantees about how often they will run? What happens when the processor or memory are overloaded? Will the ElapsedEventArgs.SignalTime always be accurate under such circumstances? ...

How to supress the creation of an (.net) Exception object?

Hi there, If I do not care about a thrown Exception. Can I code in a way as not to create it? In other words, can an Exception be thrown but no Exception object be created? An example - Simple example using a System.Net.Sockets.Socket Socket acceptingSocket; acceptingSocket.Blocking = false; while(condition) { try { ...

Generating HTML using a template from a .NET application

I have a .NET console application that needs to generate some HTML files. I could just construct the HTML in a StringBuilder and write the contents out to a file, but I was thinking it would be nicer to use some kind of template file with placeholders for where the data goes and then process my data through it at runtime. I'm guessing t...

Is warning CS3006 valid in this case?

The code below generates a warning CS3006 "Overloaded method MyNamespace.Sample.MyMethod(int[])' differing only in ref or out, or in array rank, is not CLS-compliant". Is this warning valid, i.e. is this genuinely not CLS-compliant? I'd have thought an explicit interface implementation would not count as an overload. [assembly: CLSCom...

Overriding the location of Controls even when they are directly accessed by myControl.Controls(index)?

Hi, I want to make a UserControl which holds and moves other controls within itself. I worry that the Controls collection can be used to destroy all the internal logic of the UserControl. Remembering that the .Net Framework TableLayoutPanel locates its own Controls, I created a 30x30 TableLayoutPanelm each cell containing a square Label...