Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8480585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:20:06+00:00 2026-06-10T19:20:06+00:00

I have a class implementing an interface as follows: public class Database : IStore

  • 0

I have a class implementing an interface as follows:

public class Database : IStore

In another class I have the following member variable; and an instance of Database is dynamically assigned to it at run-time:

private IStore store;

and a method that does a type check on store variable as follows:

if (store is Database)

ReSharper claims the condition will always be false. Also, it claims “store as Database” will always be null. Why is that? What is the best way to check the run-time object type held by this interface-type member? Is it possibly just saying this ‘may not be true’ always or really that it ‘never will be’?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:20:08+00:00Added an answer on June 10, 2026 at 7:20 pm

    It sounds like either R# is confused, or you’ve got two different IStore types, and you’re testing against one when actually the class implements a different one. (Or two different Database types, of course. The possibilities are equivalent.)

    Are you able to produce a short but complete example which demonstrates the problem? If you hover over IStore and Database in the code with the as / is operators, does it show the fully-qualified type names you’d expect? If you run the code, does it ever go into the if body?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an interface and a class implementing the interface like this: public interface
I have some interface and class implementing that interface: public interface IWhatever { bool
I have class T , implementing interface IBar . I have a variable list
I have an interface with several events I have base class implementing the interface
I have a class Image implementing ISerializable : [Serializable] [XmlRoot(ElementName = IMAGE)] [TypeConverter(typeof(ImageTypeConverter))] public
I have a third party assembly with a public abstract class implementing a certain
I have an interface as follows: public interface ISelectEntity { List<T> GetFromDB<T, O>(O data);
I have a class implementing an interface, and I need to return a Queryable<>
The issue appears is when I have a class implementing an interface, and extending
I have created class by implementing runnable interface and then created many threads(nearly 10)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.