Skale
asked on
Using 'this' statement in static method pros/cons in C#
Hello,
I'm using a static method to get information from COM object like;
public static string GetBodyName(this IScrBody obj) { //some code}
With that i'm able use it like;
var myBodyName = Body.GetBodyName()
in before i'm using like that;
public static string GetBodyName(IScrBody obj) { //some code}
and i'm trying to return a value
var myBodyName = GetBodyName(obj)
Now i've search on net but didn't find like i expected.
Now i'd like to know are there any pros/cons of using this statement.
I really need expert's advice.
Any help would be great!
Thank you.
I'm using a static method to get information from COM object like;
public static string GetBodyName(this IScrBody obj) { //some code}
With that i'm able use it like;
var myBodyName = Body.GetBodyName()
in before i'm using like that;
public static string GetBodyName(IScrBody obj) { //some code}
and i'm trying to return a value
var myBodyName = GetBodyName(obj)
Now i've search on net but didn't find like i expected.
Now i'd like to know are there any pros/cons of using this statement.
I really need expert's advice.
Any help would be great!
Thank you.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
My question is about difference between them where to use, where to don't use pros/cons
Open in new window
this IScrBody obj