Click here to Skip to main content
15,902,939 members
Home / Discussions / C#
   

C#

 
AnswerRe: noob need some help Pin
OriginalGriff7-Sep-16 8:06
mveOriginalGriff7-Sep-16 8:06 
QuestionEntity Framework: How to migrate a change for specific table Pin
Tridip Bhattacharjee7-Sep-16 2:51
professionalTridip Bhattacharjee7-Sep-16 2:51 
AnswerRe: Entity Framework: How to migrate a change for specific table Pin
Dave Kreskowiak7-Sep-16 3:49
mveDave Kreskowiak7-Sep-16 3:49 
GeneralRe: Entity Framework: How to migrate a change for specific table Pin
Tridip Bhattacharjee12-Sep-16 21:39
professionalTridip Bhattacharjee12-Sep-16 21:39 
GeneralRe: Entity Framework: How to migrate a change for specific table Pin
Dave Kreskowiak13-Sep-16 2:34
mveDave Kreskowiak13-Sep-16 2:34 
QuestionC# windows forms With MS SQL DataBase Pin
Zeyad Jalil6-Sep-16 23:56
professionalZeyad Jalil6-Sep-16 23:56 
AnswerRe: C# windows forms With MS SQL DataBase Pin
Garth J Lancaster7-Sep-16 0:14
professionalGarth J Lancaster7-Sep-16 0:14 
GeneralRe: C# windows forms With MS SQL DataBase Pin
Zeyad Jalil7-Sep-16 0:17
professionalZeyad Jalil7-Sep-16 0:17 
AnswerRe: C# windows forms With MS SQL DataBase Pin
OriginalGriff7-Sep-16 0:46
mveOriginalGriff7-Sep-16 0:46 
AnswerRe: C# windows forms With MS SQL DataBase Pin
Pete O'Hanlon7-Sep-16 1:16
mvePete O'Hanlon7-Sep-16 1:16 
QuestionCreate a static class to return properties Pin
Mycroft Holmes6-Sep-16 22:02
professionalMycroft Holmes6-Sep-16 22:02 
AnswerRe: Create a static class to return properties Pin
#realJSOP7-Sep-16 1:19
professional#realJSOP7-Sep-16 1:19 
AnswerRe: Create a static class to return properties Pin
Pete O'Hanlon7-Sep-16 2:10
mvePete O'Hanlon7-Sep-16 2:10 
GeneralRe: Create a static class to return properties Pin
Mycroft Holmes7-Sep-16 2:48
professionalMycroft Holmes7-Sep-16 2:48 
AnswerRe: Create a static class to return properties Pin
Richard Deeming7-Sep-16 2:17
mveRichard Deeming7-Sep-16 2:17 
So you want to call a method from outside of its containing class, without specifying the class name?

Prior to C# 6, you can't. The closest you could get would be to use an extension method:
C#
using YourNamespace;
...
string sGroup = sGroupCodeVariable.SomeExtensionMethod().RoleName;


With C# 6, you could use the using static syntax[^] to make all of the methods of your static class available without qualification:
C#
using static YourNamespace.YourStaticClass;
...
string sGroup = YourStaticMethod(sGroupCode).RoleName;

However, I think this is generally a bad idea. It tends to make your code less readable. Plus, it's too close to VB's "Module" behaviour for comfort. Big Grin | :-D



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer



modified 7-Sep-16 12:58pm.

GeneralRe: Create a static class to return properties Pin
BillWoodruff7-Sep-16 5:08
professionalBillWoodruff7-Sep-16 5:08 
GeneralRe: Create a static class to return properties Pin
Richard Deeming7-Sep-16 6:59
mveRichard Deeming7-Sep-16 6:59 
Questionhow to add localdb in console apps using vs2013 Pin
Tridip Bhattacharjee5-Sep-16 23:18
professionalTridip Bhattacharjee5-Sep-16 23:18 
AnswerRe: how to add localdb in console apps using vs2013 Pin
OriginalGriff5-Sep-16 23:31
mveOriginalGriff5-Sep-16 23:31 
AnswerRe: how to add localdb in console apps using vs2013 Pin
ZurdoDev6-Sep-16 4:12
professionalZurdoDev6-Sep-16 4:12 
GeneralRe: how to add localdb in console apps using vs2013 Pin
Eddy Vluggen6-Sep-16 5:20
professionalEddy Vluggen6-Sep-16 5:20 
GeneralRe: how to add localdb in console apps using vs2013 Pin
ZurdoDev6-Sep-16 5:53
professionalZurdoDev6-Sep-16 5:53 
Questionreceive values from a listbox Pin
eli stein2005-Sep-16 6:05
eli stein2005-Sep-16 6:05 
AnswerRe: receive values from a listbox Pin
Dave Kreskowiak5-Sep-16 6:50
mveDave Kreskowiak5-Sep-16 6:50 
GeneralRe: receive values from a listbox Pin
eli stein2005-Sep-16 7:25
eli stein2005-Sep-16 7:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.