4

I'm coming from Python and don't understand the following syntax in C#:

Sprite[] sprites = Resources.LoadAll<Sprite>("Textures");

I'm instantiating a list of sprite objects and setting it to the output of Resources.LoadAll().

What is the < > operator?

I'm trying to look it up, the proper name would help.

Serlite
  • 12,130
  • 5
  • 38
  • 49
lawrencehagman
  • 471
  • 1
  • 3
  • 16
  • 16
    It's generics - https://msdn.microsoft.com/en-us/library/512aeb7t.aspx – Valentin May 05 '16 at 20:52
  • @Valentin: "Use comments to ask for more information or suggest improvements. Avoid answering questions in comments." – Gabor May 05 '16 at 21:10
  • @Serlite it is actually already being used as a dupe target: http://stackoverflow.com/questions/5115434/what-is-generics-its-uses-and-application –  May 05 '16 at 21:23

1 Answers1

1

It's how you specify the type for that method. LoadAll has a generic return type and it needs to know the type that it is going to return. You do this with < >. I hope that helps.

TomAwesome
  • 36
  • 3