this keyword in TimeStampExtension class

this keyword in TimeStampExtension class

Old forum URL: forums.lhotka.net/forums/t/11880.aspx


mayurimalgave posted on Thursday, March 14, 2013

Hi Rocky..

In the " UsingCsla4-05-WPF-SL-v0.4 " ebook, there is a static class TimeStampExtension on page no.68 as given below:

public static class TimeSampExtension

{

public static bool Matches(this byte[] stamp1,byte[] stamp2)

{

//other code

}

}

I dont understand:

 how does this keyword work?

 why is it used?

JonnyBee replied on Thursday, March 14, 2013

Hi,

Look up ExtensionMethods and syntax in MSDN. this keyword means that the Matches method is an extension method to byte[] type. 

See: http://msdn.microsoft.com/en-us/library/vstudio/bb383977.aspx 

mayurimalgave replied on Thursday, March 14, 2013

Thanks Jonny..

Copyright (c) Marimer LLC