# PropertyName

> Represents a string as an int for efficient lookup and comparison. Use this for common PropertyNames. Internally stores just an int to represent the string. A PropertyName can be created from a string but can not be converted back to a string. The same string always results in the same int representing that string. Thus this is a very efficient string representation in both memory and speed when all you need is comparison. PropertyName is serializable. ToString() is only implemented for debugging purposes in the editor it returns "theName:3737" in the player it returns "Unknown:3737".

## Definition

* **Type:** Struct
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule
* **Implements:** [IEquatable\<PropertyName>](https://learn.microsoft.com/dotnet/api/system.iequatable-1)

```csharp
public struct PropertyName : IEquatable<PropertyName>
```

## Constructors

| Constructor                                                                                                                             | Description                                  |
| --------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
| [PropertyName(System.Int32)](/engine/6000.7/script-reference/unityengine/propertyname/ctor.md#propertyname\(int\))                      | Initializes the PropertyName using a string. |
| [PropertyName(System.String)](/engine/6000.7/script-reference/unityengine/propertyname/ctor.md#propertyname\(string\))                  | Initializes the PropertyName using a string. |
| [PropertyName(UnityEngine.PropertyName)](/engine/6000.7/script-reference/unityengine/propertyname/ctor.md#propertyname\(propertyname\)) | Initializes the PropertyName using a string. |

## Methods

| Method                                                                                 | Description                                                                                                                                    |
| -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| [Equals](/engine/6000.7/script-reference/unityengine/propertyname/equals.md)           | Determines whether this instance and a specified object, which must also be a PropertyName object, have the same value.                        |
| [GetHashCode](/engine/6000.7/script-reference/unityengine/propertyname/gethashcode.md) | Returns the underlying int as a hash code for this `PropertyName`. Use `GetHashCode` to use `PropertyName` as keys in hash tables.             |
| [ToString](/engine/6000.7/script-reference/unityengine/propertyname/tostring.md)       | For debugging purposes only. Returns the string value representing the string in the Editor. Returns "UnityEngine.PropertyName" in the player. |

## Static Methods

| Method                                                                                     | Description                                                      |
| ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------- |
| [IsNullOrEmpty](/engine/6000.7/script-reference/unityengine/propertyname/isnullorempty.md) | Indicates whether the specified PropertyName is an Empty string. |

## Operators

| Operator                                                                                 | Description                                                                                                                                                                                                                                                        |
| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [operator ==](/engine/6000.7/script-reference/unityengine/propertyname/op-equality.md)   | Determines whether two specified PropertyName have the same string value. Because two PropertyNames initialized with the same string value always have the same name index, we can simply perform a comparison of two ints to find out if the string value equals. |
| [PropertyName](/engine/6000.7/script-reference/unityengine/propertyname/op-implicit.md)  | Converts the `int` passed into a [PropertyName](/engine/6000.7/script-reference/unityengine/propertyname.md). This `int` will be used as the internal ID for the converted PropertyName.                                                                           |
| [operator !=](/engine/6000.7/script-reference/unityengine/propertyname/op-inequality.md) | Determines whether two specified PropertyName have a different string value.                                                                                                                                                                                       |
