473,385 Members | 1,331 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Extension Methods questions

Some simple yes/no questions. I tried googling first and couldn't find
specific answers.
These are related to .Net 3.5 extension methods

1) I found that I would like to add properties as well as methods. Is
there such a thing as Extension Properties?

2) Can you add static extension methods to classes? The 'this' part
implies an instance.
For example, I'd like to be able to go: System.IO.File.MyCrazyMethod()

Cheers,
Steven

Aug 29 '07 #1
8 1757
Steven Nagy <le*********@hotmail.comwrote:
Some simple yes/no questions. I tried googling first and couldn't find
specific answers.
These are related to .Net 3.5 extension methods

1) I found that I would like to add properties as well as methods. Is
there such a thing as Extension Properties?
Not yet. And yes, it's a pain, especially if you're trying to write a
fluent interface.
2) Can you add static extension methods to classes? The 'this' part
implies an instance.
For example, I'd like to be able to go: System.IO.File.MyCrazyMethod()
Not as far as I'm aware.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Aug 29 '07 #2
Hi,

"Steven Nagy" <le*********@hotmail.comwrote in message
news:11*********************@q5g2000prf.googlegrou ps.com...
Some simple yes/no questions. I tried googling first and couldn't find
specific answers.
These are related to .Net 3.5 extension methods

1) I found that I would like to add properties as well as methods. Is
there such a thing as Extension Properties?
I do not think so, No idea why though.
Basically extension methods were a needed addition for Linq, I do not think
that for Linq you require extension Properties.

Aug 29 '07 #3
Thanks Jon and Ignacio.
Are you guys doing a lot of projects with 3.5 or even LINQ for that
matter?
(Production apps I mean, not play stuff)

Aug 30 '07 #4
Hi,

"Steven Nagy" <le*********@hotmail.comwrote in message
news:11**********************@x35g2000prf.googlegr oups.com...
Thanks Jon and Ignacio.
Are you guys doing a lot of projects with 3.5 or even LINQ for that
matter?
(Production apps I mean, not play stuff)
Nop, in my company we do everything in 2.0 , all the new stuff I mean, we
are still supporting and developing 1.1 apps.
Aug 30 '07 #5
On Aug 30, 3:08 am, Steven Nagy <learndot...@hotmail.comwrote:
Thanks Jon and Ignacio.
Are you guys doing a lot of projects with 3.5 or even LINQ for that
matter?
(Production apps I mean, not play stuff)
Well, I'm doing writing using VS2008 beta 2, but not a production
application.

I doubt that I'll be using .NET 3.5 in production for a while - but I
hope to start using C# 3 targeting .NET 2.0 shortly after VS2008 is
released, if it's stable enough.

Almost all the new features of C# 3 can be used with .NET 2.0 - just
not LINQ itself.

Jon

Aug 30 '07 #6
On Aug 31, 1:27 am, "Jon Skeet [C# MVP]" <sk...@pobox.comwrote:
On Aug 30, 3:08 am, Steven Nagy <learndot...@hotmail.comwrote:
Thanks Jon and Ignacio.
Are you guys doing a lot of projects with 3.5 or even LINQ for that
matter?
(Production apps I mean, not play stuff)

Well, I'm doing writing using VS2008 beta 2, but not a production
application.

I doubt that I'll be using .NET 3.5 in production for a while - but I
hope to start using C# 3 targeting .NET 2.0 shortly after VS2008 is
released, if it's stable enough.

Almost all the new features of C# 3 can be used with .NET 2.0 - just
not LINQ itself.

Jon
Hey I hadn't thought of that.
So I could use Extension methods, for example, but compile to a 2.0
app.

Thanks guys.

Aug 31 '07 #7
Steven Nagy <le*********@hotmail.comwrote:
Hey I hadn't thought of that.
So I could use Extension methods, for example, but compile to a 2.0
app.
Funny you should mention extension methods - they *sort of* require
..NET 3.5 support, but you can work round it. I blogged about it
recently:

http://msmvps.com/blogs/jon.skeet/ar...nsion-methods-
and-net-2-0.aspx

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Aug 31 '07 #8
Nice one.

Sep 3 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Samuel Siren | last post by:
Have just read about LINQ ant the new planned features of C# 3.0. I think it's fantastic, but I have a few questions about extension methods: Question 1: Syntax ------------------ Why is the...
3
by: Deckarep | last post by:
I recently got into somewhat of a debate with a fellow co-worker. First I asked him if he new of a way to add a method to an existing class like enhancing a class but without using Inheritance. He...
4
by: =?Utf-8?B?ZGF2ZQ==?= | last post by:
I can't get Extension Methods to work in Visual Basic 2008 Express. Says "Type 'Extension' is not defined." Looks like the library included with the Express edition is crippled. What am I...
3
by: raylopez99 | last post by:
The headline says it all. Great minds think alike: read the blog below from three years ago, as endorsed by Ritchie, who coinvented C. BTW the below lambda expression code will not work (.Where...
8
by: Jesper Lund Stocholm | last post by:
I am currently working on converting an old .Net 1.1-application to .Net 3.5. Due to the lack of nullable datatypes in those days, a "decimal wrapper" was created that had various methods to parse...
4
by: Rene | last post by:
Hi, I was wondering if anyone could tell me why extension methods must be declared on static classes. I mean, why not allowing them to be declared as static methods in regular instance classes?...
1
by: Simon Woods | last post by:
Hi I have 2 classes which are both instantiated by shared factory methods and both implement a common interface. Public Class Factory Public Shared Function CreateMyClass1() As MyClass1...
3
by: johanatan | last post by:
When I first heard about these new features, I was very excited as it would have (if implemented as I had expected) rendered mimicking multiple inheritance almost painless in C#. Unfortunately,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.