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
Talaviya Bhavdip
494
2.8k
1.5m
I can't get value of base class field from child class object in c#
Dec 9 2020 6:43 AM
using
System;
public
class
Program
{
public
static
void
Main()
CloudCollectionHelper cloudHelper =
new
CloudCollectionHelper();
SlackHelper slackHelper =
new
SlackHelper();
cloudHelper.DatabaseID=12345;
Console.WriteLine(slackHelper.GetSlackPageTokens());
}
class
CloudCollectionHelper
{
public
long
DatabaseID { get; set; }
}
class
SlackHelper:CloudCollectionHelper
{
public
long
GetSlackPageTokens()
{
return
DatabaseID;
}
}
}
current output: 0 Expected Output: 12345
I need output 12345 because DatabaseID from the cloudhelper so i need that databaseID in the slackhelper.
this is my c# online compiler: https://dotnetfiddle.net/QNQeEX
I dont want to write something below because I have 1000+ field in the cloudhelper
SlackHelper slackHelper =
new
SlackHelper();
slackHelper.DatabaseID=12345;
Console.WriteLine(slackHelper.GetSlackPageTokens());
Thanks in advance.
Reply
Answers (
2
)
Advantage of Jquery over plain javascript?
Get Drop Down Value