Table of Contents

Struct LengthPercentageOrNumber

Namespace
SVGImage.SVG.Shapes
Assembly
DotNetProjects.SVGImage.dll
public struct LengthPercentageOrNumber
Inherited Members

Constructors

LengthPercentageOrNumber(double, LengthContext)

Represents a length that may have a value that is context dependent.

public LengthPercentageOrNumber(double value, LengthContext context)

Parameters

value double

The numerical part of the length that is related to the context

context LengthContext

If null, units will be ignored

Properties

Value

Represents a length, percentage, or number value that has been resolved based on the context.

public double Value { get; }

Property Value

double

Methods

Parse(Shape, string, LengthOrientation)

Parses a string representation of a length, percentage, or number value into a LengthPercentageOrNumber instance.

public static LengthPercentageOrNumber Parse(Shape owner, string value, LengthOrientation orientation = LengthOrientation.None)

Parameters

owner Shape

The element that the length is associated with.

value string

A string representation of a length

orientation LengthOrientation

Used to establish the context of the length. Should be Horizontal for inherntly horizontal values like 'x' and 'dx'. Should be Vertical for inherntly vertical values like 'y' and 'dy'. Should be None for other values.

Returns

LengthPercentageOrNumber

A LengthPercentageOrNumber instance that represents the parsed value.

Exceptions

ArgumentException

Thrown when the provided value is not a valid length, percentage, or number.