.net

how can I automatically run my tests after compilation?

Is there any easy way to automatically run my unit tests after a successful compilation? ...

Set Screen.WorkingArea.Width?

Sorry if this is a fundamental question and I'm just stupid :) I am building a sidebar application, it uses System.Windows.Forms.Screen.PrimaryScreen.WorkingArea to set the appropriate widths and heights and locations. I want to now reduce the working area of the desktop so that when forms maximise, the sidebar is still shown (in the ...

Is Linq-XML always so messy?

var subset = from item in document.Descendants("Id") where item.Value == itemId.ToString() select new PurchaseItem() { Id = int.Parse(item.Parent.Element("Id").Value), Name = item.Parent.Element("Name").Value, Description = item.Parent.Element("Description").Val...

For each line in selected lines (vb.net)

how can I get the lines which are have selected text in them? For example: The selected lines would be 1, 2,3 and 4 (0 being the first line) How can I get to code like: For Each line as string(or integer) in textbox1."SelectedLines" 'Do something here for each line Next Thanks ...

How to Set Width for Columns in LISTBOX ??

I have a Listbox in to which I am binding the data coming from a DataTable I am using VisualStudio 2003, .net 1.1 For Each dr As DataRow In dt.Rows Dim li As New ListItem(dr("BIPAD").ToString().PadRight(25, Microsoft.VisualBasic.ChrW((160))) + dr("TITLENAME").ToString()) lbMagTilteByCategory.Items.Add(li) ...

How can I emulate key press with copy & paste in an Infragistics UltraWinGrid?

I am using the Infragistics UltraWinGrid (version Win 9.1). The default behavior is to allow the user to type text into a cell. When one copies multiple cells from an Excel spreadsheet, only the first cell's data will be pasted into the UltraWinGrid. One can easily change the behavior to paste multiple cells by setting the UltraWinGrid ...

Does C# have a "ThreadLocal" analog (for data members) to the "ThreadStatic" attribute?

I've found the "ThreadStatic" attribute to be extremely useful recently, but makes me now want a "ThreadLocal" type attribute that lets me have non-static data members on a per-thread basis. Now I'm aware that this would have some non-trivial implications, but: Does such a thing exist already built into C#/.net? or since it appears so...

c# question - is there a tool to identify where I should/can use a "using" statement to ensure resources are closed?

c# question - is there a tool to identify where I should/can use a "using" statement to ensure resources are closed? (to avoid memory leaks etc) Including both the cases that: a) there are resources not been closed and b) syntax is using a try-catch-finally and identies this could be changed to a using Thanks ...

Is there a built-in logging framework in .NET?

Simple question: see title. I'm using .NET 3.5. Elaboration: I'm building a plugin that will be loaded into a 3rd party application at runtime. The main application uses log4net as its logging framework. However, it doesn't expose the root logger so we're unable to log. (I've raised this issue with the upstream developers and they'll b...

How can I read the attributes of a .DLL file using C#?

I want to read the comments of a .DLL file: ...

Access PGP Encrypted Folder

I am currently reviewing an architecture document which details using PGP folder based encryption (and I though PGP died years ago). Does anyone know of a .NET or Java library that could be used to read/write files to a PGP encrypted folder (or if a library is even needed)? ...

Why is there a Missing AutoresetEvent.WaitOne overload on .NET Framework 2.0

If have come across an anomaly where it seems that some machines that have not had a Windows Update applied to them in a VERY long time that the .NET Framework 2.0 didn't have a specific overload available in it. AutoResetEvent.WaitOne(int32) appears to be non existant under an early revision. According to MS documentation this method h...

Where can i get the source code for VNC in DOtnet c#?

Hi, My requirement is to remove the menu bar of TightVNC Viewer, because i dont want the user to use any of them in menu bar. For which i need the source code of TightVNC, so that i can remove or disable the menu bar in UI Form. Can i get the source code in c# and i want to open the project in Visual studio Dot Net and change the form. O...

Regular expression with an empty group "()" returning strange results

It is a bit pushing the edge, but I have the following situation with this regular expression - "()" : When used to split a string into a string[] array, the results are somewhat weird to me. For example this line of code : string[] res = new Regex("()").Split("hi!"); sets res to an array of 9 (!) elements : ["","","h","","i","","!","...

Searching through a Hashtable

Hello All I have a Hashtable containing key and data in the following format. Key Data -------------------- X1 ---- > D1 X2 ---- > D1 X3 ---- > D1 X4 ---- > D2 X5 ---- > D2 X6 ---- > D3 My requirement is to get a tree structure from the same data i.e D1 |------- X1 |--------X2 |--------X3 D...

How to use Func<T> & Linq with .NET framework 3.0

I've been developing a WPF application with .NET framework 3.5 and later had to change to 3.0. Some of the features like Func (System.Core.dll) and Linq is not available now and VS throws compile errors to my existing code. How can I use 3.5 features in 3.0? ...

Are there any major advantages to Upgrading Silverlight from 2 to 3?

Is it worth updating a Silverlight 2 project to Silverlight 3? Or should I just wait for four. We currently have several Silverlight 2 projects in a web application and would like to know if there are benifits. So far I have this: Moonlight(silverlight for linux) only supports V2 quite a few code changes in the projects I have which ...

How to hide console after creating form in console application

I want to hide my console after creating a from in my console application. And then show it again after closing form :) or somewhere when I want ... Console.Hide??? Application.Run(nForm()); Console.Show??? ...

Looking for PRNG that you can seed with any number bytes

I'm looking for a PRNG (pseudo randomness) that you initially seed with an arbitrary array of bytes. Heard of any? ...

Automatically creating a collection in the Dictionary<Key, Collection<Value>>

Lot of times I have to create a Dictionary<KeyType, List<ValueType>> Before I can start using the dictionary I have to first verify that List has been created for that key. //Can i remove these two lines? if(!dict.ContainsKey(key)) dict[key]= new List<ValueType>; //now use the key dict[key].Add(value); I know its only "2 lines"...