{
var styleSheet = new StyleSheet();
var resString = DependencyService.Get<IResourcesLoader>().GetResource(resourcePath, assembly, styleSheet, lineInfo);
- Parse(styleSheet, new CssReader(new StringReader(resString)));
+ using (var textReader = new StringReader(resString))
+ using (var cssReader = new CssReader(textReader))
+ Parse(styleSheet, cssReader);
return styleSheet;
}
throw new ArgumentNullException(nameof(reader));
var sheet = new StyleSheet();
- Parse(sheet, new CssReader(reader));
+ using (var cssReader = new CssReader(reader))
+ Parse(sheet, cssReader);
return sheet;
}
}
}
- Type IStyle.TargetType
- => typeof(VisualElement);
+ Type IStyle.TargetType => typeof(VisualElement);
void IStyle.Apply(BindableObject bindable)
{
- var styleable = bindable as Element;
- if (styleable == null)
+ if (!(bindable is Element styleable))
return;
Apply(styleable);
}
void ApplyCore(Element styleable)
{
- var visualStylable = styleable as VisualElement;
- if (visualStylable == null)
+ if (!(styleable is VisualElement visualStylable))
return;
foreach (var kvp in Styles) {
var selector = kvp.Key;
}
}
- void IStyle.UnApply(BindableObject bindable)
- {
- throw new NotImplementedException();
- }
+ void IStyle.UnApply(BindableObject bindable) => throw new NotImplementedException();
}
}