Sorry my previous post may have been incorrect. I think i got confused with something i read. I think it goes that there is no performance penality using proporties over methods to set member fields because internally the complier turns them into methods anyway.
However in saying that i tried to test the cost of using a property and the performance was so small, i couldnt measure it in any short amout of time. Regards Daniel ----- Original Message ----- From: "Daniel Young - IS" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 22, 2003 5:27 PM Subject: Re: [ADVANCED-DOTNET] Do properties need a 'holder' keyword? > Actually I think it's a good rule of thumb full stop. > > There is no performance penalty between calling public member variables and > accessing them through properties. > > The only performance penalty is on your fingers, writing properties can be > very tedious work. > > Enclosed is my example of the IL code produced using public property and > using property > > Regards > Dan > > // using property > > .method private hidebysig static void Main(string[] args) cil managed > { > .entrypoint > .custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01 > 00 00 00 ) > // Code size 30 (0x1e) > .maxstack 2 > .locals init ([0] class ConsoleApplication10.Class1 c) > IL_0000: newobj instance void ConsoleApplication10.Class1::.ctor() > IL_0005: stloc.0 > IL_0006: ldloc.0 > IL_0007: ldstr "hello world" > IL_000c: stfld string ConsoleApplication10.Class1::test > IL_0011: ldloc.0 > IL_0012: callvirt instance void ConsoleApplication10.Class1::WriteIt() > IL_0017: call string [mscorlib]System.Console::ReadLine() > IL_001c: pop > IL_001d: ret > } // end of method Class1::Main > > > // Using public fields > .method private hidebysig static void Main(string[] args) cil managed > { > .entrypoint > .custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01 > 00 00 00 ) > // Code size 30 (0x1e) > .maxstack 2 > .locals init (class ConsoleApplication10.Class1 V_0) > IL_0000: newobj instance void ConsoleApplication10.Class1::.ctor() > IL_0005: stloc.0 > IL_0006: ldloc.0 > IL_0007: ldstr "hello world" > IL_000c: stfld string ConsoleApplication10.Class1::test > IL_0011: ldloc.0 > IL_0012: callvirt instance void ConsoleApplication10.Class1::WriteIt() > IL_0017: call string [mscorlib]System.Console::ReadLine() > IL_001c: pop > IL_001d: ret > } // end of method Class1::Main > > > > > -----Original Message----- > From: Urs Eichmann [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 22 October 2003 3:34 a.m. > To: [EMAIL PROTECTED] > Subject: Re: [ADVANCED-DOTNET] Do properties need a 'holder' keyword? > > > Also, some ams have rules. Our rules say: NO PUBLIC VARIABLES. NEVER. > > Thomas, > IMHO This is a good rule - as long as it applies to public classes only. But > if the classes are private to your assembly, I don't see the point of not > having public members. After all, there can be quite a performance penalty > if you use properties vs. Member variables. > > Urs > > =================================== > This list is hosted by DevelopMentor(r) http://www.develop.com > NEW! ASP.NET courses you may be interested in: > > 2 Days of ASP.NET, 29 Sept 2003, in Redmond > http://www.develop.com/courses/2daspdotnet > > Guerrilla ASP.NET, 13 Oct 2003, in Boston > http://www.develop.com/courses/gaspdotnet > > View archives and manage your subscription(s) at http://discuss.develop.com > > ________________________________________ > > Caution: The content of this email is confidential and may be legally > privileged. If it is not intended for you, please email the sender > immediately and destroy the original message. You may not copy, disclose or > use the contents of this message in any way. > > Important: Employees of EziBuy Ltd are expressly required not to make any > offensive or defamatory statements and/or not to communicate offensive > material. Any such communication is contrary to company policy and outside > the scope of the employment of the individual concerned. EziBuy Ltd will > therefore not accept any liability in respect of such a communication, and > the employee responsible will be personally liable for any damages or other > liability arising. > ________________________________________ > > > =================================== > This list is hosted by DevelopMentorŪ http://www.develop.com > NEW! ASP.NET courses you may be interested in: > > 2 Days of ASP.NET, 29 Sept 2003, in Redmond > http://www.develop.com/courses/2daspdotnet > > Guerrilla ASP.NET, 13 Oct 2003, in Boston > http://www.develop.com/courses/gaspdotnet > > View archives and manage your subscription(s) at http://discuss.develop.com > > =================================== This list is hosted by DevelopMentorŪ http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com