references

Get pathes of assemblies used in Type

hi I need a method that takes a Type and returns the pathes of all assemblies that used in the type. I wrote this: public static IEnumerable<string> GetReferencesAssembliesPathes(this Type type) { yield return type.Assembly.Location; foreach (AssemblyName assemblyName in type.Assembly.GetReferencedAssemblies()) { yield return ...

C#: In what cases should you null out references?

The CLR Profiler can also reveal which methods allocate more storage than you expected, and can uncover cases where you inadvertently keep references to useless object graphs that otherwise could be reclaimed by GC. (A common problem design pattern is a software cache or lookup table of items that are no longer needed or are safe to r...

Protecting shared DLLs from being unregistered / deferenced during uninstall?

My .Net program in C# is referencing a proprietary DLL, which my program uses to access their API. Everything works great.. however, when I uninstall my program (add/remove programs), the original program (not mine) will no longer run because it appears that the DLL file has been dereferenced or unregistered by Windows/.Net. I've gone ...

Loading a C#dll into a C# exe

Hi Members I am new to C# can any please tell how to load a dll created in C# to a exe in c# I have .NetFrameWork 3.5 and my o.s Vista ...

Getter and setter, pointers or references, and good syntax to use in c++?

Hi, I would like to know a good syntax for C++ getters and setters. private: YourClass *pMember; the setter is easy I guess: void Member(YourClass *value){ this->pMember = value; // forget about deleting etc } and the getter? should I use references or const pointers? example: YourClass &Member(){ return *this->pMember; } ...

referencing 32 assemblies on a 64 bit windows dev box

I and my co-developer have installed Microsoft Expression studio 3. I set a reference to the new mediaplayer and checked in my project. The co-dev get the project from TFS and can't do a build because of missing references. Odd I said --- until I realized that I was running on a 64 bit environment and he was not. This means that E...

How do I store a 2d array in a hash in Perl?

I am struggling through objects in perl, and am trying to create a 2d array and store it in a hash field of my object. I understand that to create a 2d array I need an array of references to arrays, but when I try to do it I get this error: Type of arg 1 to push must be array (not hash element) The constructor works fine, and set_seqs wo...

C++ linker issues

Hello there, I have this: a.cpp int localfunction () { return 1; } int local_symbol = localfunction(); b.cpp void thirdfunction () {}; main.cpp void main () { thirdfunction (); } When I compile this in a main executable everything works (even with optimizations), and the localfunction is executed at startup even if I don't ...

Assembly references for dymanically loaded DLLs

Hi, I have 4 assemblies: Tester.exe ToyInterface.dll ToyFactory.dll --> reference (ToyInterface.dll) Toy.dll --> reference (ToyInterface.dll) Tester.exe internal ICollection<string> Scan(string path){ return ToyCollection = _reportFactoryType.GetMethod(FACTORY_GET_TOYS). Invoke(_ToyFactory, null); } ...

Find all variables that point to the same memory in Visual Studio

In Visual Studio 2008, is there a way of finding all the variables that point to the same object as another variable? So in the example below I would want to find out that ref1 and ref2 both point to the same object as original. var original = new List<string>() { "Some Data" }; var ref1 = original; var ref2 = ref1; Essentially I wan...

In Perl, how do you access a value from a reference in an array of hashrefs?

I have an array of references to anonymous hashes. From the reference to that array, $allDirArray, I want to access the value corresponding to the key 'dir'. Currently I am getting the error: Can't use string ("HASH(0x100878050)") as a HASH ref while "strict refs" in use at nameOfProgram.pl line 148. My code: my $tempDir = ${$allDi...

C# - Find output

Hi All, I have the following C# code below. Object first = 5; Object second = 10; second = first; Console.WriteLine(first + " " + second); Object a = 3; Object b = a; a = 6; Console.WriteLine(a + " " + b); I get the following output: 5 5 6 3 Actually I am expecting "6 6" as the second set. Can anybody explain where ...

How can I find the number of elements in hash of an arrayref?

$HoA{teletubbies} = [ "tinky winky", "dipsy", "laa-laa", "po" ]; How can I find the number of elements in this hash of arrayref(s)? It should return 4. ...

What's the low-level difference between a pointer an a reference?

If we have this code: int foo=100; int& reference = foo; int* pointer = &reference; There's no actual binary difference in the reference's data and the pointer's data. (they both contain the location in memory of foo) part 2 So where do all the other differences between pointers and references (discussed here) come in? Does the com...

Visual Studio 2008 - Build overwriting bin referenced dlls

I'm trying to figure out if what I'm experiencing in 2008 is new or something wrong with my installation. We have multiple web application projects and multiple class libraries. Both the web projects and class library reference the same third party dll, but each from their own bin. The third party dll in each of the web projects may ...

Teaching References in C#

In a couple of weeks, I'll be teaching a class of first-year engineers the salient points of references in C# as part of their first-year programming course. Most of them have never programmed before, and had enough trouble learning objects, so teaching references is going to be an uphill battle. I plan to have lots of examples availab...

Problems returning vector stack reference

Hello, I am working on an application that builds a vector of structs for items in a given directory and returns a reference of the vector for it to be read, I receive the following errors when attempting to compile the example code below: 1. 'class std::vector<indexStruct, std::allocator<indexStruct> >' has no member named 'name' 2. n...

error when passing a reference to a derived object in a method

In c# I am trying to implement a method which I can use to bind data to any control I pass to it (provided of course the control is derived from a databoundcontrol object) given the method public void CTLBindData(ref DataBoundControl ctl){ ... } I get an error when trying to pass derived control to the function for example the follo...

vb.net: Get to resources of a referenced project

I have a project which contains all custom controls and images; we'll call it projectBase. Now I have created a windows forms project (project1) that references projectBase. I need to access the embedded resource (images) of projectBase in project1. Any idea how i can pull this off? ...

C# - Get number of references to object.

I'm trying to write a simple Resource Manager for the little hobby game I'm writing. One of the tasks that this resource manager needs to do is unloading unused resources. I can think of doing this in two ways: When an object no longer requires a reference to the resource, it must call a method of the Resource Manager to signify it is ...