473,386 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Inheritance - Continued

Hi all,

Thanks to DeveloperX in my previous thread, I have made a little more
progress in my quest to get what I want...

Here is what I want to achieve...

InheritContext myContext = InheritContext.Current;
string path = myContext.Folder.Parent.Parent.Parent.Parent.Path; // Ignore
the "Path" part for the time being, it is the recursive parent that I am
interested in...

I have the myContext declaration set up, running and working. I can get
string path = myContext.Folder; but cannot get the .Parent.Parent..... etc.
running. Any help will be appreciated. I am sure it would be very simple but
I cannot work out how to make it work.

Here is my code... I have used a lot of "return null" as this is just a test
of the theory side. When I have it working initially, I will then fill the
returns to get proper values out.

namespace InheritTest
{

public class InheritContext : IDisposable
{
public InheritContext()
{
// Constructor
}

public void Dispose()
{
}
public Folders Folder()
{
return null;
}

}
public class Folders
{
public Folders Parent
{
get { return null; }
}
}
public class InheritHttpContext : InheritContext
{
public static InheritHttpContext Current
{
get
{
HttpContext cntx = HttpContext.Current;

return (InheritHttpContext)cntx.Items["InheritContext"];
// Can someone explain to me what the cntx.Items does and
where I should use it?
// I couldn't get this part to work without it, but now I
have it, what do I do with it?
}
}

}
}
If I have written the code above incorrectly (against best practice, that
sort of thing), I would appreciate any advice.

Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
Dec 18 '06 #1
0 963

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
2
by: Graham Banks | last post by:
Does using multiple inheritance introduce any more performance overhead than single inheritance?
9
by: Axel Dahmen | last post by:
Hi, when I'm programming style sheets for a whole web application I'm missing a CSS feature to be able to reference CSS properties of other elements. Let's say there is a...
4
by: JKop | last post by:
I'm starting to think that whenever you derive one class from another, that you should use virtual inheritance *all* the time, unless you have an explicit reason not to. I'm even thinking that...
6
by: Talin | last post by:
I want to make a dictionary that acts like a class, in other words, supports inheritance: If you attempt to find a key that isn't present, it searches a "base" dictionary, which in turn searches...
0
by: Nunya Biznas | last post by:
I have a two column report that needs to have the word "continued" appear at the top of the 2nd column if the detail records are part of the group from the previous column. I have tried using a...
22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
4
by: andreas.w.h.k. :-\) | last post by:
How do I change the address location in the wsdl <wsdl:port name="SearchSoap12" binding="tns:SearchSoap12"> <soap12:address location="http://searchservices/engine/search.asmx" /> </wsdl:port> ...
60
by: Shawnk | last post by:
Some Sr. colleges and I have had an on going discussion relative to when and if C# will ever support 'true' multiple inheritance. Relevant to this, I wanted to query the C# community (the...
6
by: Bart Simpson | last post by:
I remember reading on parashift recently, that "Composition is for code reuse, inheritance is for flexibility" see (http://www.parashift.com/c++-faq-lite/smalltalk.html#faq-30.4) This confused...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.