You can used fixed strings in structs for this type of thing .. you can also use unsafe pointers if you wanted to. There is however a reason why people are not giving you examples .. you probably should not be doing this in most cases as it represents another paradigm (note none of the languages you mentioned were OO).
http://msdn2.microsoft.com/en-us/library/zycewsya.aspx and for unsafe code .. http://msdn2.microsoft.com/en-us/library/t2yzs44b.aspx is a good launching pad. Cheers, Greg On 11/13/06, Jon Rothlander <[EMAIL PROTECTED]> wrote:
I'm working on something that is common in other languages, but something that .Net doesn't seem to support, at least it's not common enough for me to search the Internet for it or find it in any books. What I am trying to do is actually simple... Let's say that you have the following data... First Name (20) Last Name (20) Middle Name (20) Area Code (3) Delimiter2 (1) Phone_Prefix (3) Delimiter2 (1) Phone_Suffix (4) That data might look like... Jon Rothlander Gregory 123-123-1234 What I want to do is to create the following variables.... Name_First Name_Last Name_Middle Phone_AreaCode Phone_Del1 Phone_Pre Phone_Del2 Phone_Suf But I also want to create the following variables as well... Name_Full Phone_Full What I cannot figure out is how to do something like... Name_Full = "Jon Rothlander Gregory " Phone_Full = "123-123-1234" Then have the values in the other varibles get filled without having to code lots of Mid() string commands. In other lanugauges like C, RPG, COBOL, and other, you can declare a variable that points to a given set of memory. Then you can declare other variables to point that that same memory. Then when you update one variables, all the other variables that also point to that memory are automatically update as well. That's what I'm trying to do. If you could do this in .Net like you could in COBOL or RPG, you would do something like... Dim Name_Full as String Length(60) Start(1) End(60) Dim Name_First as String Length(20) Start(1) End(20) Dim Name_Last as String Length(20) Start(21) End(40) Dim Name_Middle as String Length(20) Start(41) End(60) What you are able to do here is to tell the compiler that Name_Full starts at position 1 and goes to position 60. Name_First starts at 1 and goes to 20. When you move a value into Name_First, the memory is updated and both Name_Full and Name_First are updated because they point to the same memory location. Is there something like this available in .Net? I have been told that there is, but no one has been able to provide me a sample. I know that I can go in and build a class to control this. I have done that and it works. The problem is that it's way to much work. I want to find something a little less complex. When I built a class to support this, I was able to create the variables as properties over a local property that stores the full set of data. Then each property pulls out a given Mid(x,y) value based on the definition of the variable. This does work, but it's a major pain. I have been told that .Net does support some various ways to have multiple variables point at the same memory location. Any ideas how .Net supports that? I'm not sure where to start looking. Best regards, Jon =================================== This list is hosted by DevelopMentor(r) http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
-- If knowledge can create problems, it is not through ignorance that we can solve them. Isaac Asimov =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com