Is a wekly typed List possible?

For example I want to use a List of interface object.  But I want to insert into the list concrete objects that implement that interface.  But when I'm using the List I want to work with the interface types not the concrete types.  Is this
possible?
Example
interface ISettings{
List<ILocation> Locations {get; set;}
class ConcreteSetting1 : ISettings{
List<ILocation> Locations {get; set;}  <---- I want this to restrict this to accept only one particular concrete ILocation type
But in my usage I still want to work only with Interfaces.
ISettings mainSetting = ....
foreach(ILocation loc in mainSetting){
   loc.Process();
I already tried using generics like this
interface ISettings<T> where T : ILocation
and then the concrete class would be
class
ConcreteSetting1<T> : ISettings<T> where T : ConcreteLocation1
But I just found i had to specify the concrete type in the end which I don't want to do.  Just want to work with the interface types.
My Main problem and it could be a design flaw, is that all my ILocation objects share only one method, but the rest is unique to each.  So an object that using an ILocation can only use a particular one, not just any ILocation. 

I think you probably already realise you have a fundamental design flaw here.
If you need to limit these things to one specific type then that is mutually exclusive to only dealing with them by interface.
That's a problem.
You can do something like:
interface ISettings
List<MyLocation> Locations { get; set; }
interface ILocation
public class MyLocation : ILocation
public class MainSettings: ISettings
public List<MyLocation> Locations { get; set; }
and
MainSettings ms = new MainSettings();
ms.Locations = new List<MyLocation> { };
foreach(ILocation il in ms.Locations)
I'm just not so sure that gets you anywhere useful.
Please don't forget to upvote posts which you like and mark those which answer your question.
My latest Technet article - Dynamic XAML

Similar Messages

  • What is Best Practice: Array or typed List?

    Hello,<br /><br />I am just starting with BlazeDS and Flex.  I want to exchange a strongly typed collection between client and server.  I was wondering if it is better to use Java Arrays (MyClass[]) or typed lists List<MyClass><br /><br />What is the best approach?  Are there differences?<br /><br />Thanks,<br /><br />Tobias

    > What is the best approach? Are there differences?
    Hi Tobias,
    This probably falls under personal preference, but the List class is more
    flexible (sizing, inserting in to the middle, etc) so I would prefer to use
    it in Java. Actually, I might even go with ArrayList, that would split the
    difference.
    In any case, they would all translate to an ArrayCollection of types objects
    on the Actionscript side, when your Actionscript classes have the right
    'alias=' property set.
    Tom Jordahl

  • Add a list possible in a Accordion?

    Hello
    can i add a list possible in a Accordion?
    ty

    The list I am asking about is not a simple html list. Wath I
    am trying to find out is it possible to add a menyobject
    that make me to have I more step. Exampel if you make a spry
    menybar you can make
    Productions>Gold>whatever and with the accordion
    Production>gold
    I like the idea of the accordion and would like to build the
    menysystem in also?
    Anyone understand what I mean?

  • Reordering within a list - possible?

    Hi, I'm trying to reorder items in a list via drag and drop.
    I can do this with two separate list components but not
    within the same one.
    Am I missing something? Should this be possible?
    Most of the information I can find is regarding drag and drop
    operations between components and not within the same component.
    Any hints much appreciated.
    Thanks
    Barry

    Thanks for the reply. Yes I have all those set to true.
    This is the code I have.
    At this stage the cursor is giving no feedback except a black
    line between items in the list.
    Also "dragEvent's - dataForFormat array has no objects in it.
    Hmmm.. I'm clueless. I'm wondering whether the problem is
    because I'm using a custom (MXML) renderer in the list.
    Anyway, once again thanks.

  • Listing possible events from event source (or DLL)

    Does anyone know of a replacement for MOM 2005 resource kit tool mpwizard, which could dig out what sort of events COULD be written to event viewer logs. Not interested about a tool that could parse the existing event logs, but specifically one that is capable
    of listing what could be created by DLL's that write into event viewer.
    http://technet.microsoft.com/en-us/library/cc180050.aspx
    http://blogs.technet.com/b/kevinholman/archive/2009/02/16/how-to-find-all-possible-event-id-s-for-a-given-event-source.aspx
    If there's no replacement, how about someone digging it from their secret stash of nice tools, I didn't find it anymore
    from my stash.
    Thanks for thoughts and ideas!
    MCT | MCSE | MCITP | MCTS SCOM, SCCM, SCVMM, SCDPM | Open CITS

    Hi,
    Based on my research, MP Event Analyzer tool is designed to help a user with functional and exploratory testing and debugging of event based management pack workflows like rules and monitors.
    The tool is in System Center Operation Manager 2007 Administration Resource Kit.
    Please go through the below link for more details:
    http://blogs.technet.com/b/momteam/archive/2011/06/03/system-center-operations-manager-2007-r2-admin-reskit-released.aspx
    Management Pack Wizard is used to create a custom Management Pack for your MOM environment. If we have SCOM 2007 R2 installed then with the operational manager console, we can use Authoring workspace to custom managed packs, and we can also export MP to
    xml and then modify it by editing the xml file.
    Regards,
    Yan Li
    Regards, Yan Li

  • Partial Contact list Possible?

    I have put my entire contacts directory on my laptop. This is friends, work, family. I am thinking that I only want to sync the more important personal contacts over to my iphone not the entire work related list which is so long.
    is this possible through using groups and mobile me?

    Hello caprocter,
    Mobile Me will sync all contacts over the air, so it is not possible to limit the groups that will sync using Mobile Me at this time.
    It is possible to sync select groups to your iPhone when doing a sync via USB with the MacBook. You only need to create the group(s) in Address Book and then select
    "selected groups" in the Contacts section of the Info tab for your iPhone.
    You can submit a feature request directly to Apple regarding being able to sync groups with Mobile Me here:
    http://www.apple.com/feedback/mobileme.html
    Take care,
    Charles H.

  • Is ALV List Possible in Web Dynpro for JAVA ? Please Advice.

    Hello,
    I would like to know if we can simulate the ALV List which we have in ABAP using Web Dynpro for JAVA. I would really appreciate if someone could suggest how it could be done.
    Best Wishes,
    John.

    Hallo John,
    The Abstract List Viewer (ALV) is not available in Web Dynpro for Java within SAP NetWeaver 04s.
    Regards, Bertram

  • Iphone 3GS stalls while typing. Possible virus?

    Greetings
    For the past 6 months or so my Iphone 3gs seems to get stuck while typing on any application. For example, the last letter typed will stay high lighted for 2 seconds or so then drop into place. Also delays while trying to access internet while on wifi network. It takes much longer to do anything.
    I believe it all began once I clicked a link from a spammer on the twitter app.
    Is there a quick fix? Do I have a virus?
    Please help
    Thank you

    Is there a quick fix? Do I have a virus?
    Try a reset by pressing the home and sleep buttons until you see the Apple logo, ignoring the slider. Takes about 5-15 secs of button holding and you won't lose any data or settings.
    As already said, unless you're JB, you have nothing to worry about regarding a virus.

  • Remote Citadel Access: Only trace list possible

    I can't read traces from a remote Citadel 5 Database. The only thing that works is to get a trace list of the database.
    The Measurement and Automation Explorer can see the remote Database,
    but if I want to expand the database icon to see the trace list, I get
    a yellow/red question mark in it, but no trace list.
    Thank you for all help
    Thomas

    Please follow these links that provide some troubleshooting tips:
    http://digital.ni.com/public.nsf/websearch/7ED8F0419BCAB8BF86256F2A00512AEB?OpenDocument
    http://digital.ni.com/public.nsf/websearch/C5B7A8A219F7EC1086256C4C004FE3A6?OpenDocument
    I hope that helps,
    Jochen Klier
    National Instruments Germany

  • Sharing the Reading List Possible?

    Hi folks.
    Just wondering if I can access the Reading List on my Mac Pro, on my MacBook through my house network?  Fixed internal IPs, so I wanted to see if the Safari on my MacBook can somehow read it. 
    Cheers

    You can using iCloud >  iCloud - Learn how to set up iCloud on all your devices
    iCloud comes with 5GB free storage space.

  • No Wiki/Mailing List Possible on Group

    Hi,
    I'm Settings up tree server from scratch
    Server 1 = OD Master, DNS and DHCP
    Server 2 = Mail, AFP, iCal, Internal Web OD Replica of Server 1
    Server 3 = Web
    I have set up DNS, this works fine, now i want to use in a Group the option of Wiki and Mailinglist
    On server 2 i have setup mail and mailinglist.
    But on Server 1 i can't choose the option to enable the servives like mailinglist and wiki.
    Wich link i mis ... ?
    Thaxs

    Server 1 is now seen as option to select, but that server is not my mail server so mailinglist is not selectable and my wiki and so i want to use my second server.
    What is going Wrong .. ?
    I have setup my servers as advanced.

  • Possible bug?  JBO-25221 on action binding with typed collection.

    I've noticed the following problem when using an action binding to an AM method that has a typed list parameter, eg: List<Long> instead of just List.
    Create app module, then in the Impl class add a method, eg:
    public void doSomethingWithList(List<Long> testList){ /* nop */ }and expose the method through the client interface in the app module. In a view page, drag the method from the Data Controls palette and create a Button from it ('value' in the edit binding dialog can be left blank).
    When the button is accessed at runtime, the following is thrown:
    <Utils><buildFacesMessage> ADF: Adding the following JSF error message: Method TestAppModuleDataControl.dataProvider.doSomethingWithList() not supported
    oracle.jbo.InvalidOperException: JBO-25221: Method TestAppModuleDataControl.dataProvider.doSomethingWithList() not supported
         at oracle.adf.model.binding.DCInvokeMethod.invokeMethod(DCInvokeMethod.java:491)
         at oracle.adf.model.binding.DCDataControl.invokeMethod(DCDataControl.java:2134)
         at oracle.adf.model.bc4j.DCJboDataControl.invokeMethod(DCJboDataControl.java:3020)
         at oracle.adf.model.binding.DCInvokeMethod.callMethod(DCInvokeMethod.java:257)
         at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1625)
         at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2141)
         at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:730)
         at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:394)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:252)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:185)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)I've discovered that the problem is in the generated binding file:
        <methodAction id="doSomethingWithList" RequiresUpdateModel="true"
                      Action="invokeMethod" MethodName="doSomethingWithList"
                      IsViewObjectMethod="false"
                      DataControl="TestAppModuleDataControl"
                      InstanceName="TestAppModuleDataControl.dataProvider">
          <NamedData NDName="testList" NDType="java.util.List&lt;java.lang.Long>"/>
        </methodAction>If I remove the (apparently htmlchars converted) type info from the List, i.e. change that 'NamedData' line to:
    <NamedData NDName="testList" NDType="java.util.List"/>Then it all works again.
    (ADF 11.1.1.3.0, Vista x64)

    Hi,
    the NDValue in the ADF binding does not support Generics yet. So its not working but still no bug. However, this reminds me to file an enhancement request for this support
    Frank

  • How do I edit out the previous email addresses from the pop up list of address in Apple Mail?

    Whenever someone sends me a new email address, I go to address book and edit the page. The problem is that whenever I go to send an email and start to type the address in, the drop down menu lists possible entries as I type, and it still keeps the old address on that list, sometimes above the new address and if I don't carefully check, it will go out to the wrong address.
    It seems to hold onto the old addresses no matter what I do. I have edited, tossed out or changed in the address line of the email, and it still holds onto the old addresses.
    Any suggestions?
    Thanks.

    If I start an email to John Doe. I type in his name and if I look at the drop down menu when I click his name, it will offer several options, including "open in address book". Makes sense. He is already there.
    But some names, a few to be sure, have "add to address book" even though they are already there.
    And if I open the address book and open their page, I will see all the info, just as I should.
    But if I click on the "add to address book", the same email address is repeated on their page in the address book. So I could end up with the same email address 5 times on the page.
    Someone told me once that if I cannot cure the bug then I should consider it a "feature".

  • Function to get the Agents for the Workitem not the possible agents

    Hi Guys ,
    To get the user for each scienario we saved it in the ztable. Now i want to show in report the list possible agents assigned to workitem. ts should agents asigned to it ... its can be four or five ....

    Try to make use of the FM SAP_WAPI_GET_WI_AGENTS, if at all you want to know the agents with respect to a workitem
    and
    check the below too
    SWL_WI_DISP_ACTUAL_AGENTS     
    SWL_WI_DISP_EXCLUDED_AGENTS   
    SWL_WI_DISP_POSSIBLE_AGENTS   

  • Scrolling a list in application published for iPhone

    I am creating an application in Flash CS5 which will be published for iPhone. I need to scroll a list of entries, just like we have a list of songs in iPhone. I am not able to get how to make the scrolling of the list possible. I tried using TouchEvent class but it is not firing any method in Device Central.

    FWIW - mouse events work on iPhone/iPad exactly like they do for a normal Flash app. So you'dprobably want to test for a CLICK or MOUSE_DOWN instead of a touch event...

Maybe you are looking for