reference-type Questions
4
Solved
Value types behavior shows that whatever value we are holding cannot be changed through some other variable .
But I still have a confusion in my mind about what i mentioned in the title of this po...
E asked 17/8, 2011 at 4:50
17
Solved
Some guy asked me this question couple of months ago and I couldn't explain it in detail. What is the difference between a reference type and a value type in C#?
I know that value types are int, b...
Anthem asked 20/2, 2011 at 13:21
4
Does Kotlin have primitive types?. When I declare the variable: val myAge: Int = 18 then the myAge variable stores the actual values is 18 or stores the addresses of the objects in the memory?. If ...
Controvert asked 8/8, 2019 at 8:30
6
Solved
I have a mutable class that I'm using as a key to a generic dictionary. Two keys should be equal only if their references are equal.
From what I've read, in this case, I don't need to override Equa...
Prehension asked 16/3, 2010 at 15:32
6
Solved
I am a beginner to C# programming. I am now studying strings, structs, value types and reference types. As accepted answers in here and in here, strings are reference types that have pointers store...
Inflate asked 12/11, 2016 at 15:59
3
Solved
We experience out-of-memory issues after installing KB4525236 on our Windows 2016 Servers/Windows 10 Clients. This security fix seems to have changed the moment when memory is garbage collected whe...
Heptangular asked 6/2, 2020 at 7:28
9
Solved
Consider the following code (I have purposefully written MyPoint to be a reference type for this example)
public class MyPoint
{
public int x;
public int y;
}
It is universally acknowledged (i...
Ott asked 13/4, 2015 at 13:25
9
Solved
For example, if I want to call the following:
person.Head.Nose.Sniff()
then, if I want to be safe, I have to do the following:
if(person != null)
if(person.Head != null)
if(person.Head.Nose != n...
Dorthadorthea asked 13/9, 2010 at 14:55
2
Solved
Consider the following:
var emptyValueList = new List<int>(); //any value type (long, float, any struct ...)
var minimum = emptyValueList.Min();
This will throw an InvalidOperationExceptio...
Randazzo asked 29/12, 2015 at 9:17
4
Solved
Why do we need reference types in .NET?
I can think of only 1 cases, that it support sharing data between different functions and hence gives storage optimization.
Other than that I could not enu...
Amhara asked 10/2, 2012 at 17:36
5
Solved
I don't understand when to use AnyObject and when to use Any in Swift.
In my case, I've a Dictionary
[String: ???]
??? : Can be Int, Double, Float, String, Array, Dictionary
Can someone explain m...
Renault asked 12/9, 2014 at 13:13
7
Solved
I'm a newbie to Java.
I have provided a short snippet from my code for BFS.
public int bfs(Person p, Person q) {
private HashMap<Person, boolean> marked;
private int count;
marked = new...
Stone asked 19/1, 2016 at 19:34
3
Solved
I assumed sequence types in Python were value types. It turns out they're reference types (Meaning that the value of a variable won't be copied when assigned to a new variable, but referenced). So ...
Nivernais asked 28/5, 2011 at 0:36
19
Solved
What's the difference between struct and class in .NET?
Competition asked 16/8, 2008 at 8:21
2
Solved
How can we check if a parameter passed in a function is a value or a reference type? For example
func isReferenceType(toTest: Any) {
return true // or false
}
As we see here, we are not able to...
Itemized asked 11/1, 2016 at 15:39
1
Solved
The official documentation as well as tons of articles on the internet say that 'some string' is a primitive value, meaning that it creates a copy each time we assign it to a variable.
However, th...
Pedant asked 25/4, 2020 at 15:4
11
Solved
In which case should you use primitive types(int) or reference types (Integer)?
This question sparked my curiosity.
Rune asked 24/3, 2010 at 15:38
3
Solved
I have a question about Enumerable.Repeat function.
If I will have a class:
class A
{
//code
}
And I will create an array, of that type objects:
A [] arr = new A[50];
And next, I will want t...
Evelunn asked 5/7, 2017 at 22:24
3
Solved
I'm curious about how C# behaves when passing value/reference types into a method. I'd like to pass a boxed value type into the method "AddThree". The idea is to get in the caller function (Main) t...
Demurrer asked 21/11, 2015 at 14:25
6
Solved
C# doesn't allow structs to derive from classes, but all ValueTypes derive from Object. Where is this distinction made?
How does the CLR handle this?
Brayer asked 5/11, 2009 at 17:31
4
Solved
I used Enum property in my EntityFramework 5 class,
but in the database this field is nullable. Visual studio gives the error that this property must be a nullable property. My question is: is Enum...
Inquest asked 28/1, 2013 at 11:46
6
Solved
Guids are created using the new keyword which makes me think it's a reference type.
Is this correct?
Guid uid = new Guid();
Are Guids stored on the heap?
Coracorabel asked 26/2, 2010 at 19:21
6
Solved
Can structs contain fields of reference types? And if they can is this a bad practice?
Sacco asked 3/6, 2009 at 16:19
2
Solved
The following line creates a named ValueTuple:
var tuple = (a:1, b:2, c:3, d:4, e:5, f:6);
Value types can not be passed around efficiently. Does C# 7 offer a way to create named tuples of the Tu...
Refreshment asked 11/6, 2017 at 21:49
6
Solved
Reference cycles in Swift occur when properties of reference types have strong ownership of each other (or with closures).
Is there, however, a possibility of having reference cycles with value t...
Nonstriated asked 4/7, 2016 at 19:46
1 Next >
© 2022 - 2024 — McMap. All rights reserved.