I'm accessing Masterpage properties from a regular ASP.NET C# page by doing the following:
((SecondMasterPage)(Page.Master)).speciallink = true;
((SecondMasterPage)(Page.Master)).specialspan = false;
That works fine in a page's code-behind, but when I try to move it to a function in my base class file like this:
public class MyBase...
I may of worded the title completely wrong, but basically, I have the following base class:
public class ScheduleableService<T> : ServiceBase
where T : IJob
{
var x = typeof(T);
}
The implementation of this is something like:
public class MyScheduledService: ScheduleableService<MyScheduledJob>
{
//MyScheduledJob i...
Please forgive the psuedo-code, but it's a simple question:
I create a user control (myControlBase : UserControl) with a textbox (id = "txtbox") in it's markup. In it's codebehind I write a method SayHello(string s){ txtbox.Text = s; }.
I create another user control that extends myControlBase (myControl : myControlBase). In page_lo...
When creating a C++ inheritance structure, you have to define member functions exactly the same in multiple places:
If B is an abstract base class, and D, E, and F all inherit from B, you might have this:
class B
{
virtual func A( ... params ) = 0;
};
class D : public B
{
func A( ... params );
};
/* ... etc... similar implement...
Hello, I've some classes like this
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
A a = new C();
a.method();
Console.ReadLine();
}
}
public class A
{
public virtual void method()
{
Console.Writ...
Do we have to do something special to have ASP.NET partial classes aware of controls that are declared in our user control's base classes? The partial classes keep generating declarations for controls in the base class which mean the controls in the base class get hidden and are null.
...
I want to specifically invoke the base class method; what's the most concise way to do this? For example:
class Base
{
public:
bool operator != (Base&);
};
class Child : public Base
{
public:
bool operator != (Child& child_)
{
if(Base::operator!=(child_)) // Is there a more concise syntax than this?
return true;
/...
I have a base class, and I would like to catch all exceptions of the derived class within the base class, is this possible?
You won't know what the methods are from the derived class.
...
I've got a BaseDataClass with shared fields and functions
Protected Shared dbase as SqlDatabase
Protected Shared dbCommand as DBCommand
...
//also have a sync object used by the derived classes for Synclock'ing
Protected Shared ReadOnly syncObj As Object = New Object()
Protected Shared Sub Init() //initializes...
I'm developing a reusable library and have been creating abstract classes, so the client can then extend from these.
QUESTION: Is there any reason in fact I should use an abstract class here as opposed to just a normal class?
Note - Have already decided I do not want to use interfaces as I want to include actual default methods in ...
Hi,
Is there away to not have a "cast" the top.First().Value() return to "Node", but rather have it automatically assume this (as opposed to NodeBase), so I then see extended attributes for the class I define in Node?
That is is there a way to say:
top.Nodes.First().Value.Path;
as opposed to now having to go:
((Node)top.Nodes.Fir...
Hi,
Any see why I'm getting a "Argument 1: cannot convert from 'ToplogyLibrary.RelationshipBase' to 'TRelationship'" in the code below, in CreateRelationship() ?
public class TopologyBase<TKey, TNode, TRelationship>
where TNode : NodeBase<TKey>, new()
where TRelationship : RelationshipBase<TKey>, new()
{
// Properties
p...
This code doesn't work, but hopefully you'll get what I'm trying to achieve here. I've got a Money class, which I've taken from http://www.noticeablydifferent.com/CodeSamples/Money.aspx, and extended it a little to include currency conversion.
The implementation for the actual conversion rate could be different in each project, so I d...
I wrote a base class to help build my controllers more quickly and to remove duplication. It provides some helper methods, default actions and some meta programming to make these things easier to build.
One of those methods in the base class is like this:
def dynamicList(Class clazz) {
def model = new LinkedHashMap()
model[getM...
I've stumbled upon this "feature" of C# - the base class that implements interface methods does not have to derive from it.
Example:
public interface IContract
{
void Func();
}
// Note that Base does **not** derive from IContract
public abstract class Base
{
public void Func()
{
Console.WriteLine("Base.Func");
...
I have some user controls which I want to specify properties and methods for.
They inherit from a base class, because they all have properties such as "Foo" and "Bar", and the reason I used a base class is so that I dont have to manually implement all of these properties in each derived class.
However, I want to have a method that is o...
I get a compiler warning, that I don't understand in that context, when I compile the "Child.cpp" from the following code. (Don't wonder: I stripped off my class declarations to the bare minuum, so the content will not make much sense, but you will see the problem quicker). I get the warning with VS2003 and VS2008 on the highest warning ...
Hi all.
One day I decided to build this nice multi-tier application using L2S and WCF.
The simplified model is : DataBase->L2S->Wrapper(DTO)->Client Application.
The communication between Client and Database is achieved by using Data Transfer Objects which contain entity objects as their properties.
abstract public class BaseObject
...
Here we go,
I'm trying to implement the command design pattern, but I'm stumbling accross a conceptual problem.
Let's say you have a base class and a few subclasses like in the example bellow :
class Command : public boost::noncopyable {
virtual ResultType operator()()=0;
//restores the model state as it was before command'...
Compiling this code using g++ 4.2.1:
struct S { };
template<typename T> struct ST { };
template<typename BaseType>
class ref_count : private BaseType { };
template<typename RefCountType>
class rep_base : public RefCountType { };
class wrap_rep : public rep_base<ref_count<S> > {
typedef rep_base<ref_count<S> > base_type; // lin...