473,387 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Multi language and developemnt project

5
hi;
we are two coders and I know vb.net anothers know C# .We want to development a windows project.The project have got lots of module so we want to this soem module development with vb.net and some C# .Have can we use do this ? I heart asp.net project we will this but in windows for Have ?

thanks for Help
Nov 26 '08 #1
2 1348
anijos
52
With the .NET toolset you can, but VS.NET doesn't support it directly.

What you want to do is build what's called a multi-module assembly. Each module can be written in whatever language you want, then you link them all together into a single assembly.

Unfortunately, VS.NET only supports single module assemblies, so if you want to go this route you'll need to use the .NET command line tools.

Imagine the file "Dog.cs" is the file that you created in C# that your coworker needs to integrate into his VB project.

--- Dog.cs ---

Expand|Select|Wrap|Line Numbers
  1. public enum DogSize
  2. {
  3.     Small,
  4.     Medium,
  5.     Large
  6. }
  7.  
  8. public class Dog
  9. {
  10.     public Dog(string name, DogSize size)
  11.     {
  12.         m_name = name;
  13.         m_size = size;
  14.     }
  15.  
  16.     public string Name
  17.     {
  18.         get { return m_name; }
  19.     }
  20.  
  21.     public string Bark()
  22.     {
  23.         switch (m_size)
  24.         {
  25.             case DogSize.Small:
  26.                 return "Yip";
  27.             case DogSize.Medium:
  28.                 return "Bark";
  29.             case DogSize.Large:
  30.                 return "Woof";
  31.             default:
  32.                 throw new InvalidOperationException("The dog is sleeping.");
  33.         }
  34.     }
  35.  
  36.     private string  m_name;
  37.     private DogSize  m_size;
  38. }
-- Dog.cs --

Compile "Dog.cs" into a module using the following command line syntax:

csc /target:module Dog.cs

Next have your coworker compile his "DogPound.vb" program (written in VB.NET) with a special command line option to include your "Dog.netmodule" Module

vbc /out:DogPound.exe /target:exe /addmodule:Dog.netmodule DogPound.vb

-- DogPound.vb --

Expand|Select|Wrap|Line Numbers
  1. Imports System
  2. Imports System.Collections
  3.  
  4. Module ConsoleMain
  5.  
  6.     Sub Main()
  7.  
  8.         Dim dogs As ArrayList = New ArrayList()
  9.  
  10.         dogs.Add(New Dog("Pickles", DogSize.Small))
  11.         dogs.Add(New Dog("Shilo", DogSize.Medium))
  12.         dogs.Add(New Dog("Dylan", DogSize.Large))
  13.  
  14.         Dim dog As Dog
  15.         For Each dog In dogs
  16.             Console.WriteLine("{0} says {1}", dog.Name, dog.Bark())
  17.         Next dog
  18.  
  19.     End Sub
  20.  
  21. End Module
-- DogPound.vb --

The result is an Assembly (DogPound.exe) with 2 modules (Dog.netmodule and DogPound.exe). Check it out for yourself by browsing the metadata in ILDASM.exe!

In the example above, you'd probably be better of creating a library for the Dog type and packaging it up in it's own Assembly. That's what I think Microsoft is refering to by being able to use multiple languages in a project. For example, your data services could be written by one team in C# and the user interface could be written by another team using VB.NET (or COBOL.NET if you please).
Nov 26 '08 #2
beceri
5
really thanks I understand this nice way ! I know like this way for vs.net like this ;import examble vb project into C# project then in solution explorer click right Build after you can use this module into C# project like this
dogproj.moddog.Bark() this is the some with you !

I understand that we cant use directly use vb.net & c# code :(

but thanks for your help
Nov 26 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Frank Jona | last post by:
Intellisense with C# and a multi-file assembly is not working. With VB.NET it is working. Is there a fix availible? We're using VisualStudio 2003 Regards Frank
77
by: Jon Skeet [C# MVP] | last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the article on all the groups this is posted to. I've finally managed to finish my article on multi-threading - at least for...
2
by: JollyK | last post by:
Hello friends, In a large asp.net project, I don't think it is a good idea for having one common resource file containing all localized strings for the whole application. I think a better...
2
by: Juuso Hukkanen | last post by:
I need a list of multithreading unsafe C (C99) functions/features. comp.programming.threads provided an initial list of C:ish functions, with following ANSI C functions: asctime, gmtime,...
11
by: Bryan | last post by:
Hi, I work for a company that is heading towards an FDA approved development process. We have always used C++ in a windows environment, and we have more than 6 years of code, applications and...
5
by: =?Utf-8?B?QmVu?= | last post by:
Hi all, Can you share with a few examples in which to create multi-project solutions. I am not sure why that would be necessary. Why would I opt to use this feature in VS2005? I know ...
2
by: Aussie Rules | last post by:
Hi, I have a site that Iwant to either display my text in english or french, based on the users prefernces ? I am new to webforms, but I know in winforms, this is pretty easy with a resource...
14
by: yxq | last post by:
Hello, I want to build the multi-language application with the xml file, how to do? could anyone tell a sample? Thank you
7
Curtis Rutland
by: Curtis Rutland | last post by:
Building A Silverlight (2.0) Multi-File Uploader All source code is C#. VB.NET source is coming soon. Note: This project requires Visual Studio 2008 SP1 or Visual Web Developer 2008 SP1 and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.