|
// --------------------------- COPYRIGHT NOTICE ---------------------------------
// ASP.NET DaST - LittleNonsense DEMO
// Copyright (C) 2011 by Roman Gubarenko
// http://www.makeitsoft.com/
// ------------------------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
// ------------------------------------------------------------------------------
// Primary Contact : rgubarenko@gmail.com
// Project Home : http://www.makeitsoft.com/
// Help & Support : http://www.makeitsoft.com/forums/
// ------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Hosting;
using System.IO;
/// <summary>
/// Summary description for Utils
/// </summary>
public static class Utils
{
public static string LoadTemplate(string name)
{
string strPath = HostingEnvironment.MapPath("~/App_Data/Templates/" + name);
return File.ReadAllText(strPath);
}
public static object GetValue(this object obj, string propertyName)
{
if (propertyName == null || obj == null) throw new ArgumentNullException();
var info = obj.GetType().GetProperty(propertyName);
if (info == null) throw new Exception("Object does not have such property: " + propertyName);
else return info.GetValue(obj, null);
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Software Architect with over 15 years in IT field. Started with deep math and C++ Computer Vision software. Currently in .NET and PHP web development. Creator of DaST pattern, open-source frameworks, and plugins. Interested in cutting Edge IT, open-source, Web 2.0, .NET, MVC, C++, Java, jQuery, Mobile tech, and extreme sports.