Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Naming conventions for custom methods?
Message
 
 
To
18/11/2008 09:47:59
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01362229
Message ID:
01362543
Views:
24
>>>> A method belongs to one and only one class, doesn't it?
>>>>
>>>
>>>Except, perhaps, when your are dealing with extension methods
>>>
>>>Here's one that applies to all classes
>>>
>>>
>>>public static partial class ExtensionMethods
>>>{
>>>        static public string MyToString<T>(this T s)
>>>	{
>>>		return "<" + s.ToString() + ">";
>>>	}
>>>		
>>>}
>>>
>>>
>>>or
>>>
>>>public static partial class ExtensionMethods
>>>{
>>>        static public string MyToString(this object s)
>>>	{
>>>		return "<" + s.ToString() + ">";
>>>	}
>>>		
>>>}
>>>
>>>
>>>
>>>Here's one that applies to all classes which implement IEquatable< T >
>>>
>>>
>>>public static partial class ExtensionMethods
>>>{
>>>     public static bool InList<T>(this T s, params T[] list) where T : IEquatable<T>
>>>		{
>>>			return list.Contains(s);
>>>		}		
>>>}
>>>
>>
>>Thanks. Extension methods are still over my head at this point. I kinda sorta understand generics and interfaces, but have not gotten to extension methods. Yet ;-)
>
>hey - I just wanted to point it out - and the first and third use generics
>
>Seriously, I am about one meter high on the c# mountain. By the time you'll have finished your course, you'll know far more than I
>

I doubt that, but thanks for the encouragement! And I certainly didn't take any offense.

I dropped the course, BTW. After the first week I decided to opt out and get 90% of my money back. It was all right but considering the cost ($$$) I decided I am better off learning .NET by other means. The objective of becoming proficient enough in C#.NET to get a job using it remains the same, only the means has changed. Still studying hard and liking it more and more.

Can't really say much more about the course or the organization that offers it. They make you sign a non-disclosure agreement you wouldn't believe, and I understand they aren't shy about enforcing it.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform