TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Vishwakant Tripathi
1k
721
839.1k
Dynamic Type variable in c#
Oct 1 2013 2:24 AM
Hi,
var obj=new String();
here obj is an object of String Type. But In a case, if we need to create an object dynamically, and even sure about Type, so how we can make it.
For example :-
var obj=new DynamicType(); //it's an example only, there is no any Type available in .Net like DynamicType
Here DynamicType is a Type that can be of any .net Type, it may be Int, String, float or any one.
Actually why I need this:-
I am creating a dynamic sql Update query, in which, I need to pass parameter arguments, and number of parameters are not fixed, so I have to create it dynamically, so for String type variable (like varchar, text, char etc), it need Single Quote and for Numeric Type (like int, float, money), no need to single quote.
So all of you, please share your ideas regarding above scenario, if i need to choose any other way or how I can make it possible.
Thanks,
Vishwakant
Reply
Answers (
7
)
Getting value of href from anchor tag dynamically
how to declare a quote inside a string