Skip to content

Commit f653afd

Browse files
committed
Refactored
1 parent c8056d3 commit f653afd

18 files changed

+36
-149
lines changed

src/AngleSharp.Xml/Dom/Internal/SvgDocument.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,11 @@ internal SvgDocument(IBrowsingContext context = null)
3535

3636
#region Properties
3737

38-
public override IElement DocumentElement
39-
{
40-
get { return RootElement; }
41-
}
38+
public override IElement DocumentElement => RootElement;
4239

43-
public ISvgSvgElement RootElement
44-
{
45-
get { return this.FindChild<ISvgSvgElement>(); }
46-
}
40+
public ISvgSvgElement RootElement => this.FindChild<ISvgSvgElement>();
4741

48-
public override IEntityProvider Entities
49-
{
50-
get { return Context.GetProvider<IEntityProvider>() ?? XmlEntityProvider.Resolver; }
51-
}
42+
public override IEntityProvider Entities => Context.GetProvider<IEntityProvider>() ?? XmlEntityProvider.Resolver;
5243

5344
#endregion
5445

src/AngleSharp.Xml/Dom/Internal/XmlDocument.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,17 @@ internal XmlDocument(IBrowsingContext context = null)
2727

2828
#region Properties
2929

30-
public override IElement DocumentElement
31-
{
32-
get { return this.FindChild<IElement>(); }
33-
}
30+
public override IElement DocumentElement => this.FindChild<IElement>();
3431

35-
public override IEntityProvider Entities
36-
{
37-
get { return Context.GetProvider<IEntityProvider>() ?? XmlEntityProvider.Resolver; }
38-
}
32+
public override IEntityProvider Entities => Context.GetProvider<IEntityProvider>() ?? XmlEntityProvider.Resolver;
3933

4034
public Boolean IsValid => true;
4135

4236
#endregion
4337

4438
#region Methods
4539

46-
public override Element CreateElementFrom(String name, String prefix)
47-
{
48-
return new XmlElement(this, name, prefix);
49-
}
40+
public override Element CreateElementFrom(String name, String prefix) => new XmlElement(this, name, prefix);
5041

5142
public override Node Clone(Document owner, Boolean deep)
5243
{

src/AngleSharp.Xml/Dtd/Declaration/Attribute/AttributeEnumeratedType.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ public Boolean IsNotation
2929
set;
3030
}
3131

32-
public List<String> Names
33-
{
34-
get { return _names; }
35-
}
32+
public List<String> Names => _names;
3633

3734
#endregion
3835

src/AngleSharp.Xml/Dtd/Declaration/AttributeDeclaration.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ public AttributeDeclarationEntry this[Int32 index]
2929
get { return _attrs[index]; }
3030
}
3131

32-
public Int32 Count
33-
{
34-
get { return _attrs.Count; }
35-
}
32+
public Int32 Count => _attrs.Count;
3633

3734
public IEnumerable<AttributeDeclarationEntry> Declarations
3835
{

src/AngleSharp.Xml/Dtd/Declaration/Element/ElementChoiceDeclarationEntry.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ sealed class ElementChoiceDeclarationEntry : ElementChildrenDeclarationEntry
77
{
88
#region Properties
99

10-
public List<ElementQuantifiedDeclarationEntry> Choice
11-
{
12-
get { return _children; }
13-
}
10+
public List<ElementQuantifiedDeclarationEntry> Choice => _children;
1411

1512
#endregion
1613

src/AngleSharp.Xml/Dtd/Declaration/Element/ElementDeclarationEntry.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,11 @@ abstract class ElementDeclarationEntry
1616

1717
#region Properties
1818

19-
public ElementContentType Type
20-
{
21-
get { return _type; }
22-
}
19+
public ElementContentType Type => _type;
2320

24-
public static ElementAnyDeclarationEntry Any
25-
{
26-
get { return _any ?? (_any = new ElementAnyDeclarationEntry()); }
27-
}
21+
public static ElementAnyDeclarationEntry Any => _any ?? (_any = new ElementAnyDeclarationEntry());
2822

29-
public static ElementEmptyDeclarationEntry Empty
30-
{
31-
get { return _empty ?? (_empty = new ElementEmptyDeclarationEntry()); }
32-
}
23+
public static ElementEmptyDeclarationEntry Empty => _empty ?? (_empty = new ElementEmptyDeclarationEntry());
3324

3425
#endregion
3526

src/AngleSharp.Xml/Dtd/Declaration/Element/ElementMixedDeclarationEntry.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ public ElementMixedDeclarationEntry()
2424

2525
#region Properties
2626

27-
public List<String> Names
28-
{
29-
get { return _names; }
30-
}
27+
public List<String> Names => _names;
3128

3229
#endregion
3330

src/AngleSharp.Xml/Dtd/Declaration/Element/ElementSequenceDeclarationEntry.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ namespace AngleSharp.Xml.Dtd.Declaration
55

66
sealed class ElementSequenceDeclarationEntry : ElementChildrenDeclarationEntry
77
{
8-
public List<ElementQuantifiedDeclarationEntry> Sequence
9-
{
10-
get { return _children; }
11-
}
8+
public List<ElementQuantifiedDeclarationEntry> Sequence => _children;
129

1310
public override Boolean Check(NodeInspector inspector)
1411
{

src/AngleSharp.Xml/Dtd/Declaration/Element/NodeInspector.cs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,18 @@ public NodeInspector(IElement element)
2121
}
2222
}
2323

24-
public List<INode> Children
25-
{
26-
get { return nodes; }
27-
}
24+
public List<INode> Children => nodes;
2825

29-
public INode Current
30-
{
31-
get { return Children[Index]; }
32-
}
26+
public INode Current => Children[Index];
3327

34-
public Int32 Length
35-
{
36-
get { return Children.Count; }
37-
}
28+
public Int32 Length => Children.Count;
3829

3930
public Int32 Index
4031
{
4132
get;
4233
set;
4334
}
4435

45-
public Boolean IsCompleted
46-
{
47-
get { return Children.Count == Index; }
48-
}
36+
public Boolean IsCompleted => Children.Count == Index;
4937
}
5038
}

