I have some javacsript code looking something like below. Notice how it makes a ajax call to "/ContollerName/ActionName" with some parameters. This works fine as long as the application is deployed on a site root in IIS. But if I deploy it on a virtual directory the path will point all the way back to the site root and it will fail.
$.g...
Does anyone have or has anyone come across an in depth guide to the .net app.config? I'm having significant issues trying to find a definitive guide to this area of .net.
I can already handle custom configuration sections, from basic key/value pair settings right through to complete custom configuration handlers which I struggled to fi...
In C# I can initialize a list using the following syntax.
List<int> intList= new List<int>() { 1, 2, 3 };
I would like to how that {} syntax works, and if it has a name. There is a constructor that takes an Ienumerable, you could call that.
List<int> intList= new List<int>(new int[]{ 1, 2, 3 });
That seems more "standard". When I d...
What's the difference between a dll's FileVersion and ProductVersion?
Specifically at runtime, is one used for strong binding, and the other informational?
I'd like to have one set manually, and the other incremented automatically (via our CI build process)
Edit: Richard answered the part I missed in the original question. It's A...
I've got the following ADO.NET Entity Framework Entity Data Model:
I want to find all the Policyholders with both a Service of a given Id and also a Keyword of a given Status.
This LINQ Does Not Work:
Dim ServicesId As Integer = ...
Dim KeywordStatus As Integer = ...
Dim FoundPolicyholders = From p As Policyholder In db.Policyholde...
I would like to look at the code for some of the classes in the .NET library. I find functions by using intellisense and just reading the tooltips that come up when I select different items.
One example is the Contains method that you can use on arrays to search for a given string. I just happened to stumble upon that while working on...
Hi,
How to Get an XML Element from XDocument using LINQ ?
Suppose I have an XDocument Named XMLDoc which is shown below:
<Contacts>
<Node>
<ID>123</ID>
<Name>ABC</Name>
</Node>
<Node>
<ID>124</ID>
<Name>DEF</Name>
</Node>
</Contacts>
XElement Contacts = from xml2...
The following simplified code doesn't work (because it sets the retrieved object reference to the parameter), but it shows what I want to do
public bool updateEvent(clubEvent newEvent)
{
TNightCon tCon = new TNightCon();
clubEvent cEv = (from cEvent in tCon.clubEvents
where cEvent.EventID ==...
I'm developing a C# program that needs to be able to schedule a variety of asynchronous tasks at different times. I need a solution that activates every second to check for tasks to execute, and eats up as few resources as possible. It also needs to scale well to a large number of tasks. Which of these is better to use, or is there any ?...
I'm aware that the best practice is to call Dispose on any object that implements IDisposable, especially objects that wrap finite resources like file handles, sockets, GDI handles, etc.
But I'm running into a case where I have an object that has a Font, and I would have to plumb IDisposable through several layers of objects, and review...
I have a class with two properties for max and min values. It looks like this (ish):
public class Configuration
{
public int Max { get; set; }
public int Min { get; set; }
}
When I serialize this I get something like:
<Configuration>
<Max>10</Max>
<Min>0</Min>
</Configuration>
However, I need an extra element like this:
<C...
My goal is use the .NET DateTime object (in C#) and have that be serialized to and parsed from a string (for use in XML) in a way that is standards compliant. The specific standard I have in mind is the ISO 8601 standard for representing dates and times.
I want an easy to use solution (preferably, one method call each way)
that will co...
Hi,
i Was wondering what people are using for logging in .net.
We have log4net here, but am looking to do it async and to a database
with a nice viewer.
What are the popular choices??
Regards.
...
I found this answer, but it is far from a simple code snippet that I can use in an existing application.
http://stackoverflow.com/questions/261089/controlling-cpu-utilization
There has to be a better way to do this with .NET 3.5 by now. Is there a way to poll the total CPU load for all threads?
...
Hi,
I am trying to customise a DataGridView cell to include a combobox and
a text field. So far myCell class derives from DataGridViewTextBoxCell
class.
My class has a Combobox as a private member but I am not sure how I
can render it. I am overriding the Pain method but I have no idea how
to draw the combobox. I set its location ...
I get the need to clean up resources during the teardown of an object, but I have always found the differences between Dispose, Finalize, and the destructor methods a bit confusing.
I found this great article that concisely describes the distinctions between them, that I am going to have to save for future reference:
"Difference between...
I'm having a problem where a collection of objects isn't being accessed correctly when run on a thread from a service. I can run my unit tests fine in VS2008 but when I attach the debugger to the service i can clearly see that it's not starting at the 1 based index but instead at the 0 based index. I've tried everything that I can thin...
For some reason I'm having issues Binding a custom User Control up through my ViewModel in an MVVM WPF application. The basic control is a Date entry form with three text boxes. I am using the codebehind for the usercontrol to capture the textchange event and so some manipulation. For some reason Adding Binding to the property never t...
I am building a client-server based solution; client being a desktop application and the server being a web application.
Basically, I need to monitor the performance and resource utilization of the client, which is a .NET 2.0 based Windows Desktop application.
The most important thing I need to monitor is the network resources the clie...
I have a regex to find the nth occurrence of a character in a string, here's the code:
public static int NthIndexOf(this string target, string value, int n)
{
Match m = Regex.Match(target, "((" + value + ").*?){" + n + "}");
if (m.Success)
{
return m.Groups[2].Captures[n - 1].Index;
}
...