Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 One C# issue (I think)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pwaugh
Ketchup Master

USA
68 Posts

Posted - Mar 04 2008 :  4:08:39 PM  Show Profile  Reply with Quote
Ok, this could be a defective programmer, but here is what I notice:

If I am programming in C# and have this class:


namespace House
{
	class Outside : Location
	{
		public Outside(bool hot, string name)
			: base(name)
		{
			this.hot = hot;   // Problem to type
		}

		public bool Hot { get; }
	}
}


VAX makes it difficult for me because when I try to type "this.hot" and then press [space] it converts my "hot" which is a hidden backing field of the Hot property to "Hot".

Looks like you are going to need language specific features after all. =)

Is there anything that can be done about this behavior? I though I was screwing up code till I watched while I typed and saw VAX changing it for me.

Patrick

Programming in C++

VA_X.dll 10.4.1626.0
Built 2008.01.17

(1-user license) Support ends 2009.01.29

DevEnv.exe version 9.0.21022.8
msenv.dll version 9.0.21022.8
Comctl32.dll version 6.0.2900.2982
Windows XP 5.1 Build 2600 Service Pack 2
Single processor
Platform: Win32

feline
Whole Tomato Software

United Kingdom
18940 Posts

Posted - Mar 06 2008 :  3:56:06 PM  Show Profile  Reply with Quote
Does this compile? It does not compile for me, but I do not know what namespace "Location" is from, so I do not have the correct using statement.

I did the following test, using your code with using VS2005 and VA 1626
I disabled VA via the VAssistX IDE menu.
I typed

this.|

underneath your line, and press CTRL-SPACE to trigger a listbox. I now continued typing, including the space:

this.hot |

and when I press the space the IDE accepts the current suggestion "Hot" from the listbox and replaces "hot" with "Hot". The same thing may be happening to you.

zen is the art of being at one with the two'ness
Go to Top of Page

pwaugh
Ketchup Master

USA
68 Posts

Posted - Mar 06 2008 :  6:26:19 PM  Show Profile  Reply with Quote
It is a .NET 3.5 feature only I think (won't work in VS 2005).

Patrick

Programming in C++

VA_X.dll 10.4.1626.0
Built 2008.01.17

(1-user license) Support ends 2009.01.29

DevEnv.exe version 9.0.21022.8
msenv.dll version 9.0.21022.8
Comctl32.dll version 6.0.2900.2982
Windows XP 5.1 Build 2600 Service Pack 2
Single processor
Platform: Win32
Go to Top of Page

mwb1100
Ketchup Master

82 Posts

Posted - Mar 06 2008 :  8:10:35 PM  Show Profile  Reply with Quote
When using auto-implemented properties, the 'hidden' private field that backs the property is not directly accessible, even inside the class. The backing field does not have the same name as the property changed to lowercase - the name is something like '<propertyName>k__BackingField'. So in your example code the backing field for the Hot property is named '<Hot>k__BackingField'. Note that it's not a valid C# identifier.

See http://community.bartdesmet.net/blogs/bart/archive/2007/03/03/c-3-0-automatic-properties-explained.aspx for details, but realize that it looks like the naming details have changed in the final release.

So the "this.hot = hot" expression won't compile even if you could type it easily.

From the MSDN documentation: "Auto-implemented properties must declare both a get and a set accessor. To create a readonly auto-implemented property, give it a private set accessor".

So, you'd need to change your example to look something like:


class Outside
{
    public Outside(bool hot, string name)
    {
        this.Hot = hot;
    }

    public bool Hot { get; private set;}
}


Edited by - mwb1100 on Mar 07 2008 12:01:30 AM
Go to Top of Page

StarWing
Junior Member

13 Posts

Posted - Mar 08 2008 :  11:34:52 PM  Show Profile  Reply with Quote
Yes, it always occurs when i use C++....
Go to Top of Page

pwaugh
Ketchup Master

USA
68 Posts

Posted - Mar 09 2008 :  06:17:09 AM  Show Profile  Reply with Quote
Hey, thanks for the info. As you can tell, I'm just learning C#, and I thought it might have something to do with me doing something wrong as you have pointed out. =)

Programming in C++

VA_X.dll 10.4.1626.0
Built 2008.01.17

(1-user license) Support ends 2009.01.29

DevEnv.exe version 9.0.21022.8
msenv.dll version 9.0.21022.8
Comctl32.dll version 6.0.2900.2982
Windows XP 5.1 Build 2600 Service Pack 2
Single processor
Platform: Win32
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000