I have a StringUtilities.cs file in the CommonFunctions Project that holds a UppercaseFirst function that Uppercases the first word in a string. Currently in the .aspx.cs in a separate Project (in the same Solution) that is utilizing this function is called using MyProject.CommonFunctions.StringUtilities.UppercaseFirst(‘hello world’);
Is it possible to shorten it to just UppercaseFirst(‘hello world’); ? Readability will be so much better.
StringUtilities.cs in the CommonFunctions Project:
namespace MyProject.CommonFunctions { public class StringUtilities { public static string UppercaseFirst(string s) {//blah code} } }
Default.aspx.cs
using MyProject.CommonFunctions; ... protected void Page_Load(object sender, EventArgs e) { MyProject.CommonFunctions.StringUtilities.UppercaseFirst('hello world'); }
You can’t cut it all the way down to just the method name, but given that you’ve already got the
using MyProject.CommonFunction;line in place, you could shorten it to: