Click here to Skip to main content
15,913,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i use combobox.selecteditem in query, it return TEXT in quote mean "TEXT" but i need it without Quote as TEXT.
Posted

1 solution

In C# double quotes are used to enclose string literals. So here "TEXT" is a string literal. The double quotes will not appear when this string is written to UI or printed to an out put medium say Report or a File. eg.
C#
Label1.Text = "TEXT";
System.IO.File.WriteAllText(fileName,"TEXT");

If the double quotes are removed then it will represent a variable which can hold the value of premitive data type or an object which may be an instance of struct or class etc.
C#
var TEXT = "This is text";
var TEXT = new MyClass();

If your requirement is to use the string value returned as a variable then the Reflection may be helpful and these articles
Reflection (C# Programming Guide)[^]
Reflection in .NET[^]
Reflection in C# Tutorial[^]
may be helpful.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900