I have read in the c# language specification :
Source files typically have a one-to-one correspondence with files in a file system, but this correspondence is not required
What does this exactly mean ?
I have read in the c# language specification :
Source files typically have a one-to-one correspondence with files in a file system, but this correspondence is not required
What does this exactly mean ?
As the line before it says:
A source file is an ordered sequence of Unicode characters
That means a "source file" doesn't necessarily have to be a file on the file system. It could be any old stream of bytes that represent characters in UTF-16. It could come from a memory stream, or from a network, or from any old place. But usually it's a file on the file system.
I think it literally means that each source file is represented by a single file on the system.
For example, say I have some source code:
Using System;
namespace Test
{
public class Program
{
private static void Main (string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
This can be saved to the file system as Program.cs
. We now have some source code which is being represented by a single file on the system.
but this correspondence is not required
Suggests that a source file does not always exist on the system. For example, the source could exist as a "sequence of Unicode characters" instead, which could be stored somewhere in memory.
With visual studio, you can "link" a source file within a project. If you place a source file in a project, and link the same source file in a different project (i.e. share the same source code in 2 different projects), you end having 2 sources files linked to a single file.
I usually use this feature in solutions having more than one project: the shared source code is something like this:
[assembly: AssemblyVersion("1.2.3.0")]
[assembly: AssemblyFileVersion("1.2.3.0")]
So when complied, every assembly in my solution have the same version number.