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
hisanth nithi
NA
30
9.2k
Dynamically Create instance for class
Jul 6 2019 7:13 AM
Hi i have 2 class (YarnBLL, DyingBLL) with same property.
i need to create a instace based on switch case
public
String insave(String name)
{
var obj;
switch
(name)
{
case
"YARN"
:
obj =
new
YarnBLL();
break
;
case
"WEAVING"
:
obj =
new
DyingBLL();
break
;
default
:
break
;
}
obj.InDate = Utils.ConvertStringToDate(txtDate.Text);
obj.CategoryName = ddlCategory.SelectedItem.ToString();
obj.Save();
}
Here i have an error in
var obj;
it shows
Error 1 Implicitly-typed local variables must be initialized
Reply
Answers (
3
)
how to fill datagridview with thousand of records quickly ?
make an class “employee” with the atributes “name” and “sala