How do I alter the contents of an IDictionary using C# 3.0 (Linq, Linq extensions) ?
var enumerable = new int [] { 1, 2};
var dictionary = enumerable.ToDictionary(a=>a,a=>0);
//some code
//now I want to change all values to 1 without recreating the dictionary
//how it is done?
...
Is there a way to run .net based applications without .net framework installed. Is there a way to do this. Is there a software that can achive this. Commercial software is also possible.
Added:
Has anyone any experience with VMWare thin client?
...
I was thinking about the classic issue of lazy singleton initialization - the whole matter of the inefficiency of:
if (instance == null)
{
instance = new Foo();
}
return instance;
Anyone who knows what a Singleton is is familiar with the issue(you only need the if once). It's trivial but irritating.
So, I thought of an alternate ...
I know how to use the ConfigurationFileMap class and ConfigurationManager.OpenMappedMachineConfiguration to load a Configuration object from a file, but is there a way to just load a Configuration object from purely the XML?
...
Hey,
I have a problem with VS2008: When I create a new ASP.Net website, no database shows up in the AppData folder. I create a new one via the server browser, and then apply "Add existing item" on the AppData folder to "import" the database. Is this the right way to do it?
Plus when I chose Website / ASP.Net configuration, my CPU works ...
I have project X, fully operational that compiles into X.exe
I have project Y, it has a reference to project X, and compiles to: Y.exe; Y.dll
I build project X's solution and the release folder has: X.exe
I build project Y's solution and the release folder has: X.exe, Y.exe, Y.dll
How do I remove the extra X.exe in project Y?
...
I've recently found the need to check at compile-time whether either: a) a certain assembly reference exists and can be successfully resolved, or b) a certain class (whose fully qualified name is known) is defined. These two situations are equivalent for my purposes, so being able to check for one of them would be good enough. Is there a...
I'm trying to build a simple app for parenting control in .NET. The main idea is to force a certain user account to run my app and to block all access to windows desktop UI. Anyone know how can i achieve this or where should i start researching? Thanks.
...
I don't like the default ToolTip behavior. First, I don't like that, after tooltip is shown for "AutoPopDelay" miliseconds, it disappears and don't appear anymore if you move the mouse over the control again. Second, I don't like that AutoPopDelay is limited to 5000 miliseconds.
I found one way to make tooltip always reappear on mouse...
I know this will be easy, but I can't seem to find it anywhere. How do you SET the current row in a gridview? I find tons of ways to get data from it, but I what to set a current row or cell programatically. I'm using VB 2008 express. I also find lots of promising properties like Selected... but these are all read only and i can't se...
When I create a WCF application using the built-in Visual Studio templates and try calling it while in a loop, only 5 requests get through. The service then stops responding. The only way that I can get around this is to close the connections after each call.
I know that you are supposed to clean up after yourself, but I also know that...
So I've been reading lots about interprocess communication on .Net. Named pipes, remoting. It all seems great but possibly overkill for what I need to do.
I want to add a command line interface to my WPF application, so I need a simple IPC mechanism to send the string from one process to the already running app.
What does SO recommend...
This is a question about LINQ the .NET language feature, not LINQ to SQL.
I find that the ability to query almost any in memory collection in such a consistent and declarative way is one of the best language features I've ever come across.
I find it extremely useful, and I love the clean abstraction it provides. LINQ can even be used t...
I want to supply unknown "object" and return the value of one of its members. Response is required in C#.
Generically I guess I'm looking for the code to this method
public static object GetObjectMemberValue (object myObject, string memberName)
More specifically I'm doing this for resource strings in Silverlight and need to write this...
What should be the best way to write code:
1)
Dim current = Request.Path
current = current.Remove(0, 1)
current = current.Replace(".aspx", "")
2)
Dim current = Request.Path.Remove(0, 1).Replace(".aspx", "")
3)
Dim current = Request.Path
Dim current2 = current.Remove(0, 1)
Dim current3 = current.Replace(".aspx", "")
Or 1-2 mak...
I'm starting to really love extension methods... I was wondering if anyone her has stumbled upon one that really blew their mind, or just found clever.
An example I wrote today:
Edited due to other users' comments:
public static IEnumerable<int> To(this int fromNumber, int toNumber) {
while (fromNumber < toNumber) {
yield...
Extension methods are awesome and make programming so much more fun that I am constantly scouring the internet for new ones.
Does anyone know if a web site exists that is dedicated to Extension methods, something similar to a code gallery but dedicated to C#/VB.NET Extension methods?
...
I have a few .Net assemblies, same version, same file name, but located at different location:
Program folder
C:\Windows
C:\Windows\system32
GAC
Now, which location's assembly will be loaded first?
...
First Post!
So I'm working on Windows Mobile application for a class I'm in. We have a user's data being serialized to an XML file, which is working great. But I was wondering if there's a way to tell whenever a user quits the application(by clicking the X in the top right) so I can commit the changes to the XML file at the end of the a...
I'm making a Win app on the 3.5 framework. I'd like to include a database file with the app. This would a single-user db. I looked at the 2 different types of db files I can add, the sdf and mdf. Thw sdf (compact) db is missing some functionality I need, so I prefer the mdf. The description on the mdf file "Service oriented database f...