I want to pass a reference type by value to a method in C#. Is there a way to do it.
In C++, I could always rely on the copy constructor to come into play if I wanted to pass by Value. Is there any way in C# except:
1. Explicitly creating a new object
2. Implementing IClonable and then calling Clone method.
Here's a small example:
Let...
I work on a medium sized development team that maintains a 8+ years old web application written in Java 1.4.
For new development I always try to convince people to adhere to newer standards and best practices, That goes from simple things like using new naming standards like HtmlImplementation over HTMLImplementation, to things like why...
Is there any way in javascript to create a "weak reference" to another object? Here is the wiki page describing what a weak reference is. Here is another article that describes them in Java. Can anyone think of a way to implement this behavior in javascript?
...
I have two forms in microsoft access, one called Bill and the other one called Payment. They both have Total amount as a field in both of the forms. I am trying to reference the Bill total amount to the Payment total amount.
I have tried in the Payment total amount control source : =Forms!Bill![Total Amount]
but this doesnt seem to wo...
I'm having a problem adding a reference to a .NET assembly I built. Here's what I did.
I created a .NET assembly (testlib.dll).
I made sure it had a strong name (added a keyfile).
I creates a WiX installation project for that assembly.
I added Assembly='.net' and KeyPath='yes' to the File property for the assembly.
The installation w...
I have created a reference to an IIS hosted WCF service in my ASP.NET website project on my local workstation through the "Add Service Reference" option in Visual Studio 2008. I was able to execute the service from my local workstation.
When I move the ASP.NET web site using the "Copy Web Site" feature in Visual Studio 2008 to the deve...
Sometimes you have strings that must fit within a certain pixel width. This function attempts to do so efficiently. Please post your suggestions or refactorings below :)
function fitStringToSize(str,len) {
var shortStr = str;
var f = document.createElement("span");
f.style.display = 'hidden';
f.style.padding = '0px';
...
I'm creating an interface wrapper for a class. The member within the class is a reference(to avoid copying the large structure). If I create a private constructor, what is the best way to initialize that reference to appease the compiler?
struct InterfaceWrapper {
InterfaceWrapper( SomeHugeStructure& src ):m_internal(src){};
i...
When using call_user_func_array() I want to pass a parameter by reference. How would I do this. For example
function toBeCalled( &$parameter ) {
//...Do Something...
}
$changingVar = 'passThis';
$parameters = array( $changingVar );
call_user_func_array( 'toBeCalled', $parameters );
...
I get an error when I compile this code:
using System;
public struct Vector2
{
public event EventHandler trigger;
public float X;
public float Y;
public Vector2 func()
{
Vector2 vector;
vector.X = 1;
vector.Y = 2;
return vector; // error CS0165: Use of unassigned local variable 've...
The title pretty much sums it.
...
Hello,
I have a class which has a private member $content. This is wrapped by a get-method:
class ContentHolder
{
private $content;
public function __construct()
{
$this->content = "";
}
public function getContent()
{
return $this->content;
}
}
$c = new ContentHolder();
$foo = array();
$foo[...
I'e been programming Java forever, but have been away from it for a while. Can anyone recommend a really good Java reference, where "really good" is defined by "Good coverage of the language, detailed coverage of recent extensions, and written for the technical reader (not a "for Dummies" sort of book)"?
...
I have cyclical references in my hibernate domain model which is causing Betwixt to fail. I don't want to change my domain model. How do I change Betwixt to ignore the cyclical reference?
...
Hi all..
Been thinking, what's the difference between declaring a variable with [] or * ? The way I see it:
char *str = new char[100];
char str2[] = "Hi world!";
.. should be the main difference, though Im unsure if you can do something like
char *str = "Hi all";
.. since the pointer should the reference to a static member, which ...
I'm using the Apache Commons EqualsBuilder to build the equals method for a non-static Java inner class. For example:
import org.apache.commons.lang.builder.EqualsBuilder;
public class Foo {
public class Bar {
private Bar() {}
public Foo getMyFoo() {
return Foo.this
}
private int myInt ...
I am writing an application using the Microsoft enterprise library. I wrote a wrapper dll for that enterprise library dll. I want to use my wrapper in some windows form application.
The problem is that every time I want to use my wrapper I get an error in the compilation that says that a reference to the enterprise library dll is missing...
Hi, if I am given
void (int a[]) {
a[5] = 3; // this is wrong?
}
Can I do this so that the array that is passed in is modified?
Sorry for deleting, a bit new here...
I have another question which might answer my question:
If I have
void Test(int a) {
}
void Best(int &a) {
}
are these two statements equivalent?
Test(a);
Best(&a...
I am trying to 'swap' two cells' contents, and their mappings. To do this, I need to drag and drop a reference to the cell as opposed to the string value itself. I can then use this reference to update a Dictionary as well as get the value. It allows allows me to do the swap as I will have a reference to the old cell to add the value nee...
I want to collect a list of handy references on Haskell, that would be useful when one needs to be refreshed about the basic and mundane or move to more advanced materials.
In terms of books, Real-World Haskell doesn't seem to fit the bill, because it's moves a bit slowly. On the other hand, I like Programming in Haskell. Even though it...