-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: Nasha
Message 1 in Discussion
Hi Guys, Yesterday I had posted the differences between C# and Vb.Net. One of the
differences between C# and Vb.Net is (checkout the article before reading ahead) that
in C# you can have unmanaged code whilst in VB.Net. I happen one of those developers
who use to love pointers rite from the good old 'C' days. Here are the steps to
create a simple unmanaged code in C# (as you would have done in C\C++) 1. Create a
new console application. 2. Create an empty class e.g. UnManagedCode.cs, 3. Create a
static void Main function. (C or C++ style) 4. Create a another function named
funWithPointers in the class to be called from Main. 6. Type in the code as shown in
the snippet below. 7. Go to you Project Properties .. Configuration Properties ...Set
Allow Unsafe Code Blocks to true by default it is false. 8. F5 Code snippet
using System; namespace PointersinCSharp
{
public class UnManagedCode
{
unsafe void funWithPointers()
{
Console.WriteLine("This is demo for unmanaged code");
int i = 100;
int *p = &i;
Console.WriteLine("\n" + "The value of p is =" + *p);
Console.ReadLine();
}
static void Main()
{
UnManagedCode objUnManagedCode = new UnManagedCode();
objUnManagedCode.funWithPointers();
}
}
}
So now you can have both managed and unmanaged code in C#. Have fun with pointers
!!!!
-- Please mail me your comments for my articles. I hope this step from my end is
helpful to all of us.
Regards,
Namratha (Nasha)
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]