Napisałem sobie prosty HTML helper, który zwraca mi link. Chciałbym aby parametrem tej funkcji był url z pliku XML.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<mail>
<smtp>serwer smtp</smtp>
<user>user</user>
<pass>passwd</pass>
</mail>
<pk>
<url>www.url.pl</url>
</pk>
</configuration>
Zacząłem pisać coś takiego
public static class Tools
{
public static IEnumerable GetConfiguration()
{
XElement xdoc = XElement.Load("file.xml");
IEnumerable<XElement> childElements =
from el in xdoc.Elements()
select el;
}
}
w sumie to chciałbym aby ta metoda zwróciła mi listę np. IEnurable, tablicę wartości z tego co jest w tagach XML.
Chciałbym używać tego w stylu
var config = Tools.GetConfiguration();
config["nazwaTagu"]
wtedy config.url podstawił bym sobie do mojego helpera generującego link.