Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why Light Inject's source code all in one .cs file [closed]

like this https://github.com/seesharper/LightInject/blob/master/LightInject/LightInject.cs

It's hard to reading, is there any deep meaning?

like image 957
Rwing Avatar asked Feb 28 '14 05:02

Rwing


People also ask

Why do so many C programs have multiple source files?

In addition to the simplicity factor the other respondent mentioned, many C programs are written by one individual. When you have a team of individuals, it becomes desirable to split the application across several source files to avoid gratuitous conflicts in code changes.

What is a CS file and how to open it?

What is a CS file? A CS file is a source code file written in C# (pronounced "C Sharp"), an object-oriented programming language created by Microsoft for use with.NET Framework and.NET (successor to.NET Framework). It is used for developing a range of applications, from simple desktop programs to applications for distributed environments.

What are the different types of source code files?

1. C# Source Code File 2. CLEO Custom Script 3. ColorSchemer Studio Color Scheme What is a CS file? A CS file is a source code file written in C# (pronounced "C Sharp"), an object-oriented programming language created by Microsoft for use with .NET Framework and .NET (successor to .NET Framework).

What is the use of C in software development?

It is used for developing a range of applications, from simple desktop programs to applications for distributed environments. Developers utilize C# for building applications that run in the .NET ecosystem, which is a software framework that provides a standard method for building and deploying applications (primarily in Windows).


2 Answers

Being the author of LightInject, I feel I should comment on this :)

Say that you are a library developer and want to be able to utilize an IoC framework internally without taking a dependency on a third party assembly. By using the source version of LightInject, this can be done quite easily and you can still ship your library as a single assembly.

Many framework developers choose not to use an IoC framework just because they don't want that extra dependency.

The alternative to this would be to use tools like ILMerge that is capable of merging two or more assemblies into a single assembly.

This is a far more advanced option and would also require an extra build step that performs the merging.

Note that LightInject comes in two flavors, the source version where all the types are internal and the binary version that acts just like any other third party dependency.

Taking on a dependency might not seem so bad at first, but if you are a framework developer, you could easily run into issues if the consumer of your framework uses another version of the same dependency

Best regards

Bernhard Richter

like image 105
seesharper Avatar answered Sep 22 '22 15:09

seesharper


It makes integration as source in another project easier: simply add one file to your project and forget about it. This is a supported installation scenario according to the official website of LightInject, there's even a NuGet package for it.

If you want to read it, I'd strongly suggest opening it in Visual Studio and using the code navigation features to find what you want, e.g. VS 2013's Solution Explorer can display the classes inside of a file as children of that file.

like image 24
Solal Pirelli Avatar answered Sep 21 '22 15:09

Solal Pirelli