【发布时间】:2011-10-29 12:56:34
【问题描述】:
我有一个如下所示的课程:
public static class ReferenceData
{
public static IEnumerable<SelectListItem> GetAnswerType()
{
return new[]
{
new SelectListItem { Value = "1", Text = "1 answer" },
new SelectListItem { Value = "2", Text = "2 answers" },
new SelectListItem { Value = "3", Text = "3 answers" }
};
}
public static IEnumerable<SelectListItem> GetDatastore()
{
return new[]
{
new SelectListItem { Value = "DEV", Text = "Development" },
new SelectListItem { Value = "DC1", Text = "Production" }
};
}
public static string GetDatastoreText(string datastoreValue)
{
return GetDatastore().Single(s => s.Value == datastoreValue).Text;
}
public static string GetDatastoreValue(string datastoreText)
{
return GetDatastore().Single(s => s.Text == datastoreText).Value;
}
// Lots more here
// Lots more here
}
还有很多我没有在上面展示的。
目前所有的类信息都在一个文件中。但是,我想将其拆分为多个文件。有什么方法可以将 ReferenceData 类的内容分散到多个文件中?
【问题讨论】:
标签: c#