Click here to Skip to main content
15,437,758 members
Home / Discussions / C#
   

C#

 
AnswerRe: time task scheduler class Pin
#realJSOP2-Feb-18 0:54
mva#realJSOP2-Feb-18 0:54 
AnswerRe: time task scheduler class Pin
Pete O'Hanlon31-Jan-18 2:54
mvaPete O'Hanlon31-Jan-18 2:54 
GeneralRe: time task scheduler class Pin
Member 1363217131-Jan-18 2:58
MemberMember 1363217131-Jan-18 2:58 
Questionusing image button Pin
Member 1365319330-Jan-18 20:22
MemberMember 1365319330-Jan-18 20:22 
AnswerRe: using image button Pin
OriginalGriff30-Jan-18 21:04
mveOriginalGriff30-Jan-18 21:04 
QuestionC# read the footer in a Microsoft Word document Pin
Member 1101829930-Jan-18 15:00
MemberMember 1101829930-Jan-18 15:00 
AnswerRe: C# read the footer in a Microsoft Word document Pin
Richard MacCutchan30-Jan-18 21:39
mveRichard MacCutchan30-Jan-18 21:39 
QuestionPartial static class Pin
#realJSOP30-Jan-18 3:26
mva#realJSOP30-Jan-18 3:26 
Here's a weird one.

I have a class library assembly with the following (pseudo)code:

C#
namespace MyStaticNameSpace
{
    public static partial class MyStaticClass
    {
        public static void MyMethod1()
        {
            // do something
        }
    }
}


In my (MVC web) application (that references the assembly described above), I have this:

C#
namespace MyStaticNameSpace
{
    public static partial class MyStaticClass
    {
        public static void MyOtherMethod()
        {
            MyMethod1();
        }
    }
}


My problem is that the code in the app can't see MyMethod1 in the library assembly. What am I missing?

I event tried using "MyStaticClass.MyMethod1();"...

When I try to reference methods in MyStaticNameSpace.MyStaticClass from anywhere else in the app, it sees all methods in both the assembly and the local namespace extension.

If I rename the app's class to something other than MyStaticClass, I can then do this - MyStaticClass.MyMethod1(), but that defeats the purpose of making the class partial.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013


modified 30-Jan-18 9:43am.

AnswerRe: Partial static class Pin
Richard Deeming30-Jan-18 3:44
mveRichard Deeming30-Jan-18 3:44 
GeneralRe: Partial static class Pin
#realJSOP30-Jan-18 3:49
mva#realJSOP30-Jan-18 3:49 
QuestionWhat is the best way to practice unit testing in C#? Pin
Hila Berger30-Jan-18 0:33
MemberHila Berger30-Jan-18 0:33 
AnswerRe: What is the best way to practice unit testing in C#? Pin
Eddy Vluggen30-Jan-18 0:48
professionalEddy Vluggen30-Jan-18 0:48 
GeneralRe: What is the best way to practice unit testing in C#? Pin
Hila Berger31-Jan-18 23:14
MemberHila Berger31-Jan-18 23:14 
GeneralRe: What is the best way to practice unit testing in C#? Pin
Eddy Vluggen31-Jan-18 23:23
professionalEddy Vluggen31-Jan-18 23:23 
GeneralRe: What is the best way to practice unit testing in C#? Pin
Hila Berger31-Jan-18 23:48
MemberHila Berger31-Jan-18 23:48 
GeneralRe: What is the best way to practice unit testing in C#? Pin
Eddy Vluggen31-Jan-18 23:54
professionalEddy Vluggen31-Jan-18 23:54 
SuggestionRe: What is the best way to practice unit testing in C#? Pin
GregoryPres5-Feb-18 2:16
MemberGregoryPres5-Feb-18 2:16 
QuestionPrevent adding of nodes to a TreeNode? Pin
primem0ver29-Jan-18 23:46
Memberprimem0ver29-Jan-18 23:46 
AnswerRe: Prevent adding of nodes to a TreeNode? Pin
Eddy Vluggen30-Jan-18 0:15
professionalEddy Vluggen30-Jan-18 0:15 
AnswerRe: Prevent adding of nodes to a TreeNode? Pin
BillWoodruff3-Feb-18 7:03
mveBillWoodruff3-Feb-18 7:03 
GeneralRe: Prevent adding of nodes to a TreeNode? Pin
primem0ver3-Feb-18 22:52
Memberprimem0ver3-Feb-18 22:52 
GeneralRe: Prevent adding of nodes to a TreeNode? Pin
BillWoodruff5-Feb-18 18:34
mveBillWoodruff5-Feb-18 18:34 
GeneralRe: Prevent adding of nodes to a TreeNode? Pin
primem0ver9-Feb-18 1:21
Memberprimem0ver9-Feb-18 1:21 
GeneralRe: Prevent adding of nodes to a TreeNode? Pin
BillWoodruff10-Feb-18 19:48
mveBillWoodruff10-Feb-18 19:48 
QuestionHow to debug a WndProc function with multiple listviews ? Pin
Member 245846727-Jan-18 22:48
MemberMember 245846727-Jan-18 22:48 

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.