src/AngleSharp.Xml/Dtd/Parser/DtdContainer.cs

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,12 @@ public String Url
9797
/// <summary>
9898
/// Gets the root container.
9999
/// </summary>
100-
public DtdContainer Root
101-
{
102-
get { return (_parent != null) ? _parent.Root : this; }
103-
}
100+
public DtdContainer Root => (_parent != null) ? _parent.Root : this;
104101

105102
/// <summary>
106103
/// Gets the number of rules / nodes in this DTD (without the parent).
107104
/// </summary>
108-
public Int32 Count
109-
{
110-
get { return _nodes.Count; }
111-
}
105+
public Int32 Count => _nodes.Count;
112106

113107
/// <summary>
114108
/// Gets the text of this DTD (without the parents text).
@@ -122,42 +116,27 @@ public String Text
122116
/// <summary>
123117
/// Gets the enumeration over all the contained (self and parent) notations.
124118
/// </summary>
125-
public IEnumerable<Notation> Notations
126-
{
127-
get { return _notations.Items(m => m._notations); }
128-
}
119+
public IEnumerable<Notation> Notations => _notations.Items(m => m._notations);
129120

130121
/// <summary>
131122
/// Gets the enumeration over all the contained (self and parent) entities.
132123
/// </summary>
133-
public IEnumerable<Entity> Entities
134-
{
135-
get { return _entities.Items(m => m._entities); }
136-
}
124+
public IEnumerable<Entity> Entities => _entities.Items(m => m._entities);
137125

138126
/// <summary>
139127
/// Gets the enumeration over all the contained (self and parent) parameters.
140128
/// </summary>
141-
public IEnumerable<Entity> Parameters
142-
{
143-
get { return _parameters.Items(m => m._parameters); }
144-
}
129+
public IEnumerable<Entity> Parameters => _parameters.Items(m => m._parameters);
145130

146131
/// <summary>
147132
/// Gets the enumeration over all the contained (self and parent) attributes.
148133
/// </summary>
149-
public IEnumerable<AttributeDeclaration> Attributes
150-
{
151-
get { return _attributes.Items(m => m._attributes); }
152-
}
134+
public IEnumerable<AttributeDeclaration> Attributes => _attributes.Items(m => m._attributes);
153135

154136
/// <summary>
155137
/// Gets the enumeration over all the contained (self and parent) elements.
156138
/// </summary>
157-
public IEnumerable<ElementDeclaration> Elements
158-
{
159-
get { return _elements.Items(m => m._elements); }
160-
}
139+
public IEnumerable<ElementDeclaration> Elements => _elements.Items(m => m._elements);
161140

162141
#endregion
163142

@@ -309,10 +288,7 @@ public void CopyTo(Node[] array, Int32 arrayIndex)
309288
array[i] = _nodes[j];
310289
}
311290

312-
public Boolean IsReadOnly
313-
{
314-
get { return false; }
315-
}
291+
public Boolean IsReadOnly => false;
316292

317293
public Boolean Remove(Node item)
318294
{

0 commit comments

Comments
 (0)