Jump to content
  • Advertisement
Sign in to follow this  
KorangarDev

C# Syntax - Can anyone explain what [public static A B.C(D) {...}] would mean?

This topic is 2306 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Right so I found this weird format for a method declaration and I can't wrap my head around it.

public static A B.C(D)
{...}

it's a public static method,
that returns type A?
Named "B"?
or "B.C"?
and of course D is the parameter.

Thoughts?

Share this post


Link to post
Share on other sites
Advertisement
Are you sure this is in C# code? Is it a fragment from some code? Can you show us how it is written fully?

Share this post


Link to post
Share on other sites
Yeah I figured you guys can't be much help until I find the original. I've misplaced it lol.
Thank you so much for your time dude. I really appreciate it. It gets hard to figure out what's going on for us newbies, and we do so want to join your ranks lol. biggrin.png

I think it has something to do with "using alias directive"? But I'm no C# expert.

using B = E.F.G;
public static A B.C(D)
{...}

I think it might be a typo. Would
A B.C(D);
make more sense?

I'll get you that original if I can. I'm just trying to wrap my head around all this craziness. Not enough time to practice and get good! wink.png

Share this post


Link to post
Share on other sites
It still doesn't make sense.

Maybe this will help:
public static A B(C D) - that makes sense. A is return type, B is method name, C is argument type, D is argument name.
new B.C(D) - also makes sense. Here B is namespace (or class, or struct). C is class name. D is variable or value.
B.C(D) - this also makes sense. Here B is class (or struct). C is method name.

Share this post


Link to post
Share on other sites
It is for explicit interfaces. It is if you have two or more interfaces in the same class with the same name, then you use that notation to specify which one you are using for a method.

So A is the return value
B is the Interface
C is the interface member
D is the parameter.

Share this post


Link to post
Share on other sites
That must be it! Makes much more sense now I a I-have-no-idea-how-to-work-with-interfaces-but-I-will-learn-soon kind of way.

/Thank you/. You guys are awesome.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!