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
2
votes
1 answer

Canvas wont enable it after got loaded in new scene

So I have a gameobject which loads new scenes when necessary. The script attached to the game object has a variable which holds the reference to a canvas element(the canvas element has a progressbar). The problem is that after I load a new scene and…
2
votes
2 answers

Python - modify vs. overwrite an object reference

Can someone explain modifying vs. overwriting object reference in an easy to understand way? Here is an example of what I mean: By modifying an object reference: nested_list = [[]]*3 nested result: [[], [], []] # now let me **modify** the object…
DanZimmerman
  • 1,626
  • 6
  • 23
  • 45
2
votes
1 answer

ASP.NET MVC Object reference not set to an instance of an object

I saw a similar question here on SO but I believe mine differs a little a bit. OK, so I have a simple view here: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master"…
Qcom
  • 18,263
  • 29
  • 87
  • 113
2
votes
1 answer

Object references and typecasting in JAVA

Do I still work on the same object data after a typecast of the data? A pseudo code sample could be: MyClass car = new MyClass(); car.setColor(BLUE); VW vw = (VW)car; //Expecting to get a blue VW. vw.topSpeed = 220; //Will car have the top speed…
7heViking
  • 7,137
  • 11
  • 50
  • 94
2
votes
2 answers

Assigning one primitive variable to another vs a reference variable to another

I would like to understand how primitive and object reference variable behaves differently. I have used the below code from OCA/OCP Java SE7 by Kathy Sierra as an example: public class VariableTesting { public static void main(String[] args) { …
David
  • 53
  • 1
  • 1
  • 7
2
votes
4 answers

object reference not set to an instance of an object error coming when deployin to cloud

Locally the project works perfectly. It is executing and there are proper entries in database. But when I am deploying it to cloud at staging it is giving me this error as object reference not set to an instance. My project requires 2 instances of…
2
votes
1 answer

Why would this event handler code cause a Object reference not set to an instance of an object. Error (only present on live server, ok on dev)?

Here is the code for the button click event; Protected Sub CompetenciesButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CompetenciesButton.Click Dim con As String =…
Phil
  • 1,811
  • 9
  • 38
  • 60
2
votes
3 answers

Testing object instance returns "Conversion from string "" to type 'Boolean' is not valid."

I am trying to test for an instance of an object, but VB pukes and throws the exception: Conversion from string "" to type 'Boolean' is not valid. Here is how I am testing: Dim objGA As New Gatherer.Gathered("", -1) objGA = objGatherers(idx) If…
Roy Hinkley
  • 10,111
  • 21
  • 80
  • 120
2
votes
3 answers

item.Delete() gives Object reference not set to an instance of an object error in Sitecore

In my Sitecore application I have the below statements. using (new Sitecore.SecurityModel.SecurityDisabler()) { Item item = database.GetItem(itemId); if (item != null) { item.Delete(); } } The item…
Sandun Perera
  • 541
  • 6
  • 21
2
votes
3 answers

How do I use Static Objects and Methods!? C++ Frustration

So I've been working on my what I thought would be quick and easy project for a couple hours now and I can't get it to work! It's making me frustrated lol I've got to be close, but maybe I'm not. I'll include my code with comments explaining what it…
2
votes
2 answers

Object reference not set to an instance of an object (timer array)

I am using the following code but getting error Object reference not set to an instance of an object" on line 2. System.Timers.Timer[] timer = new System.Timers.Timer[10]; timer[0].Elapsed += new ElapsedEventHandler(DoJob); Why?
Ali
  • 1,801
  • 6
  • 43
  • 58
2
votes
3 answers

object reference not set to an instance of an object

I have assigned two string array: string[] SelectColumns = {},WhereColumns={}; Both of them are full of data items. For example SelectColumns.length = 7,WhereColumns.Length=3; When i went to implement them i got an exception: object reference not…
Abdur Rahim
  • 3,975
  • 14
  • 44
  • 83
2
votes
3 answers

"Object reference not set to an instance of an object" Error

Im Having Problems Figuring Out Why I am Receiving an "Object reference not set to an instance of an object" Error in the Presentation Layer with this line: TempAccountManager.Accounts.Add(tempAccount); I Have Walked Through the Code With Visual…
2
votes
5 answers

storing an object reference in byte array

I have a byte array and an object reference. byte[] data = new byte[128]; Block b = new Block(); I want to store reference b in last 2 (or 4) bytes of "data" array. Kindly Note: I dont want to serialize the object and store in byte array.…
Anupam Gupta
  • 1,591
  • 8
  • 36
  • 60
1
vote
1 answer

Check if linq object is referenced

What is the best (fastest) way to check if a linq object is referenced from another table. Normaly i do this way but i guess this might be slow on bigger tables. CurrentObject.ReferencingObjects.Count != 0 This might be…
Andreas
  • 6,958
  • 10
  • 38
  • 52