User Tools

Site Tools


namespace_assembly_reference

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
namespace_assembly_reference [2018/06/26 05:00] wolfgangriedmannnamespace_assembly_reference [2018/09/25 06:01] wolfgangriedmann
Line 6: Line 6:
 An assembly is simply a DLL (the concept of an entirely linked library as in VO does not exists anymore). An assembly is simply a DLL (the concept of an entirely linked library as in VO does not exists anymore).
 Such an assembly can be: Such an assembly can be:
-one of the assemblies from the .NET framework, these are located in the GAC - the Global Assembly Cache. +  * one of the assemblies from the .NET framework, these are located in the GAC - the Global Assembly Cache. 
-one of the other assemblies, located in the GAC +  one of the other assemblies, located in the GAC 
-somewhere on your disk. In this case both Visual Studio and XIDE need to copy it to the BIN directory +  somewhere on your disk. In this case both Visual Studio and XIDE need to copy it to the BIN directory 
-in your current project (XIDE) or solution (Visual Studio). Then the DLL file is already in your BIN folder+  in your current project (XIDE) or solution (Visual Studio). Then the DLL file is already in your BIN folder
  
 Please note that your referenced assembly could need other assemblies, either from the GAC or from another location. Please note that your referenced assembly could need other assemblies, either from the GAC or from another location.
Line 17: Line 17:
 <code>System.IO.File.WriteAllText( "c:\temp\HelloWorld.txt", "Hello World" )</code> <code>System.IO.File.WriteAllText( "c:\temp\HelloWorld.txt", "Hello World" )</code>
 or to include the needed namespace at the top of your source code, and then use the class directly: or to include the needed namespace at the top of your source code, and then use the class directly:
-<code>using System.IO+<code visualfoxpro>using System.IO
 ..... .....
 File.WriteAllText( "c:\temp\HelloWorld.txt", "Hello World" )</code> File.WriteAllText( "c:\temp\HelloWorld.txt", "Hello World" )</code>
Line 23: Line 23:
 If you use your own assemblies, you should look at the sources, but if it is either a .NET Framework assembly or a 3rd party assembly, please look at the documentation. If you use your own assemblies, you should look at the sources, but if it is either a .NET Framework assembly or a 3rd party assembly, please look at the documentation.
 For the File class, the MSDN says: For the File class, the MSDN says:
-<code>Namespace:   System.IO+<code visualfoxpro>Namespace:   System.IO
 Assembly:  mscorlib (in mscorlib.dll)</code> Assembly:  mscorlib (in mscorlib.dll)</code>
  
Line 29: Line 29:
   * have the mscorlib.dll in your references   * have the mscorlib.dll in your references
   * either have a using System.IO at the begin of your source or use the full referenced class name    * either have a using System.IO at the begin of your source or use the full referenced class name 
 +
 +To make it easier for people migrating from VO the development team has added a special mechanism to the X# compiler (this was available also in the Vulcan compiler): an assembly can add an attribute that lists namespaces that should be treated as "implicit". And there is a compiler option that intructs the compiler to automatically add these "implicit namespaces" as using statements to your code.
 +The XPorter automatically enables this option, so you can still use classes like DbServer and DataWindow without including using statements for these classes.
 +Vn2Ado also uses this mechanism. If you enable this option then you can use the Ado.. classes without extra using statement.
  
namespace_assembly_reference.txt · Last modified: 2020/02/12 05:15 by wolfgangriedmann