Class TableObjects<T>
Represents a list of table objects
Inheritance
Implements
Inherited Members
Namespace: netDxf.Collections
Assembly: CADability.dll
Syntax
public abstract class TableObjects<T> : DxfObject, IEnumerable<T>, IEnumerable where T : TableObject
Type Parameters
| Name | Description |
|---|---|
| T |
Constructors
| Improve this Doc View SourceTableObjects(DxfDocument, String, String)
Declaration
protected TableObjects(DxfDocument document, string codeName, string handle)
Parameters
| Type | Name | Description |
|---|---|---|
| DxfDocument | document | |
| System.String | codeName | |
| System.String | handle |
Fields
| Improve this Doc View Sourcelist
Declaration
protected readonly Dictionary<string, T> list
Field Value
| Type | Description |
|---|---|
| System.Collections.Generic.Dictionary<System.String, T> |
references
Declaration
protected Dictionary<string, List<DxfObject>> references
Field Value
| Type | Description |
|---|---|
| System.Collections.Generic.Dictionary<System.String, System.Collections.Generic.List<DxfObject>> |
Properties
| Improve this Doc View SourceCount
Gets the number of table objects.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Item[String]
Gets a table object from the list by name.
Declaration
public T this[string name] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Table object name. |
Property Value
| Type | Description |
|---|---|
| T | The table object with the specified name. |
Remarks
Table object names are case insensitive.
Items
Gets the table object list.
Declaration
public ICollection<T> Items { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.ICollection<T> |
MaxCapacity
Gets the maximum number of objects the collection can hold.
Declaration
public int MaxCapacity { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Remarks
This is an approximate value, the actual exact value is unknown. In any case is not recommended to get even close to this number for any practical use.
Names
Gets the ObjectTable names.
Declaration
public ICollection<string> Names { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.ICollection<System.String> |
Owner
Gets the owner of the actual DXF object.
Declaration
public DxfDocument Owner { get; }
Property Value
| Type | Description |
|---|---|
| DxfDocument |
Methods
| Improve this Doc View SourceAdd(T)
Adds a table object to the list.
Declaration
public T Add(T item)
Parameters
| Type | Name | Description |
|---|---|---|
| T | item | TableObject to add to the list. |
Returns
| Type | Description |
|---|---|
| T | If a table object already exists with the same name as the instance that is being added the method returns the existing table object, if not it will return the new table object. |
Clear()
Removes all table objects that are not reserved and have no references.
Declaration
public void Clear()
Contains(T)
Checks if a table object already exists in the list.
Declaration
public bool Contains(T item)
Parameters
| Type | Name | Description |
|---|---|---|
| T | item | Table object. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True is a table object exists, false otherwise. |
Contains(String)
Checks if a table object already exists in the list.
Declaration
public bool Contains(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Table object name. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True is a table object exists with the specified name, false otherwise. |
GetEnumerator()
Returns an enumerator that iterates through the table object collection.
Declaration
public IEnumerator<T> GetEnumerator()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerator<T> | An enumerator for the table object collection. |
GetReferences(T)
Gets the DxfObject referenced by a T.
Declaration
public List<DxfObject> GetReferences(T item)
Parameters
| Type | Name | Description |
|---|---|---|
| T | item | Table object. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<DxfObject> | The list of DxfObjects that reference the specified table object. |
Remarks
If there is no table object with the specified name in the list the method an empty list.
The Groups collection method GetReferences will always return an empty list since there are no DxfObjects that references them.
GetReferences(String)
Gets the DxfObject referenced by a T.
Declaration
public List<DxfObject> GetReferences(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Table object name. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<DxfObject> | The list of DxfObjects that reference the specified table object. |
Remarks
If there is no table object with the specified name in the list the method an empty list.
The Groups collection method GetReferences will always return an empty list since there are no DxfObjects that references them.
Remove(T)
Removes a table object.
Declaration
public abstract bool Remove(T item)
Parameters
| Type | Name | Description |
|---|---|---|
| T | item | TableObject to remove from the document. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True is the table object has been successfully removed, or false otherwise. |
Remarks
Reserved table objects or any other referenced by objects cannot be removed.
Remove(String)
Removes a table object.
Declaration
public abstract bool Remove(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Table object name to remove from the document. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True is the table object has been successfully removed, or false otherwise. |
Remarks
Reserved table objects or any other referenced by objects cannot be removed.
TryGetValue(String, out T)
Gets the table object associated with the specified name.
Declaration
public bool TryGetValue(string name, out T item)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name of the table object to get. |
| T | item | When this method returns, contains the table object associated with the specified name, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the table contains an element with the specified name; otherwise, false. |
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Returns an enumerator that iterates through the table object collection.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
| Type | Description |
|---|---|
| System.Collections.IEnumerator | An enumerator for the table object collection. |