Sign in to follow this  

3 Questions clr arrays n stuff..

Recommended Posts

Im trying to create a link list with no globals. How do you NULL in .net? Arrays with structs type, How? A good c++ .net 2005 book(currently i have deitel 2003 most of the code is oppsolete)?
ref struct Vehicle{
     // use to move along the link list
	Vehicle ^next;
	Vehicle ^current;
    // data entry
	int ^VIN;
	String ^Model;

// how do you NULL in .net 
// pretty sure "next" needs to be nulled or point somewhere.

Vehicle ^Foreign;
	Foreign = gcnew Vehicle;
	Foreign->Tech = gcnew TechInfo;

// arrays that work for me
int *c[10] = {0,0,0,0,0,0,0,0,0,0};
array<String^>^ sentence = {"stuff"};

// using struct this does not work
array<Vehicle^>^ junk = { "0","0"};

Share this post

Link to post
Share on other sites
NULL is either null in c# or nullptr in C++/CLI.
CLI Arrays with non-CLI structs is not possible (can't mix managed and unmanaged). Use a value class /struct in C++/CLI:

value class Name
// members

value struct Name
// members

array <Name> ^name = gcnew array <Name> (array_size);

Don't know about any books, I've used the MSDN.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this