# MaterialRefs class

Namespace: [Rhino.DocObjects](https://developer.rhino3d.com/api/rhinocommon/namespace/rhino.docobjects.md) · Assembly: [RhinoCommon](https://developer.rhino3d.com/api/rhinocommon/assembly/rhinocommon.md)

```cs
public class MaterialRefs : IDictionary<Guid, MaterialRef>
```

If you are developing a high quality plug-in renderer, and a user is assigning a custom render material to this object, then add rendering material information to the MaterialRefs dictionary. Note to developers: As soon as the MaterialRefs dictionary contains items rendering material queries slow down. Do not populate the MaterialRefs dictionary when setting the MaterialIndex will take care of your needs.

## Properties

- [Count](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.materialrefs/count.md): Gets the number of elements contained in this dictionary
- [IsReadOnly](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.materialrefs/isreadonly.md): IDictionary required property, always returns false for this dictionary.
- [Keys](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.materialrefs/keys.md): Gets an ICollection containing the plug-in Id's in this dictionary.
- [Values](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.materialrefs/values.md): Gets an ICollection containing the MaterialRef objects in this dictionary.

## Indexers

- [this[]](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.materialrefs/item.md): Gets or sets the element with the specified plug-in Id.

## Methods

- [Add](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.materialrefs/add.md): (2 overloads) Add or replace an element with the provided key and value to this dictionary.
- [Clear](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.materialrefs/clear.md): Removes all items from this dictionary.
- [Contains](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.materialrefs/contains.md): Determines whether this dictionary contains a specific value.
- [ContainsKey](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.materialrefs/containskey.md): Determines whether this dictionary contains an MaterialRef with the specified plug-in id.
- [CopyTo](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.materialrefs/copyto.md): Copies the elements of this dictionary to an System.Array, starting at a particular System.Array index.
- [Create](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.materialrefs/create.md): Call this method to create a MaterialRef which can be used when calling one of the Add methods.
- [GetEnumerator](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.materialrefs/getenumerator.md): Returns an enumerator that iterates through this dictionary.
- [Remove](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.materialrefs/remove.md): (2 overloads) Removes the MaterialRef with the specified plug-in Id from this dictionary.
- [IEnumerable.GetEnumerator](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.materialrefs/system-collections-ienumerable-getenumerator.md): Returns an enumerator that iterates through this dictionary.
- [TryGetValue](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.materialrefs/trygetvalue.md): Gets the value associated with the specified key.
