2

Why doesn't the following compile in my VS2005?

List<DbParameter> params = new List<DbParameter>();

2 Answers 2

4

params in a reserved keyword in C#

Use a different variable name or prefix it with @

List<DbParameter> @params = new List<DbParameter>();
Sign up to request clarification or add additional context in comments.

2 Comments

If I use @params in the declaration, do I have to use it thereafter?
Yes, you always need to use @params afterwards where you use that variable.
1

Your variable name params is a reserved keyword, change it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.