# reference_equals

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/function-reference_equals/

**function** · [`ferroui-controls`](/docs/0.5.0/api/ferroui-controls/) · v0.5.0

```rust
fn reference_equals(a: &Option<ferroui_base::BoxedValue>, b: &Option<ferroui_base::BoxedValue>) -> bool
```

Whether two untyped values are the same object: C# `ReferenceEquals` (and
`==` / `!=` on `object`) for values that travel in boxes.

The rule:
* both null, or the same box: the same reference;
* boxes that hold handles of the same object of the class hierarchy (a
  control boxed twice, or boxed once as `Ref<Control>` and once as
  `Ref<Border>`): the same reference;
* boxes that both hold a string: the same reference if the strings are
  equal. A string is the immutable value-like type that the lists of the
  managed original hand out as the same instance on every read, whereas a
  typed list of strings here boxes each string anew on every read; without
  this, an unchanged item read twice would look like another object;
* anything else in two boxes (two separately boxed equal numbers, two
  equal structures) is two references, as two boxings are in the managed
  original.

Use [`items_equal`](/docs/0.5.0/api/ferroui-controls/function-items_equal/) where the original calls `Equals`.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/items_source.rs#L383)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
