Questions tagged [object-reference]

An Object reference is a pointer to an object stored in memory. The main difference is that the object was previously created (via a new operator, for instance) and its reference is kept via an additional variable, that is, its object reference.

An Object reference is a pointer to an object stored in memory. The main difference is that the object was previously created (via a new operator, for instance) and its reference is kept via an additional variable, that is, its object reference.

More Info

325 questions
31
votes
2 answers

Reference to a non-shared member requires an object reference occurs when calling public sub

I have a Public Class "General" in which is a Public Sub "updateDynamics". When I attempt to reference it in the code-behind for a page like so: updateDynamics(get_prospect.dynamicsID) I get the following error: reference to a non-shared member…
Dave Mackey
  • 4,306
  • 21
  • 78
  • 136
19
votes
2 answers

Temporary lifetime extension

Section 12.2.5 of the standard says: A temporary bound to a reference parameter in a function call (5.2.2) persists until the completion of the full expression containing the call. A temporary bound to the returned value in a function…
Kolyunya
  • 5,973
  • 7
  • 46
  • 81
17
votes
1 answer

How to check a "NULL object reference" in Managed C++?

I come across some MC++ code like this: __gc class ClassA { Puclic: ClassB GetClassB(); } __gc class ClassB { Public: int Value; } int main() { ClassA^ a = gcnew ClassA(); ClassB^ b = a->GetClassB(); int c =…
Echo
  • 173
  • 1
  • 1
  • 4
13
votes
2 answers

how are C# object references represented in memory / at runtime (in the CLR)?

I'm curious to know how C# object references are represented in memory at runtime (in the .NET CLR). Some questions that come to mind are: How much memory does an object reference occupy? Does it differ when defined in the scope of a class vs the…
chopperdave
  • 526
  • 4
  • 12
13
votes
5 answers

How to determine whether object reference is null?

What is the best way to determine whether an object reference variable is null? Is it the following? MyObject myObjVar = null; if (myObjVar == null) { // do stuff }
CJ7
  • 22,579
  • 65
  • 193
  • 321
11
votes
2 answers

In Java9, finalizers have been deprecated, instead cleaners have been introduced. What is the difference between the two?

In Java9, finalizers have been deprecated and new concept of cleaners have been introduced. What was the specific reason for it? Is there any particular scenario or reason where cleaners should be preferred over finalizer(given that none of them are…
Chota Bheem
  • 1,106
  • 1
  • 13
  • 31
10
votes
2 answers

List - UPSERT database record using C# Entity Framework

I have an Employee object, I'm trying to update a record (i.e., Update / Remove) using a multiple task (Parallel Execution) using single DB Entity Context. But I'm getting the following exception Message = "Object reference not set to an instance…
10
votes
1 answer

Can I disable AutoMapper reference cache?

I believe AutoMapper is using a cache when it is mapping lists of objects from one type to another. Take a look at the following code: namespace ConsoleApplication { class Program { static void Main(string[] args) { …
BlakeH
  • 3,354
  • 2
  • 21
  • 31
8
votes
2 answers

How Java String pool works when String concatenation?

Beware: I'm not trying to compare if the characters are equals. Because I know how to use the String.equals() method. This question is about String reference I was studying for the OCA exam when I started to learn about the class String and it…
xsami
  • 1,312
  • 16
  • 31
8
votes
5 answers

.NET XmlSerializer and multiple references to the same object

My repository has List, List and List where an Enrolment has Enrolment.Student and Enrolment.Course which are references one of the students or courses in the two previous lists. When I use XmlSerializer on my…
Luke Rohde
  • 261
  • 3
  • 14
5
votes
1 answer

How to locate the method that throws "NullReferenceException: 'Object reference not set to an instance of an object'?

I've already checked every similar question on Stackoverflow. None of them either answer or really ask the same question. Is there a way to find the method that attempts to reference said null object? I understand it can't say what object since it…
5
votes
4 answers

Behavior of C++ Object Reference

Consider the following code segment: class Window // Base class for C++ virtual function example { public: virtual void Create() // virtual function for C++ virtual function example { cout <<"Base class…
Shamim Hafiz - MSFT
  • 21,454
  • 43
  • 116
  • 176
5
votes
1 answer

"object reference not set" displaying in Design view of asp.net default.aspx file in Visual Studio 2010

I found another thread with a similar problem here: Visual studio 2010: Can't show design view but in my case I'm not using a custom control. On a Win7 32 bit machine I am using Visual Studion 2010 to create an asp.net web applications using Visual…
5
votes
4 answers

Different object references for the same(?) object

I have asked about getting unique instance of class from another class recently. ( How to get specific instance of class from another class in Java? ) So, I am trying to make it work: My Application: public class Application { // I will always…
Edward Ruchevits
  • 6,411
  • 12
  • 51
  • 86
4
votes
1 answer

How to choose the ARC bridge specifier for object pointer pointers (id *)?

I wrote a little convenience method on NSArray which works like PHP's list() function for "unpacking" an array into distinct objects: - (void)unpackInto:(__strong id *)obj1, ... { __strong id *idPtr; va_list args; va_start(args, obj1); …
1
2 3
21 22