I want to use a collection initializer for the next bit of code:
public Dictionary<int, string> GetNames()
{
Dictionary<int, string> names = new Dictionary<int, string>();
names.Add(1, "Adam");
names.Add(2, "Bart");
names.Add(3, "Charlie");
return names;
}
So typically it should be something like:
return new Dicti...
Background
I have a component that provides certain CRM services - specificCRM. I have a specificCRMAdapter which implements my IGeneralCRM interface.
Another component generalCRM exposes CRM functionality through IGeneralCRM and uses Spring.Net to inject the specificCRMAdapter to provide such funtionality.
Question
I want to be abl...
Hi All,
I often find myself implementing a class maintaining some kind of own status property as an enum: I have a Status enum and ONE Status property of Status type. How should I solve this name conflict?
public class Car
{
public enum Status
{
Off,
Starting,
Moving
};
Status status = Status.Off;
public Status ...
Let's say I have a controller action that deletes an item out of a user's shopping basket. This controller action is triggered by performing a POST to the url ~/delete/{id}. If I have several pages on my application that will post to this url, how do I construct the controller action to redirect back to the page that posted to it?
...
I have read many MSDN articles about assembly signing and I haven't found nothing about creating the key, just about creating the file, but the 3 methods listed to create a file needs a pre-generated key. Can you provide me a link to a tutorial to this?
...
What is the best way to list all available .NET 2.0 assemblies?
An example of the list needed is the one MS Visual Studio shows when you do 'Add Reference...' in the .NET tab.
I have read Visual studio uses its own directory configuration and the GAC another and .NET instalation another. Any ideas of how I can know where this directori...
I'm sure there's an elegant solution to the problem but I just can't get my head around it. I am trying to call a web service from within a Windows service. The web service is secured (using Windows authentication). The account that the windows service runs under does have the rights to call the web service but I can't figure out how to ...
I'm trying to pass a ViewData object from a master page to a view user control using the ViewDataDictionary.
The problem is the ViewDataDictionary is not returning any values in the view user control whichever way i try it.
The sample code below is using an anonymous object just for demonstration although neither this method or pass...
Should I use this.
Imports System.IO
Dim myStream As New Stream
or this..
Dim myStream As New System.IO.Stream
Does it make any difference to performance / memory usage?
...
I have a ini file that i want to read a line from under [DEVICE] tab and the following line DeviceName=PHJ01444-MC35 and assign the value to a string.
[BEGIN-DO NOT CHANGE/MOVE THIS LINE]
[ExecList]
Exec4=PilotMobileBackup v1;Ver="1.0";NoUninst=1
Exec3=MC35 108 U 02;Ver="1.0.8";NoUninst=1
Exec2=FixMGa;Ver="1.0";Bck=1
Exec1=Clear Log MC3...
New to WCF, but familiar with COM+ - can I wrap a WCF service inside a COM+ application?
I realize many people may ignore the question and question my motive (and that's fine), but I'd actually like to know if this is fundamentally possible as well.
...
I had another developer ask why I use List all over the place ... and I thought about it for a minute ... and couldn't come up with a definitive answer.
If you inherit from the collection base class to extend instead of using List(Of T) - what advantages do you get? Or - what don't you get with List?
...
Does the order in which I set properties using the object initializer syntax get executed in the exact same order?
For instance if I do this:
var s = new Person { FirstName = "Micah",
LastName = "Martin",
IsLoaded = true
}
will each property get set in the same order?
...
Is it possible to use a jQuery ajax call to perform Forms Authentication with ASP.NET MVC? I've been unable to find any such examples.
More specifically, how do I set the auth cookie on the page (without a redirect) so I can make successive authenticated ajax requests?
...
I have a winform with a listbox and a treeview.
Once my listbox is filled with items, I want to drag them (multiple or single) from the listbox and drop them in a node in the treeview.
If somebody has a good example in C# that would be great.
Thanks in advanced
...
I am building a system for distributing packages (.zip archives) created by different organizations. I'd like a way to verify that the publisher of a package is indeed who they claim to be, and that the file has not been tampered with.
To verify the publisher, a system similar to what is used by web browsers is required - e.g., my appl...
I don't know LINQ, but from reading a lot around this site and others, it's a MUST HAVE skill for C# developers.
The problem is I am so booked on projects at work I have no time to pick up LINQ, I need to convince my boss to let me (and fellow coders) set aside some time so that we can become a LINQ house.
So.. my question is, what ar...
This is one of the most used Regex functions
Regex.IsMatch("Test text for regex test.", "(test)",
RegexOptions.IgnoreCase | RegexOptions.Multiline);
Can you explain how Regex.IsMatch method works ?
I mean how it handles bitwise OR RegexOptions parameters ?
How it defines method parameters ?
Thanks for replies !
...
I want to retrieve items from Fortress via its .NET API and load their descriptions into Project 2007. I was thinking about the 'best' way to do this, so I thought I would put it to my fellow stackers:
Should I write a .NET assembly and wrap it in COM for Project 2007 to call from VBA?
Or should I write a .NET assembly that calls Proje...
I've got a simple MVC (RC1) app set up, and I'm seeing some odd behavior. The Home/Index page shows a list of items using a ListView. Here's the HomeController code:
Function Index()
ViewData("results") = From m In context.MyTable
Return View()
End Function
The Home/Index.aspx page just has a ListView on it, and the code behin...