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
1
vote
2 answers

Custom AS3 class is null after being added to Array

I'm a C# developer who is trying to learn some AS3, so this is going to be a pretty newbie question. I'm getting confused with regards to scope and GC, as I have a custom MovieClip-extending class (Slide) which I create instances of within a loop…
tags2k
  • 82,117
  • 31
  • 79
  • 106
1
vote
2 answers

Object reference not set to an instance of an object? VB.NET

I have this code here: Dim MasterIndex As String()() Private Function Lookup(ByVal Search_path As String) As Integer Dim i As Integer = 0 Do Until MasterIndex(i)(0) Is Nothing If Search_path = MasterIndex(i)(0) Then …
jayjyli
  • 771
  • 3
  • 11
  • 23
1
vote
1 answer

C# User Input Validation

how can I validate user input in my method with my interface, where all allowed inputs are stored? if I do so then I get System.NullReferenceException: public interface INumbUnit { public string UnitName { get; set; } } public…
1
vote
2 answers

C# 10.0 - How should I work around this particular "chicken and egg" problem involving two object that contain each other?

So I'm working with code in which there are two object that contain each other, inside a list of which I do not know the contents of until runtime. I have a function that needs to convert the first object to a third object, but to do such I need to…
GreenChild
  • 13
  • 3
1
vote
0 answers

Memory allocation to variable in a method

I have a question on how a particular line of code works in regards to memory allocation. I am referring a piece of code to convert array list into linkedlist. Attaching the code below // C# implementation of the above approach using System; …
vjalex
  • 63
  • 2
  • 13
1
vote
0 answers

Is it possible in JS to know where a reference is in its hierarchy?

I have a case where I want to mark my 'posts' (like articles) with the country they belong to, while allowing to go a scope higher: example france < europe < world This is how I structured my hierarchy: world.js export default { world: { …
Zied Hamdi
  • 2,400
  • 1
  • 25
  • 40
1
vote
1 answer

How to access a member of a Blazor page from a C# file

This is in a new blazor project template in visual studio. Index.razor: @code { bool test = false; } Program.cs: NewProject.Pages.Index.test = true; This throws "an object reference is required for the non-static field, method, or property…
1
vote
0 answers

Error:Object reference not set to an instance of an object ,while parsing facebook JSON in asp.net

I am using/reusing json.net to get facebook likes of a user and his/her friend's like. I am having this error : Object reference not set to an instance of an object In the following code, I have parsed facebook json three times and I have this…
ssq
  • 51
  • 1
  • 6
1
vote
1 answer

How to Trigger button click from another form VB Net

I have three forms in total and i want to trigger one of the button on form 3 to be triggered automatically when form 1 loaded Form 1 Public Class frmIOMain ' In This Form load I want to trigger the above mentioned button Private Sub…
1
vote
2 answers

Cannot read property 'sort' of undefined

I was trying to reference an object (which is inside of an array) and there is an error: Cannot read property 'sort' of undefined This is my code: const items = [ { id: 1, value:5, weight: 14 }, { id: 2, value:8, weight: 3 }, { id: 3,…
Jan Tomczak
  • 13
  • 1
  • 2
  • 6
1
vote
1 answer

JS: referencing to Child of "Sibling"-object value in multi layer object

I am trying to refer to a variable value from both a generic-variable Name (like "Mike") and an unambiguous-variable-name like "myNeighbor_Mike_age". The Database entry comes with the ID as name like: dbObject = { MyNeighbor_Mike_age:21, …
Ari
  • 11
  • 3
1
vote
0 answers

Copy Python object and save it in a different name

I have a python code which uses some singleton class. One of the usecases I need is to store the class as a pickled object. The application logic controls when to read from the pickled object and when to rebuild it (something like caching). The…
ForMartha
  • 107
  • 1
  • 10
1
vote
2 answers

Two names points to the same object in python

Consider the following example: class Test: def __init__(self, lis: list): self.list = lis lis = [1, 2, 3] obj1 = Test(lis) obj2 = Test(lis) print(obj1 is obj2) print(obj1.list is…
Ermolai
  • 303
  • 4
  • 15
1
vote
2 answers

Saving a PDF document seems to be keeping a reference in memory (VB.NET)

I have a VB.NET user control that is saving a PDF document and then displaying that in a WebBrowser control. The code looks like this: Using myPdfDoc As New FileStream(fileName, FileMode.Create) Dim byt As Byte() = comLib.GetData(); If Not…
Paul Michaels
  • 16,185
  • 43
  • 146
  • 269
1
vote
0 answers

Benefit of assigning an object reference to an interface

I have a conceptual question regarding usage of interface variables. Lets say we have an interface called Modem interface Modem { public boolean open(); public boolean close(); public int read (); public int…
theroglu
  • 136
  • 3
  • 12