.net

Why C# get so related with .NET framework?

Maybe there are VB.net and other language that related with .Net framework. When I install the Visual C++ 2008 ,I have to install the .Net framework 3.5. However,why people think .Net gets mainly related with C# language? ...

Please Explain this Convert.ToInt64 InputStringFormat Exception

Can someone tell me why: var nl = Convert.ToInt64("17029268.1650117"); fails, and instead you have to do this: var nl = Convert.ToInt64(Convert.ToDouble("17029268.1650117")); Because it seems so stupid! ...

HttpWebRequest not returning response stream when cache hit, and AllowAutoRedirect == false

I have an HttpWebRequest that I've set the CachePolicy to CacheIfAvailable, and I've set AllowAutoRedirect to false. Now when there is a cache hit, the HttpWebResponse.Status == NotModified, and there is no response stream. I need to know what the cached response is! If I set the CachePolicy to BypassCache it works just fine. But I ne...

Why do I need the Singleton design pattern?

i try to learn design pattern, but it's really really hard to understand main idea of OOD. i have created my software with classic method. On the other hand i want to learn OOD. why i need singleton and others? i coded some simple program: one of them clasical(my style), the other is singleton pattern.Please teach me why do i need single...

Collections optimized for concurrency in .Net

In the java world there is a set of classes optimized for concurrent tasks. I assume there is something similar in .Net, but after a quick search in MSDN I couldn't find anything. I was looking for a queue with fairness policy to be used in consumer/producer situations. Thanks. ...

Remoting server forcibly closing client connections in the middle of remote calls

Hello everyone. I have a system consisting of a server accepting remoting calls from clients with TCP as the underlying transportlayer. It normally works like a charm, but if I increase the no. of clients, the server starts at random to close the TCP connections in the middle of the calls. Not all calls are interrupted this way. That is...

WCF Configuration - Split it out of app.config

Hi all, I have a specific requirement to remove all client WCF configuration (<system.serviceModel>) out of the main app.config file, and into a separate XML file. The behaviour I would like to see is similar to that available in the appSettings section using the File="" directive. In fact, I'd ideally like to be able to specify a s...

F# - cross product of two lists

*Messing around with 'extension functions' for the List module. (I spent quite a while developing 'mapfold' - which threads an accumulator like fold, but uses it as a parameter to create new values like map - then discovered that that is what List.scan_left does)* For generation of test data, I needed to do a cross product of two lists,...

Error when impersonating a user in .NET in a scheduled task

I have a .NET console app running on Windows Server 2003, as a scheduled task. This uses the Process class to run another little console app, but it uses Process.StartInfo.Username to impersonate a user to run it as. If the account that is impersonated in the scheduled task in an Administrator, then it works perfectly, but if not then ...

Group Box in WinForms

Hi everyone. I have a question about design winforms. Should I use, or not, group boxes in my forms? Is it good to the user? Give me some advantages, or disadvantages? Some people think thar it's not goog enough to use. What do you think about it? ...

.net password protection

need coding in .net for protecting a file using password? ...

Windows forms: how get the actual width of the item in the list box

To make sure that the text in listbox items is not truncated I want to adjust its width to the width of the item with longest text. Is there any way to get a "actual" width of the listbox item the one which is based on the item's text. ListBox.GetItemRectangle does not seem to be returning this actual width. thank you. ...

In-memory DBMS's for unit testing

I am looking for satisfactory options for unit testing my .NET DAL classes; since they're DAL classes, they access the database directly using ADO.NET. Presently I use an instance of a MSSQL database for the testing, but was wondering what faster options there are---since unit tests need to run as quickly as possible, an in-memory solut...

How do I change a web site from an IIS hosted site to an ASP.Net Development Server hosted site?

On my previous machine I had IIS6 installed and created a web project using IIS as the host. This project was completed, published to an internal hosting server and checked in to source control. I now need to go back and make a minor change to the project, however in the meantime I have acquired a new machine. On my new machine I don’t...

Converting from VS 2008 Web Site to Web Application Project

I am in the process of converting a VS 2008 Web Site to a Web Application Project. I have followed the instructions on the MSDN site but am now getting a whole bunch of weird errors. I should mention that I did this for another project about a week ago and didn't have any issues. The error I am getting is this: The type 'XXX' already...

How to do dynamic object creation and method invocation in .NET 3.5

How does the code looks that would create an object of class: string myClass = "MyClass"; Of the above type, and then call string myMethod = "MyMethod"; On that object? ...

Implementing and using the ICommand interface, MVVM

Although I deeply fell in love with the MVVM pattern there seem to be a lot of problems I cannot (yet) figure out for myself. I wonder what the parameters of the methods of the IComamnd interface are good for e.g. void Execute(object parameter); I tie my view to the view model like this <Button Command="{Binding SomeCommand}" ... /> ...

How to block downloads in .NET WebBrowser control?

I need to prevent the .NET WebBrowser control from showing any "Do you want to open or save this file?" and "Save As" dialogs. Instead, I want to display a message box telling users that file downloads are disabled for security reasons. I started with the FileDownload event of WebBrowser, but it does not allow cancellation. Then, I used...

Memory leak while using Threads

Hello. I appear to have a memory leak in this piece of code. It is a console app, which creates a couple of classes (WorkerThread), each of which writes to the console at specified intervals. The Threading.Timer is used to do this, hence writing to the console is performed in a separate thread (the TimerCallback is called in a seperate t...

DAL code generator that can handle mocking and testing, .NET

Hi, I have been testing the nusoft kinetic framework and have been pretty satisfied with it until now. I was going to make some tests with MbUnit and Rhino Mock when I realized that the hole framework was built with static methods and protected classes, making this untestable. My question is, does any one know about a framework like the...