Add
Namespace: Digi21.DigiNG.IO
Assembly: Digi21.DigiNG
Appends entities to the drawing file.
Overloads
| Method | Description |
|---|---|
Add(Entity) |
Adds one entity. |
Add(IEnumerable<Entity>) |
Adds multiple entities in enumeration order. |
Add(Line), Add(Point), Add(Text), Add(Polygon), Add(Complex) |
Add an entity of that type and return it with its read-only type. |
After an entity is added, its Owner property is the file. An entity belonging to another file (its Owner is another file) cannot be added: add the copy returned by Clone(), which does not belong to any file.
Add(Entity)
void Add(Entity entity);
| Parameter | Description |
|---|---|
entity |
Entity to append to the file. |
Add(IEnumerable<Entity>)
void Add(IEnumerable<Entity> entities);
| Parameter | Description |
|---|---|
entities |
Entities to append to the file in enumeration order. |
If an entity belongs to another file, Add throws InvalidOperationException upon reaching that entity. The state of entities preceding the one causing the exception depends on the implementation: in Bin, they have already been added; see each class's page.
Add(Line), Add(Point), Add(Text), Add(Polygon), Add(Complex)
ReadOnlyLine Add(Line line);
ReadOnlyPoint Add(Point point);
ReadOnlyText Add(Text text);
ReadOnlyPolygon Add(Polygon polygon);
ReadOnlyComplex Add(Complex complex);
| Parameter | Description |
|---|---|
line, point, text, polygon, complex |
Line, Point, Text, Polygon or Complex to append to the file. |
Return value: the same instance received by the method, with the read-only type from which it derives: ReadOnlyLine, ReadOnlyPoint, ReadOnlyText, ReadOnlyPolygon or ReadOnlyComplex. These overloads call Add(Entity).
Exceptions
| Exception | When |
|---|---|
ArgumentNullException |
The parameter is null. |
InvalidOperationException |
The entity belongs to another file, or the file is opened read-only in implementations checking CanWrite (such as Bin). |
Example
The IReadOnlyDrawingFile example adds a copy of each point from another file to a file.