I have a class like that:  public class A{  //some properties }  public class B : A{    //some more properties }  public class C : A{    //some more properties }   I would like to make a list of B, C and so on like that:  List&lt;A&gt; mylist = new List&lt;A&gt;() mylist.add((B)someobject); mylist.add((C)someobject);   If I add B, C etc. type of elements to mylist, It will cast them to type A. Therefore if I want to get properties of mylist[0] it gives me only class A properties.  How can I solve the problem and reach B or C type properties too?
In C#, what is the best way to access a property of the derived class when the generic list contains just the base class.  public class ClassA : BaseClass {    public object PropertyA { get; set; } }  public class ClassB: BaseClass {     public object PropertyB { get; set; } }  public class BaseClass { }  public void Main {     List&lt;BaseClass&gt; MyList = new List&lt;BaseClass&gt;();     ClassA a = new ClassA();     ClassB b = new ClassB();      MyList.Add(a);     MyList.Add(b);      for(int i = 0; i &lt; MyList.Count; i++)     {         //I would like to access PropertyA abd PropertyB from the derived classes             } }
It maby be weird, I want to make header and footer for every page including the first page of each chapter, how can I do this? If moderators can view , can we see comments we've deleted? We can see our deleted answers, but why not our deleted comments? As a native English speaker, which two further languages would give me the most travel utility worldwide? This follows on from a travel conversation a group of us had in a hostel in London.  Assuming I am travelling randomly between countries and continents, which two languages in addition to English would provide the most usefulness in any given country?  I suspect Spanish (North America, South America) and French (Europe, Africa) but with the base understanding between French and Spanish maybe the time would be best spent learning another language?  This question is a real puzzler since the following constraints apply   Length of time required to be "functional" in the language (cost-time trade off) Chance of reaching proficiency within any meaningful timeframe (Mandarin) Regional dialects destroying proficiency (Arabic) Easier Secondary languages underpinning the society (Arabic versus French argument) Similarity of Language families (Romance) leading to wasted effort (Italian v French) Utility of the Language (German versus English when English is understood) Enjoyment is a minor consideration   Happy to consider any other thoughts but it is a really interesting topic for consideration if you are linguistically minded. Importing an .obj file and nothing is showing Can a textbox be enabled after a certain value from a picklist is selected How can I mirror weight painting? How can I mirror my weight painting to the opposed side of my character? I know that there is Mirror function, but it doesn't assign the weight to bones on the opposed side. Can I do it manually? My ubuntu partition was deleted and I can't boot from either a DVD or USB Renting a car in Ireland & Great Britain: 1 rental or 2? My wife, two kids and I will be traveling in Ireland and the UK Nov. 1st through 21st. We're flying into and out of Dublin. Our plan is to do a clockwise tour: Fly into Dublin -> Belfast -> Scotland -> England/London -> Back to Dublin to fly home.  We've been planning to rent a car when we land in Dublin (doing just things outside Dublin at the start of the trip) and have a car all the way until London, then turn in the car and take a train/ferry to get back to Dublin before flying home.  However, reading through the car rental section of Rick Steve's 2012 Ireland book is causing us to question if this is the right plan.  He says (p. 480):     If your trip covers both Ireland and Great Britain, you're better off   with two separate car rentals, rather than paying for your car to ride   the ferry between the two islands. On an all-Ireland trip, you can   drive your rental car from the Republic of Ireland into Northern   Ireland, but be aware of drop-off charges ($75-150) if you return it   in the North.   So it seems like he recommends against doing one car rental for both islands, but he also recommends against renting in the Republic of Ireland and returning it in Northern Ireland (our other option for our current itinerary).  So we're not sure which is best here.  A few questions about this:   If we do one car rental all the way from Dublin to London, will there be a similar $75-$150 fee? Is there an easy place to return a car on the Northern Ireland side of one of the Northern Ireland -> Scotland ferries, and an easy place on the Scotland side to rent a car?  We'd like to minimize the number of buses/whatever we need to take between car rentals since we'll be lugging around car seats for both of our children (on top of carrying them and our luggage). Will one way be significantly cheaper than the other?  Besides the basic cost of taking the car on the ferry and the drop-off charges, our credit card will cover insurance in Scotland/England but not in Ireland, so we could potentially get a better rental rate by renting a second vehicle once we're on Great Britain. Although, I know you often get a better rate when keeping a car rental for longer, so that may negate any benefit from the credit card covering the insurance. Crontab entry executing every hour Assume the continuum hypothesis is false, and add that as an axiom to ZF set theory. How many cardinalities are between the rationals and the reals in this case? Only one? Infinitely many? Countably many? Uncountably many? What are the possibilities to the quantity of counterexamples? I recently tried to change a bulb using an adaptor (converting from a E27 to B22 fitting). After switching on the light fitting the fuse had blown. After inspection it turns out the adapter is faulty and must have caused a short-circuit.  After removing the bulb and resetting the switch in the main fuse box, I am now unable to operate the switch on the wall to turn the fitting off (the switch physically won't click).   Is there something I can do to fix the problem?  Thanks, What is the difference between \em and \emph? What is the difference between \emph{...} and {\em ...}?  When to use each of them? Make an object invisible to a specific camera? (Cycles) I'm trying to set up multiple cameras for a scene set in a room. Is there a way to link object visibility to a specific camera? Ideally, a wall or ceiling would not render if it were in the way of the specified camera.  I've tried to get around this by keyframing Restrict Rendering, but that gets difficult to keep track of. I've also tried adjusting the clipping plane, but that clips too much and would also need to be keyframed if the camera moves.   Thanks! Replace unknown reference (?) with the tag from \ref or \cite While working on a document, it would be helpful if instead of a ? for unresolved references or citations the tag used in the \ref{thisthings} or \cite{Bloke1978} could appear instead.  Is there a package that turns on this behaviour? Any questions relating to status updates, or asking if anything is going to be patched for these vulnerabilities should be closed as duplicates of this question.    are in the news right now and sound pretty severe. I don't see any security updates from Ubuntu that cover these vulnerabilities.  What is Ubuntu doing about these vulnerabilities, and what should Ubuntu users be doing?  These are CVE-2017-5753, CVE-2017-5715 and CVE-2017-5754. At the start of the movie it says:      "A long time ago in a galaxy far, far away...."   Does this mean that the entire Star Wars saga takes place in a single galaxy? To my understanding a galaxy isn't very big compared to the universe itself. Star Wars has many different sentient races, and the way they are presented suggests that most planets are host to only one of them (some exceptions like naboo). This strongly leads me to believe there should actually be more galaxies in the Star Wars universe (hehe).   Another thing, I think it's safe to assume that even if the entire saga takes place in one single galaxy, their researchers can observe other galaxies (I think we started doing that in the 1600s, and they are a lot more technologically advanced than we were back then). When Obi-wan is looking for Kamino (the rain planet with the cloners) the librarian says something like "If it's not in our records, it doesn't exist", so she must be convinced that the entire universe has been explored.    If the entire universe has been documented, why wouldn't they go to those other galaxies? The technology seems to be advanced enough to hop to another galaxy. Is there any canon material that suggest that traveling between galaxies is done? If not, is there a canon explanation why they don't? Let $G$ be a group and $H$ a subgroup with $[G:H]=n$. Is it true that $x^n\in H$ for all $x\in G$?   Remarks. The answer is positive whenever $H$ is normal, e.g., for $n=2$. In general, by using the normal core of $H$, one can find an $m\ge 1$ such that $x^m\in H$ for all $x\in G$. How do I write a cpp macro which expands to include newlines? Suppose that $f:M \to N$ is a smooth map of two manifolds and $E$ is a vector bundle over $N$. Given a connecton $\nabla$ on $E$ one can pull it back to $f^*N$ (which is a bundle over $M$) and obtain a connection $f^* \nabla$.   If $E=TN$ is a tangent bundle one can consider the Levi-Civita connection $\nabla$, with respect to the chosen metric $g$ on $N$. It is characterised uniquely as torsion free metric connection. Given a map $f:M \to N$ one can pullback the metric $g$ to $f^*g$. If it happens that $f^*g$ is again a metric (which is the case for example for immersions) one can consider the Levi Civita connection on $M$ with respect to $f^*g$. I wonder how these two constructions are related, in particular      Is there a way to pullback affine connections to get again affine connection (i.e. connections on tangent bundle)?     Additionally I would like to know:     What is the relation between Christoffels symbols for the connection and for its pullback? Theorem 13.9 in these  is the polynomial spectral mapping theorem:     Theorem 13.9 For a polynomial $p$ we have $\sigma(p(T)) = p(\sigma(T))$.     My questions:   First direction: Why would $q(T) (p(T) - p(\lambda) I)$ be an inverse for $T - \lambda I$? Update: @RobertIsrael said that instead $(p(T) - p(\lambda) I)^{-1} q(T)$ should be $(p(T) - p(\lambda) I)^{-1}$ be? According to the lines in the proof above, we have $$ (p(T) - p(\lambda) I)^{-1} = ((T - \lambda I) q(T))^{-1} \overset{?!}{=} q(T)^{-1} (T - \lambda I)^{-1}, $$ but as $\lambda \in \sigma(T)$ by assumption, $(T - \lambda I)^{-1}$ doesn't exist, right? For the second direction: Why does $x_i \in \sigma(T)$ imply that $p(x_i) - \mu = 0$? I thought that $x_i \in \sigma(T)$ only implies that $T - x_i I$ is not boundedly invertible. Since $\mu \in \sigma(p(T))$ we have that $p(T) - \mu I = c \prod_{k = 1}^{n} (T - x_i I)$ is not boundedly invertible but how does that help?   In both statements there seem to be a notion of "a product of operators is not invertible iff all factors aren't invertible", but how can that be true? Consider i.e. shift operators on a sequence spaces such that $ST = I$, i.e. the left and right shift operators, then the above mentioned notion doesn't hold, right?