Transitus is a .NET library for deserializing Sitecore item files into strongly typed objects. It also supports extracting the template items from those objects allowing you to use them in such scenarios as code generation, which is the primary focus of Transitus.
her response Credit
Transitus should be installed via NuGet, once you have done this the below code snippet is all you to need to get up and running.
var items = Transitus.TransitusProvider.FolderDeserializer.Deserialize(@"<Folder Location>"); var templates = Transitus.TransitusProvider.TemplateFactory.Create(items);
Alternatively you can use the IoC framework of your choice along with dependency injection, the below is an example using the syntax from SimpleInjector.
container.Register<Transitus.IFileDeserializer, Transitus.Sync.SyncItemDeserializer>(); container.Register<Transitus.IFolderDeserializer, Transitus.FolderDeserializer>(); container.Register<Transitus.ITemplateFactory, Transitus.TemplateFactory>();