Extension Methods questions

  • Thread starter Thread starter Steven Nagy
  • Start date Start date
S

Steven Nagy

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
 
Steven Nagy said:
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.
 
Hi,

Steven Nagy said:
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.
 
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)
 
Hi,

Steven Nagy said:
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.
 
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
 
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.
 
Back
Top