I have a class that looks like this:
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 }
There's a lot more that I didn't show above.
Currently all of the class information is in one file. However I would like to split this into multiple files. Is there some way that I can spread the contents of the ReferenceData class across more than one file?
Once you've shrunk your C: partition, you'll see a new block of Unallocated space at the end of your drive in Disk Management. Right-click on it and choose New Simple Volume to create your new partition. Click through the wizard, assigning it the drive letter, label, and format of your choice.
Cut a part of the current partition to be a new one Begin -> Right click Computer -> Manage. Locate Disk Management under Store on the left, and click to select Disk Management. Right click the partition you want to cut, and choose Shrink Volume. Tune a size on the right of Enter the amount of space to shrink.
Yes, you can use partial classes. This allows you to split your class over multiple files.
File 1:
public static partial class ReferenceData { /* some methods */ }
File 2:
public static partial class ReferenceData { /* some more methods */ }
Use this feature carefully. Overuse can make it hard to read the code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With