What is the difference between <Literal> and <Object> in a Visual Studio snippet?
Asked Answered
C

1

10

I've read the documentation on <Literal> and <Object>, and I understand that Literal is for values defined by the snippet, and Object is for values defined outside the snippet.

I also see that Object has an additional element, Type, which contains the type of variable that the declaration expects. I don't know how this element affects the resulting code though.

What is the functional difference between Literal and Object declarations, from the perspective of the person using the snippet?

Cumbrous answered 3/12, 2014 at 17:3 Comment(0)
O
2

Functionally it's the same as the Literal type but it has an additional type constraint.

Oldie answered 31/1, 2015 at 19:19 Comment(5)
This means that if you write "3.4f"(float literal) in an "string" constrained field VisualStudio will warn you that you are doing something wrong.Oldie
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From ReviewArson
The user who asked the question is not inactive on SO but still didn't bother to respond. Maybe he stopped caring what this even meant? It brings up my question why are you here? If you have something else you want to know about this subject you can open another question. I'd love to provide an answer for you. Perhaps you could be more clear? ;)Oldie
It was an automatic comment inserted via "review" section (please, see he link). Your answer was labeld as "too short" and need a review from community.Arson
I'd go with. Nuke the question.Oldie

© 2022 - 2024 — McMap. All rights reserved.