.net

Linq return IEnumerable<MyObject>, how to return MyListObject instead?

Hello, Is there a way without looping all the IEnumerable to get back the data inside the object (that inherited BindingList)? MyListObject--> Transformed with Linq --> Back the data inside MyListObject I know that I can do .ToList but it doesn't do what I would like. Any idea? Thank :) ...

Does File.Copy() from a network share to another share on the same machine copy the file over the network?

If my .NET client uses System.IO.File.Copy to copy a file from \server1\share1\file1.txt to \sever1\share2\file2.txt, does the file's data get read down to the client and then written back up to the server? If yes, is there any way a .NET client can copy a file on a server to another location on the same server without round-tripping the...

Modify method parameter within method or return result

What is the difference between private void DoSomething(int value) { value++; } and private int DoSomething(int value) { return value++; } when used as either DoSomething(value); versus value = DoSomething(value); ...

Example of JSON-P with WCF?

I'm trying to make a WCF service that will work with JSON-P (long-story short, we have to call the web-service cross-domain and receive a call-back, so I need it to work with JSON-P). I found a code-sample on MSDN (http://msdn.microsoft.com/en-us/library/cc716898.aspx). If I extract the ZIP file and navigate to Samples\WCFWFCardSpace\WC...

Crossplatform way to change screen resolution

Is there any crossplatform way (Windows, Linux, MacOSX) to change screen resolution? Neither Java nor .Net-Mono can do it. Only through native API invocation. It's very strange situation: there are clear (managed) methods to obtain screen resolution, but method for setting is absent. Is this feature very dangerous or complicated? Does a...

.Net equivalent for ScaleHeight and Scalewidth

Basically what I am trying to do is make my drawing job easier. Back in the days of VB6 there was something called Scalewidth and Scaleheight and I could set them to custom values. Ex. 100. Then when I needed to draw a point at the center of the available space i would just draw it at 50,50. Is there any way in .Net that I can get si...

[C#] What does this compiler-generated enumerator mean?

I wrote a fairly complex method that yield-returns IEnumerable<string>, but when I inspected the compiler output in Reflector, I didn't understand a specific part of the compiler-generated implementation of IEnumerator: void IDisposable.Dispose() { switch (this.<>1__state) { case 1: case 2: case 3: ...

Which .NET dependency injection framework do you use?

Currently there are quite a few DI/IoC-frameworks for .NET out there (http://www.hanselman.com/blog/ListOfNETDependencyInjectionContainersIOC.aspx). I find it quite hard to choose. Therefore I wanted to measure the public opinion and see which framework is the most popular - so please post your favorite framework here and let the people ...

Composit Control Textbox and AutoCompleteExtender

I'm trying to make composite web control contains TextBox and AutoCompleteExtender i followed this article http://byatool.com/?p=244 when i run the page i got nothing just empty page and i got this <div> <span id="AutoCompleteTextBox2" FirstRowSelected="false" OnClientPopulated="ClientPopulated" CompletionListHighlightedItemCssCla...

What's the @ in front of a string for .NET?

This is a .NET question for C# (or possibly VB.net), but I am trying to figure out what's the difference between the following declarations: string hello = "hello"; vs. string hello_alias = @"hello"; Printing out on the console makes no difference, the length properties are the same. Thanks! ...

Spicing up the Visual Studio IDE

Currently I have ReSharper installed to help me develop and edit code, and made a good layout for my Visual Studio (2008) over two screens. I have changed the settings of the text windows (mainly the output Window on the right) to have a black background and smaller text. I tried SlickEdit gadgets yesterday, but it doesn't perform very ...

How to load an image dynamically to a report?

Hi all. Is there a way to load an image dynamically to a report based on image path. The image file name is stored in database. FYI. I'm using CrystalReport designer embedded with VS.NET 2005. ...

Could not load Microsoft.VisualStudio.Web.ToolboxItemConfiguration in Windows Forms project

Hi all Need help in a very strange questions (at least it seems strange to me). I have a solution with one Windows Forms project and a few class libraries. There is a Service Reference added to the Windows Forms project. When launching Visual Studio, I get the following error message: Could not load type 'Microsoft.VisualStudio.Web...

How can a static class derive from an object?

I am trying to inherit a non-static class by a static class. public class foo { } public static class bar : foo { } And I get: Static class cannot derive from type. Static classes must derive from object. How can I derive it from object? The code is in C#. ...

How to start a WCF service outside Visual Studio?

I just created a WCF service with this MSDN tutorial. from within Visual studio I can CTRL-F5 the service so it is running then I can start my Console Application Client and consume the service no problem Now I want to start my service OUTSIDE visual studio and have various clients consume it. But when I go to the command line and e...

Showing Excel Documents on the Web

I'm looking for a way to present excel documents on the web either by : converting Excel documents to html, css and javascript or by, using silverlight control I'm not looking for a way to program the conversion by my self. What I'm after is a control or library (open source or third - party ) which will enable me to present excel file...

Cannot debug website: no symbols loaded

I'm suddenly getting an intermittent error with break points for my website. I'll get the solution from svn work for a ~ a day on it and then the next day I'll insert a break point and all of a sudden I get the "no symbols message". I've tried deleting all obj and bin folders. verfiying all pdb files are in datetime sync with .dlls ...

Concurrent read access on an int[] array: Is it safe? Is it fast?

On a quad-core machine, I am considering the parallelization of C#/.NET algorithm which involves having multiple threads reading the small int[] array concurrently. So far, it seems to be working rather well, but I am not sure where it is specified that concurrent reads on an array are thread-safe in .NET. Any pointers? Then, I am also ...

Getting Masterpage Name in asp.net MVC

Whats the earliest point I can programatically get to the name of the masterpage that will be used in an asp.net MVC application? The idea being changing the viewdata used depending on the master page. I want to be able to set something as early as possible so that individual developers don't need to know to populate it. Ideally it woul...

Predicate Delegates in C#

Can you explain me; What is Predicate Delegate ? Where should we use predicates ? Any best practices about predicates ? Descriptive source code will be appreciated, Thanks for all replies ! ...