<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FLanguage_Basics%2FDLL_Library</id>
		<title>Csharp/C Sharp/Language Basics/DLL Library - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FLanguage_Basics%2FDLL_Library"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/DLL_Library&amp;action=history"/>
		<updated>2026-04-29T16:42:32Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/DLL_Library&amp;diff=758&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/DLL_Library&amp;diff=758&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:18Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/DLL_Library&amp;diff=759&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/DLL_Library&amp;diff=759&amp;oldid=prev"/>
				<updated>2010-05-26T11:39:48Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Calling Native DLL Functions==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
A Programmer&amp;quot;s Introduction to C# (Second Edition)&lt;br /&gt;
by Eric Gunnerson&lt;br /&gt;
Publisher: Apress  L.P.&lt;br /&gt;
ISBN: 1-893115-62-3&lt;br /&gt;
*/&lt;br /&gt;
// 31 - Interop\Calling Native DLL Functions&lt;br /&gt;
// copyright 2000 Eric Gunnerson&lt;br /&gt;
using System.Runtime.InteropServices;&lt;br /&gt;
public class CallingNativeDLLFunctions&lt;br /&gt;
{&lt;br /&gt;
    [DllImport(&amp;quot;user32.dll&amp;quot;)]&lt;br /&gt;
    public static extern int MessageBox(int h, string m, &lt;br /&gt;
    string c, int type);&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        int retval = MessageBox(0, &amp;quot;Hello&amp;quot;, &amp;quot;Caption&amp;quot;, 0);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Creates a library assembly==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Mastering Visual C# .NET&lt;br /&gt;
by Jason Price, Mike Gunderloy&lt;br /&gt;
Publisher: Sybex;&lt;br /&gt;
ISBN: 0782129110&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
  Example16_2.cs creates a library assembly&lt;br /&gt;
*/&lt;br /&gt;
// compile with: csc /target:library Example16_2.cs&lt;br /&gt;
using System;&lt;br /&gt;
using System.Reflection;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
[assembly:AssemblyVersionAttribute(&amp;quot;1.0.0.0&amp;quot;)]&lt;br /&gt;
[assembly:AssemblyTitleAttribute(&amp;quot;Example 16.2&amp;quot;)]&lt;br /&gt;
public class Example16_2 &lt;br /&gt;
{&lt;br /&gt;
  string privateString;&lt;br /&gt;
  public string inString &lt;br /&gt;
  {&lt;br /&gt;
    get &lt;br /&gt;
    {&lt;br /&gt;
      return privateString;&lt;br /&gt;
    }&lt;br /&gt;
    set&lt;br /&gt;
    {&lt;br /&gt;
      privateString = inString;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  public void upper(out string upperString)&lt;br /&gt;
  {&lt;br /&gt;
    upperString = privateString.ToUpper();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File to be used as a library assembly==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
C# Programming Tips &amp;amp; Techniques&lt;br /&gt;
by Charles Wright, Kris Jamsa&lt;br /&gt;
Publisher: Osborne/McGraw-Hill (December 28, 2001)&lt;br /&gt;
ISBN: 0072193794&lt;br /&gt;
*/&lt;br /&gt;
//  Circle.cs -- File to be used as a library assembly&lt;br /&gt;
//&lt;br /&gt;
//               Compile this file with the following command line:&lt;br /&gt;
//                   C:&amp;gt;csc /t:library Circle.cs&lt;br /&gt;
using System;&lt;br /&gt;
namespace nsCircle&lt;br /&gt;
{&lt;br /&gt;
// A structure to define a Cartesian point.&lt;br /&gt;
    public struct POINT&lt;br /&gt;
    {&lt;br /&gt;
        public POINT (int x, int y)&lt;br /&gt;
        {&lt;br /&gt;
            cx = x;&lt;br /&gt;
            cy = y;&lt;br /&gt;
        }&lt;br /&gt;
        public int  cx;&lt;br /&gt;
        public int  cy;&lt;br /&gt;
        public override string ToString()&lt;br /&gt;
        {&lt;br /&gt;
           return (String.Format (&amp;quot;(&amp;quot; + cx + &amp;quot;, &amp;quot; + cy + &amp;quot;)&amp;quot;));&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public class clsCircle&lt;br /&gt;
    {&lt;br /&gt;
// Two constructors to define the circle.&lt;br /&gt;
        public clsCircle (double radius, POINT center)&lt;br /&gt;
        {&lt;br /&gt;
            m_Center = center;&lt;br /&gt;
            m_Radius = radius;&lt;br /&gt;
        }&lt;br /&gt;
        public clsCircle (double radius, int cx, int cy)&lt;br /&gt;
        {&lt;br /&gt;
            m_Center.cx = cx;&lt;br /&gt;
            m_Center.cy = cy;&lt;br /&gt;
            m_Radius = radius;&lt;br /&gt;
        }&lt;br /&gt;
        public clsCircle ()&lt;br /&gt;
        {&lt;br /&gt;
            m_Center.cx = 0;&lt;br /&gt;
            m_Center.cy = 0;&lt;br /&gt;
            m_Radius = 0;&lt;br /&gt;
        }&lt;br /&gt;
        public double Radius&lt;br /&gt;
        {&lt;br /&gt;
            get {return (m_Radius);}&lt;br /&gt;
            set {m_Radius = value;}&lt;br /&gt;
        }&lt;br /&gt;
        public POINT Center&lt;br /&gt;
        {&lt;br /&gt;
            get {return (m_Center);}&lt;br /&gt;
            set {m_Center = value;}&lt;br /&gt;
        }&lt;br /&gt;
// Fields to contain circle data.&lt;br /&gt;
        POINT m_Center;&lt;br /&gt;
        private double m_Radius;&lt;br /&gt;
// Constants to make life easier&lt;br /&gt;
        private const double pi = 3.14159;&lt;br /&gt;
        private const double radian = 57.29578;&lt;br /&gt;
// Return the area of the circle&lt;br /&gt;
        public double Area&lt;br /&gt;
        {&lt;br /&gt;
            get {return (m_Radius * m_Radius * pi);}&lt;br /&gt;
        }&lt;br /&gt;
// Return the diameter of the circle&lt;br /&gt;
        public double Diameter&lt;br /&gt;
        {&lt;br /&gt;
            get {return (2 * m_Radius);}&lt;br /&gt;
        }&lt;br /&gt;
// Return the coordinates of a point on the circle at a given angle.&lt;br /&gt;
        public POINT PointOnCircle (double degrees)&lt;br /&gt;
        {&lt;br /&gt;
            POINT pt;&lt;br /&gt;
            double fAngle = degrees / radian;&lt;br /&gt;
// Compute the x position of the point&lt;br /&gt;
            pt.cx = (int)((double) m_Radius * Math.Cos (fAngle) + 0.5);&lt;br /&gt;
// Compute the y position of the point&lt;br /&gt;
            pt.cy = (int)((double) m_Radius * Math.Sin (fAngle) + 0.5);&lt;br /&gt;
            return (pt);&lt;br /&gt;
        }&lt;br /&gt;
// Return the area of a slice determined by a given angle.&lt;br /&gt;
        public double AreaOfSlice (double degrees)&lt;br /&gt;
        {&lt;br /&gt;
            double fAngle = degrees / 57.29578;&lt;br /&gt;
            return (Area * fAngle / (2 * pi));&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Geom.cs -- Demonstrates using an assembly.&lt;br /&gt;
//&lt;br /&gt;
//            Compile this program with the following command line:&lt;br /&gt;
//                C:&amp;gt;csc /r:circle.dll Geom.cs&lt;br /&gt;
using System;&lt;br /&gt;
using nsCircle;&lt;br /&gt;
namespace nsGeometry&lt;br /&gt;
{&lt;br /&gt;
    class clsMain&lt;br /&gt;
    {&lt;br /&gt;
        static public void Main ()&lt;br /&gt;
        {&lt;br /&gt;
            double angle = 32.6;&lt;br /&gt;
// Create an instance of the circle class.&lt;br /&gt;
            clsCircle circle = new clsCircle (420, 0, 0);&lt;br /&gt;
// Get the point on the circle at the angle.&lt;br /&gt;
            POINT pt = circle.PointOnCircle (angle);&lt;br /&gt;
// Show the total area of the circle.&lt;br /&gt;
            Console.WriteLine (&amp;quot;The area of the circle is &amp;quot; + circle.Area);&lt;br /&gt;
// Show the point.&lt;br /&gt;
            Console.WriteLine (&amp;quot;The point on the circle is at &amp;quot; + pt);&lt;br /&gt;
// Show the area of the slice between 0 degrees and the angle.&lt;br /&gt;
            Console.WriteLine (&amp;quot;The area of the slice is &amp;quot; +&lt;br /&gt;
                                circle.AreaOfSlice (angle));&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File to be used as a library assembly 2==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
C# Programming Tips &amp;amp; Techniques&lt;br /&gt;
by Charles Wright, Kris Jamsa&lt;br /&gt;
Publisher: Osborne/McGraw-Hill (December 28, 2001)&lt;br /&gt;
ISBN: 0072193794&lt;br /&gt;
*/&lt;br /&gt;
//  Circle.cs -- File to be used as a library assembly&lt;br /&gt;
//&lt;br /&gt;
//               Compile this file with the following command line:&lt;br /&gt;
//                   C:&amp;gt;csc /t:module Circle.cs&lt;br /&gt;
using System;&lt;br /&gt;
namespace nsCircle&lt;br /&gt;
{&lt;br /&gt;
// A structure to define a Cartesian point.&lt;br /&gt;
    public struct POINT&lt;br /&gt;
    {&lt;br /&gt;
        public POINT (int x, int y)&lt;br /&gt;
        {&lt;br /&gt;
            cx = x;&lt;br /&gt;
            cy = y;&lt;br /&gt;
        }&lt;br /&gt;
        public int  cx;&lt;br /&gt;
        public int  cy;&lt;br /&gt;
        public override string ToString()&lt;br /&gt;
        {&lt;br /&gt;
           return (String.Format (&amp;quot;(&amp;quot; + cx + &amp;quot;, &amp;quot; + cy + &amp;quot;)&amp;quot;));&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public class clsCircle&lt;br /&gt;
    {&lt;br /&gt;
// Two constructors to define the circle.&lt;br /&gt;
        public clsCircle (double radius, POINT center)&lt;br /&gt;
        {&lt;br /&gt;
            m_Center = center;&lt;br /&gt;
            m_Radius = radius;&lt;br /&gt;
        }&lt;br /&gt;
        public clsCircle (double radius, int cx, int cy)&lt;br /&gt;
        {&lt;br /&gt;
            m_Center.cx = cx;&lt;br /&gt;
            m_Center.cy = cy;&lt;br /&gt;
            m_Radius = radius;&lt;br /&gt;
        }&lt;br /&gt;
        public clsCircle ()&lt;br /&gt;
        {&lt;br /&gt;
            m_Center.cx = 0;&lt;br /&gt;
            m_Center.cy = 0;&lt;br /&gt;
            m_Radius = 0;&lt;br /&gt;
        }&lt;br /&gt;
        public double Radius&lt;br /&gt;
        {&lt;br /&gt;
            get {return (m_Radius);}&lt;br /&gt;
            set {m_Radius = value;}&lt;br /&gt;
        }&lt;br /&gt;
        public POINT Center&lt;br /&gt;
        {&lt;br /&gt;
            get {return (m_Center);}&lt;br /&gt;
            set {m_Center = value;}&lt;br /&gt;
        }&lt;br /&gt;
// Fields to contain circle data.&lt;br /&gt;
        POINT m_Center;&lt;br /&gt;
        private double m_Radius;&lt;br /&gt;
// Constants to make life easier&lt;br /&gt;
        private const double pi = 3.14159;&lt;br /&gt;
        private const double radian = 57.29578;&lt;br /&gt;
// Return the area of the circle&lt;br /&gt;
        public double Area&lt;br /&gt;
        {&lt;br /&gt;
            get {return (m_Radius * m_Radius * pi);}&lt;br /&gt;
        }&lt;br /&gt;
// Return the diameter of the circle&lt;br /&gt;
        public double Diameter&lt;br /&gt;
        {&lt;br /&gt;
            get {return (2 * m_Radius);}&lt;br /&gt;
        }&lt;br /&gt;
// Return the coordinates of a point on the circle at a given angle.&lt;br /&gt;
        public POINT PointOnCircle (double degrees)&lt;br /&gt;
        {&lt;br /&gt;
            POINT pt;&lt;br /&gt;
            double fAngle = degrees / radian;&lt;br /&gt;
// Compute the x position of the point&lt;br /&gt;
            pt.cx = (int)((double) m_Radius * Math.Cos (fAngle) + 0.5);&lt;br /&gt;
// Compute the y position of the point&lt;br /&gt;
            pt.cy = (int)((double) m_Radius * Math.Sin (fAngle) + 0.5);&lt;br /&gt;
            return (pt);&lt;br /&gt;
        }&lt;br /&gt;
// Return the area of a slice determined by a given angle.&lt;br /&gt;
        public double AreaOfSlice (double degrees)&lt;br /&gt;
        {&lt;br /&gt;
            double fAngle = degrees / 57.29578;&lt;br /&gt;
            return (Area * fAngle / (2 * pi));&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Geom.cs -- Demonstrates using an assembly.&lt;br /&gt;
//&lt;br /&gt;
//            Build this program and the Circle assembly using&lt;br /&gt;
//            the following command sequence:&lt;br /&gt;
//                C:&amp;gt;csc /t:module Circle.cs&lt;br /&gt;
//                C:&amp;gt;sn -k Circle.snk&lt;br /&gt;
//                C:&amp;gt;al /keyfile:Circle.snk /version:1.0.0.0 /out:Circle.dll Circle.NetModule&lt;br /&gt;
//                C:&amp;gt;gacutil /i Circle.dll&lt;br /&gt;
//                C:&amp;gt;csc /r:circle.dll Geom.cs&lt;br /&gt;
//&lt;br /&gt;
using System;&lt;br /&gt;
using nsCircle;&lt;br /&gt;
namespace nsGeometry&lt;br /&gt;
{&lt;br /&gt;
    class clsMain&lt;br /&gt;
    {&lt;br /&gt;
        static public void Main ()&lt;br /&gt;
        {&lt;br /&gt;
            double angle = 32.6;&lt;br /&gt;
// Create an instance of the circle class.&lt;br /&gt;
            clsCircle circle = new clsCircle (420, 0, 0);&lt;br /&gt;
// Get the point on the circle at the angle.&lt;br /&gt;
            POINT pt = circle.PointOnCircle (angle);&lt;br /&gt;
// Show the total area of the circle.&lt;br /&gt;
            Console.WriteLine (&amp;quot;The area of the circle is &amp;quot; + circle.Area);&lt;br /&gt;
// Show the point.&lt;br /&gt;
            Console.WriteLine (&amp;quot;The point on the circle is at &amp;quot; + pt);&lt;br /&gt;
// Show the area of the slice between 0 degrees and the angle.&lt;br /&gt;
            Console.WriteLine (&amp;quot;The area of the slice is &amp;quot; +&lt;br /&gt;
                                circle.AreaOfSlice (angle));&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Loading Assemblies: Making it Dynamic==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
A Programmer&amp;quot;s Introduction to C# (Second Edition)&lt;br /&gt;
by Eric Gunnerson&lt;br /&gt;
Publisher: Apress  L.P.&lt;br /&gt;
ISBN: 1-893115-62-3&lt;br /&gt;
*/&lt;br /&gt;
// 30 - Execution-Time Code Generation\Loading Assemblies\Making it Dynamic&lt;br /&gt;
// copyright 2000 Eric Gunnerson&lt;br /&gt;
// file=LogAddInToFile.cs&lt;br /&gt;
// compile with: csc /r:..\logdriver.dll /target:library logaddintofile.cs&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections;&lt;br /&gt;
using System.IO;&lt;br /&gt;
public class LogAddInToFile: ILogger&lt;br /&gt;
{&lt;br /&gt;
    StreamWriter streamWriter;&lt;br /&gt;
    &lt;br /&gt;
    public LogAddInToFile()&lt;br /&gt;
    {&lt;br /&gt;
        streamWriter = File.CreateText(@&amp;quot;logger.log&amp;quot;);&lt;br /&gt;
        streamWriter.AutoFlush = true;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public void Log(string message)&lt;br /&gt;
    {&lt;br /&gt;
        streamWriter.WriteLine(message);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
//=============================================================&lt;br /&gt;
// 30 - Execution-Time Code Generation\Loading Assemblies&lt;br /&gt;
// copyright 2000 Eric Gunnerson&lt;br /&gt;
// file=LogDriver.cs&lt;br /&gt;
// compile with: csc /target:library LogDriver.cs&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections;&lt;br /&gt;
public interface ILogger&lt;br /&gt;
{&lt;br /&gt;
    void Log(string message);&lt;br /&gt;
}&lt;br /&gt;
public class LogDriver&lt;br /&gt;
{&lt;br /&gt;
    ArrayList loggers = new ArrayList();&lt;br /&gt;
    &lt;br /&gt;
    public LogDriver()&lt;br /&gt;
    {&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public void AddLogger(ILogger logger)&lt;br /&gt;
    {&lt;br /&gt;
        loggers.Add(logger);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public void Log(string message) &lt;br /&gt;
    {&lt;br /&gt;
        foreach (ILogger logger in loggers)&lt;br /&gt;
        {&lt;br /&gt;
            logger.Log(message);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
public class LogConsole: ILogger&lt;br /&gt;
{&lt;br /&gt;
    public void Log(string message)&lt;br /&gt;
    {&lt;br /&gt;
        Console.WriteLine(message);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>