diff --git a/Source/Svg.csproj b/Source/Svg.csproj
index 7704593b486c91a179066ce19b8e7f61c66f96e4..593dfcc0102821c70038d24527e3d1ac34da482e 100644
--- a/Source/Svg.csproj
+++ b/Source/Svg.csproj
@@ -70,13 +70,7 @@
bin\Release\Svg.XML
-
-
-
- 3.5
-
-
diff --git a/Source/SvgElement.cs b/Source/SvgElement.cs
index b660bc4ea59c117a8676b067115a786af777cdcf..c0430521539e2e64fe83a50e87d62110946f41dc 100644
--- a/Source/SvgElement.cs
+++ b/Source/SvgElement.cs
@@ -15,6 +15,15 @@ namespace Svg
///
public abstract class SvgElement : ISvgElement, ISvgTransformable, ICloneable
{
+ //optimization
+ protected class AttributeTuple
+ {
+ public PropertyDescriptor Property;
+ public SvgAttributeAttribute Attribute;
+ }
+ protected IEnumerable _svgAttributes;
+
+
internal SvgElement _parent;
private string _elementName;
private SvgAttributeCollection _attributes;
@@ -283,6 +292,12 @@ namespace Svg
this._eventHandlers = new EventHandlerList();
this._elementName = string.Empty;
this._customAttributes = new Dictionary();
+
+ //fill svg attribute description
+ _svgAttributes = from PropertyDescriptor a in TypeDescriptor.GetProperties(this)
+ let attribute = a.Attributes[typeof(SvgAttributeAttribute)] as SvgAttributeAttribute
+ where attribute != null
+ select new AttributeTuple { Property = a, Attribute = attribute };
}
@@ -336,12 +351,7 @@ namespace Svg
protected virtual void WriteAttributes(XmlTextWriter writer)
{
- var attributes = from PropertyDescriptor a in TypeDescriptor.GetProperties(this)
- let attribute = a.Attributes[typeof(SvgAttributeAttribute)] as SvgAttributeAttribute
- where attribute != null
- select new { Property = a, Attribute = attribute };
-
- foreach (var attr in attributes)
+ foreach (var attr in _svgAttributes)
{
if (attr.Property.Converter.CanConvertTo(typeof(string)))
{