Ch02-1-SimpleProgram.cs
public sealed class Program { public static void Main() { System.Console.WriteLine("Hi"); } }
Ch02-2-Minimum MSCorLib.cs
// This project is a DLL that has the "Do not reference mscorlib.dll" option turned on namespace System { public class Object { } public struct Byte { } public struct SByte { } public struct Int16 { } public struct Int32 { } public struct Int64 { } public struct UInt16 { } public struct UInt32 { } public struct UInt64 { } public struct IntPtr { } public struct UIntPtr { } public struct Single { } public struct Double { } public struct Char { } public struct Boolean { } public class Type { } public class ValueType { } public class Enum { } public struct Void { } public class Array { } public class Exception { } public class ParamArrayAttribute { } public struct RuntimeTypeHandle { } public struct RuntimeFieldHandle { } public class Attribute { } public class Delegate { } public class MulticastDelegate { } public class String { } public interface IDisposable { } public enum AttributeTargets { Assembly = 1, Class = 4, } [AttributeUsage(AttributeTargets.Class, Inherited = true)] public sealed class AttributeUsageAttribute : Attribute { public AttributeUsageAttribute(AttributeTargets validOn) { } public bool AllowMultiple { get; set; } public bool Inherited { get; set; } } } namespace System.Runtime.InteropServices { public class OutAttribute { } } namespace System.Runtime.Versioning { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)] public sealed class TargetFrameworkAttribute : Attribute { public TargetFrameworkAttribute(String frameworkName) { } public String FrameworkDisplayName { get; set; } } } namespace System.Reflection { public class DefaultMemberAttribute { } } namespace System.Collections { public interface IEnumerable { } public interface IEnumerator { } }
Ch02-3-FUT.cs
using System; public sealed class AFrequentlyUsedType { public AFrequentlyUsedType() { Console.WriteLine("A frequently used type was constructed."); } }
Ch02-3-RUT.cs
using System; public sealed class ARarelyUsedType { public ARarelyUsedType() { Console.WriteLine("A rarely used type was constructed."); } }
Ch02-3-AssemblyVersionInfo.cs
using System.Reflection; // FileDescription version information: [assembly: AssemblyTitle("JeffTypes.dll")] // Comments version information: [assembly: AssemblyDescription("This assembly contains Jeff's types")] // CompanyName version information: [assembly: AssemblyCompany("Wintellect")] // ProductName version information: [assembly: AssemblyProduct("Wintellect (R) Jeff's Type Library")] // LegalCopyright version information: [assembly: AssemblyCopyright("Copyright (c) Wintellect 2010")] // LegalTrademarks version information: [assembly:AssemblyTrademark("JeffTypes is a registered trademark of Wintellect")] // AssemblyVersion version information: [assembly: AssemblyVersion("3.0.0.0")] // FILEVERSION/FileVersion version information: [assembly: AssemblyFileVersion("1.0.0.0")] // PRODUCTVERSION/ProductVersion version information: [assembly: AssemblyInformationalVersion("2.0.0.0")] // Set the Language field (discussed later in the "Culture" section) [assembly:AssemblyCulture("")]
Ch02-3-BuildMultiFileLibrary.bat
@echo off Rem %1="$(DevEnvDir)", %2="$(SolutionDir)", %3="$(OutDir)" rem Set all the VS environment variables pushd %1 call ..\Tools\VSVars32.bat popd rem Change to the solution directory cd %2 REM There are two ways to build this multi-file assembly REM The line below picks one of those ways Goto Way1 :Way1 csc /t:module /debug:full /out:Ch02-3-RUT.netmodule Ch02-3-RUT.cs csc /t:library /debug:full /out:Ch02-3-MultiFileLibrary.dll /addmodule:Ch02-3-RUT.netmodule Ch02-3-FUT.cs Ch02-3-AssemblyVersionInfo.cs md %3 move /Y Ch02-3-RUT.netmodule %3 move /Y Ch02-3-RUT.pdb %3 move /Y Ch02-3-MultiFileLibrary.dll %3 move /Y Ch02-3-MultiFileLibrary.pdb %3 goto Exit :Way2 csc /t:module /debug:full /out:Ch02-3-RUT.netmodule Ch02-3-RUT.cs csc /t:module /debug:full /out:Ch02-3-FUT.netmodule Ch02-3-FUT.cs Ch02-3-AssemblyVersionInfo.cs al /out:Ch02-3-MultiFileLibrary.dll /t:library Ch02-3-RUT.netmodule Ch02-3-FUT.netmodule md %3 move /Y Ch02-3-RUT.netmodule %3 move /Y Ch02-3-RUT.pdb %3 move /Y Ch02-3-FUT.netmodule %3 move /Y Ch02-3-FUT.pdb %3 move /Y Ch02-3-MultiFileLibrary.dll %3 move /Y Ch02-3-MultiFileLibrary.pdb %3 goto Exit :Exit
Ch02-4-AppUsingMultiFileLibrary.cs
using System; public static class AppUsingMultiFileLibrary { public static void Main() { new AFrequentlyUsedType(); new ARarelyUsedType(); } }