DCSIMG
C# - Itai Goldstein

Browse by Tags

All Tags » C# (RSS)

Configuration shortcuts (or IntelliSense for configuration file)

The configuration appSettings & connectionStrings sections are highly used in our daily application development. < appSettings > < add key = "ApplicationName" value = "ConfigurationShortcutsSample" /> </ appSettings > The way we usually access the values which are stored within these sections is through the ConfigurationManager class when we specify the section key string: string applicationName = ConfigurationManager . AppSettings [ AppSettingsKeys . ApplicationName...
Posted by itai | 2 comment(s)
תגים:, , ,

Transform List<T> to List<K> where T inherits from K

Download ListExtension.cs file : Sometimes it is useful to copy one list contents to another which its type is more general. Let me emphasize my intent with a small example: Let there be a Dog , Cat & a Mouse types which inherit from Animal type, and let there be some lists: List< Dog > , List< Cat > & List< Mouse > list that we would like to union to one List< Animal > list in order to perform an general operation on all of the animals objects. Here’s an example of...