.net

Why would I want to continue to use Nant when MSBuild is available?

I have seen the prior questions and answers. In that one question, the original poster asked a followup question: what are the compelling reasons to use msbuild? are there cons? I didn't see the answer to that. I'd like to know the converse, too. What are the compelling features of Nant? I think, for nant, cross-platform is b...

What is the best way to display large files without using large amounts of memory?

Many hex editors, such as Hex Workshop, can even read large-sized files while keeping a relatively small memory footprint, but still manage to keep scrolling smooth. I'm looking for the best way to achieve this, and so I have several related questions. Should I just use FileStream?   - Is its buffering based on the current Seek location?...

Cast an object into generic list

Hi, I have a requirement where I can get the following in an object - a type T or List<T> Converting object into T is easy. How can I convert it to List(by first checking that it can be converted successfully or not), reason I want to convert is to scroll through the list and call tostring on each element. My actual code - namespac...

.NET implementation of Portable Contacts API

Google just released a java implementation (jpoco). Is there a .NET one? Anyone planning on writing one? ...

Upcasting in .NET using generics

So I've got a class like this: public class A { internal A(int i) { ... } public int Foo { get; set; } } This class is then inherited by a bunch of generated classes, eg: public class B : A { ... } The int based constructor isn't exposed to the inherited class (for design reasons I don't want it exposed). In my library which...

String comparison in .NET strange behavior !

Someone can explain me why this test fails : [TestMethod] public void WierdComparison() { var machineConf = ConfigurationManager.OpenMachineConfiguration(); var systemWeb = machineConf.GetSectionGroup("system.web") as SystemWebSectionGroup; var prov = systemWeb.Membership.Providers.OfType<ProviderSett...

Date range from weeknumber + year

Hi Guys, I have 2 dropdowns 1 with weeknumbers 1 with years. I want to extract the date range from this data. So: Weeknumber 13 year 2009 would give: monday 23 march 2009 tuesday 24 march 2009 ... VB.Net preferred but C# sollution is also ok. Edit: Ok I guess I should have mentioned this is for European dates. ...

What is a good architecture for a server service and gui?

I am building an app that allows users to execute some commands on a computer by sending them through email. The server will monitor (pull) one or more email accounts and start a communication session. Some authentication is also involved. I am using the latest and greatest .net technologies. I am thinking to expose the server as a serv...

Source Control for a .Net guy

See http://stackoverflow.com/questions/690766/vss-or-svn-for-a-net-project, among many other similar questions. There are a lot of options out there for ASP.Net Developers, some are total garbage and some are feature rich and pricey. I've been using Visual Source Safe 2005 for a while when doing personal development, but only o...

MS Source Server - source stream is apparently not there when viewing with srctool

Hi, I have been playing around with the MS Source Server stuff in the MS Debugging Tools install. At present, I am running my code/pdbs through the Subversion indexing command, which is now running as expected. It creates the stream for a given pdb file and writes it to the pdb file. However when I use that DLL and associated pdb in v...

Get Type Parameter T from an instantiated System.Type?

Good afternoon, I am somewhat lost and maybe can give me a quick push in the right direction: I have the System.Type of a certain object but need to pass that over as a Type Parameter T to another method... is that somehow possible? Or am I lost in the bigger picture there? Cheers and thanks, -J ...

Is it possible to set a style in XAML that selectively affects controls?

In <Window.Resources> I have defined following style: <Style x:Key="textBlockStyle" TargetType="TextBlock"> <Setter Property="Margin" Value="5,0,5,0"/> </Style> I have defined some grid where I have four TextBlocks: <WrapPanel> <TextBlock Style="{StaticResource textBlockStyle}">Server</TextBlock> <...

Checking if Registry Value exists Visual C++ 2005

Hi There, Im trying to code a Visual C++ 2005 routine that checks the registry for certain keys/values. I have no trouble in writing code using c# but I need it in C++. Anybody know how to do this using c++ in vs2005. Many thanks Tony ...

Window Media PLayer in C#

Hi i'm building a Music PLayer and so i choose to use the library of Window Media Player: Now i got stuck 'cos i wish show the song's name in a listBox and change songs in real time but i don't know how go on. I store songs from a Folder and so when the Music Player run the songs from the Url choose. I show you a code snippet : p...

MS Access (MDB) concurrency

For a small project I need to utilize a simple database with very light requirements: few tables, no more than few thousands of records in total, 2 or 3 users. I am working in .NET environment. As a database server (even those Express editions) seems like a huge overkill in this case, a very simple MDB database could do for most of the ...

How to guess the encoding of a file with no BOM in .NET?

I'm using the StreamReader class in .NET like this: using( StreamReader reader = new StreamReader( "c:\somefile.html", true ) { string filetext = reader.ReadToEnd(); } This works fine when the file has a BOM. I ran into trouble with a file with no BOM .. basically I got gibberish. When I specified Encoding.Unicode it worked fine...

How can I allow a webproject to debug, without having to store server config in project?

I want to attach to process on my iis. I don't want to force my iis configuration to my colleagues. So how can I debug a web project, without storing its server config in the project meta data. The options are iis or developer server, I want neither. Is there a little known hack in the meta data, outside of the UI that will just work? ...

How do I play the "New Mail" system sound in .Net?

How do I play the "New Mail" system sound in C#? This is also called the "Notify" sound. In Win32, that would be something like sndPlaySound('Notify', (SND_ALIAS or SND_ASYNC)); So how do you do that in .Net? I know that you can do System.Media.SystemSounds.Asterisk.Play(); But there's a very limited set of five sounds there - n...

Search in A ListBox

HI I'm trying to put a textbox to search in a listBox. I have a TextBox: SearchText with this code: private void SearchText_TextChanged(object sender, EventArgs e) { int i = listBox3.FindString(SearchText.Text); listBox3.SelectedIndex = i; } and a ListBox On the Load I have this code List<string> str = GetListOfFiles(@...

OrderBy Signature Error in Pro LINQ book?

According to Pro LINQ: Language Integrated Query in C# 2008, Prototype of OrderBy operator is public static IOrderedEnumerable<T> OrderBy<T, K>( this IEnumerable<T> source, Func<T, K> keySelector) where K : IComparable<K> But the MSDN documentation does not have a generics contraint on TKey that it should be of type IComp...