Edit: I'm well aware of that this works very well with value types, my specific question is about using this for reference types.
Edit2: I'm also aware that you can't overlay reference types and value types in a struct, this is just for the case of overlaying several reference type fields with each other.
I've been tinkering around wit...
I have a REST web method in .NET 3.5:
[OperationContract]
[WebInvoke(UriTemplate = "", Method = Verbs.Get)]
public string GetBar()
{
return "foo";
}
The response gets formatted as <string>foo</string> while I would prefer <bar>foo</bar> instead. Does anyone know how to do that? I feel I am missing something obvious.
...
I have a program that works when, a file is opened with it using the right click menu in explorer. But if I select multiple files and then right click and open with my program then it opens multiple instances of my program, instead of just passing the multiple files as arguments to a single instance. The program is written in vb.net but ...
I want to build a speech recognition engine in ruby. I know i'll never get there, doing it just for fun. I need to get data for the frequencies of the sound stored in a wav file to compare with data i already have of different sounds that i want to recognize.
I will write the code in ruby but i dont think there are any libraries for thi...
Hi,
I have the input file contains large amount of transactions like
Transaction ID Items
T1 Bread, milk, coffee, juice
T2 Juice, milk, coffee
T3 Bread, juice
T4 Coffee, milk
T5 Bread, Milk
T6 Coffee, Bread
T7 Coffee, Bread, Juice
T8 Bread, Milk, Juice
T9 Milk, Bread, Coffee,
T10 Bread
T11 Milk
T12 Milk, Coffee, Bread, Juice
i wan...
How to save user imputed value in TextBox? (WPF XAML) So in my xaml window I have a TextBox. User sturts my application inputs some values in to it and presses a button or hints Enter. He closes an app. Opens it up again. How to make his inputs be saved in that TextBox in WPF?
...
I have heard that the .NET 4 team has added new classes in the framework that make working with threads better and easier.
Basically the question is what are the new ways to run multithreaded tasks added in .NET 4 and what are they designed to be used for?
UPD: Just to make it clear, I'm not looking for a single way of running parallel...
When serializing a C# class using XmlSerializer, the attributes/elements representing the properties of the class will have the same names as they do in the source code.
I know you can override this by doing like so:
[XmlAttribute("num")]
public int NumberOfThingsThatAbcXyz { get; set; }
I'd like the generated XML for my classes to b...
Yes, it is possible to generate tests on boundary values for functions like "Sum" or "Divide". Pex is a good tool here.
But more often we create tests on business behaviour. Let's consider example from classic Beck's tdd book:
[Test]
public void ShouldRoundOnCreation()
{
Money money = new Money(20.678);
Assert.AreEqual(20.68,money.Amou...
I have two images the same size. What is the best way to find the rectangle in which they differ. Obviously I could go through the image 4 times in different directions, but i'm wondering if there's an easier way.
Example:
...
I want to use AdPlus to diagnose out of memory errors. To run the "hang" memory dump, I need to provide the process ID of my app. What would that be and how do I go about finding that?
...
Hi,
Something I don't enjoy about programming is learning a new API. For example, right now I'm trying to learn Windows Identity Foundation. Its frustrating because I'm going to spend the bulk of the time learning how a few classes work and actually only write several lines of code.
In .NET, there are so many types that I seem to spe...
Hi all,
I have a cascading dropdown (3 of them) Type, Categories and Sub Categories. Type loads first and upon selection of Type, Category load and selection of Category, Sub Category loads.
Also i have 2 buttons, "Add Category" and "Add Sub Category" Upon clicking on these buttons, i call a JQuery Modal Form to add them. I use Webmetho...
So... I want to return value when C# function is called. I need a code example (simple summ of a,b values will be ok) Please help
I need something like this ( I know ActionScript so I will write in it):
public function sum(valueA:int, valueB:int):int
{
var summ:int = valueA + valueB;
return summ;
}
How to translate it into C#?...
So I have a function
public int Sum(var valueA, var valueB, var valueC) {
var summ = valueA + valueB;
return summ;
}
I want to add to summ valueC if it was given. And let user not specify it if he does not want to. How to do such thing?
...
I mean can I do something like this:
var client = new WebClient();
var result = client.DownloadString(string("http://example.com/add.php");
var result2 = client.DownloadString(string("http://example.com/notadd.php"));
in paralel like for 100 url's ?
...
EDIT: It kind of occurred to me too late (?) that all the code I posted in my first update to this question was way too much for most readers. I've actually gone ahead and written a blog post about this topic for anyone who cares to read it.
In the meantime, I've left the original question in place, to give a brief glimpse at the proble...
In F#, there's the NativePtr module, but it seems to only support 32 bit offsets for its’ add/get/set functions, just like System.IntPtr does.
Is there a way to add a 64 bit offset to a native pointer (nativeptr<'a>) in F#? Of course I could convert all addresses to 64 bit integers, do normal integer operations and then convert the resu...
Hello,
I need to perform asp.net web-service function call via jQuery and pass asp.net application path to it. That's the way I'm trying to do it (code is located within asp.net page, e.g. aspx file):
var d = "{'str':'<%=System.DateTime.Now.ToString() %>', 'applicationPath':'<%=GetApplicationPath() %>'}";
$.ajax({ type: "POST...
I have an application which currently has an option to call phone numbers. Now by default it opens the Windows Phone dialler utility and tries to call the number.
I want it to instead make the call using skype, so what I was thinking was to create a c# application which would capture the callRequest and instead call skype.exe /callto:
...