How does this LINQ query work with Option Infer Off?

How should value and filtered be declared?  It doesn't work when I turn Option Infer Off.  Originally, it worked with Option Infer On. There was no Dim statement on the first line, but the Dim keyword was placed before the
filtered = line.  As soon as I turned Option Infer Off, all sorts of errors showed up.  How should the code be adjusted?  (Option Strict is On.)
Dim element, value, filtered As Integer
Dim values() As Integer = {2, 9, 5, 0, 3, 7, 1, 4, 8, 6}
filtered =
From value In values
Where (value > 4)
Select value
For Each element In filtered
Console.Write(element & " ")
Next
Solitaire

Hi Solitaire,
the Option Infer Off version would be:
Option Strict On
Option Infer Off
Imports System
Imports System.Collections.Generic
Imports System.Linq
Public Class Class1
Public Shared Sub LinqWithNoInfer()
Dim values() As Integer = {2, 9, 5, 0, 3, 7, 1, 4, 8, 6}
' compiled to
' filtered = values.Where(Function(value As Integer) value > 4).Select(Function(value As Integer) value)
value)
Dim filtered As IEnumerable(Of Integer) =
From value In values
Where (value > 4)
Select value
For Each element As Integer In filtered
Console.Write(element & " ")
Next
End Sub
End Class
The type for filtered is determined by the Select statement, that is
Enumerable.Select, and will return an
IEnumerable(Of T) and T is an Integer here.
Option Infer looks for the return value of Select and will give the same result.
Note: For Lambda Expressions Option Infer Off is ignored and the type is inferred - both are valid:
filtered = values.Where(Function(value) value > 4).Select(Function(value) value)
filtered = values.Where(Function(value As Integer) value > 4).Select(Function(value As Integer) value)
Regards, Elmar

Similar Messages

  • Is it possible to have your whole family on one apple id or is it better to have each person have there own? If each has their own does each id have to buy their own music and apps? How does find my iphone work with one apple id or two?

    Is it possible to have your whole family on one apple id or is it better to have each person have there own? If each has their own does each id have to buy their own music and apps? How does find my iphone work with one apple id or two? also I am going to be going off to college soon should I make an itunes id for my self and how will I get all the music from the old id?

    Is it possible to have your whole family on one apple id or is it better to have each person have there own?
    Yes, it is possible. 1 apple ID can be associated with up to 10 devices.
    If each has their own does each id have to buy their own music and apps?
    Yes, all purchases are non-transferable.
    How does find my iphone work with one apple id or two?
    Every device associated with one apple ID through Find my iPhone is tied to that Apple ID; Find my iPhone will work in the same way with up to ten devices associated with one apple ID. You cannot enable Find my iPhone for one device across two apple IDs
    I am going to be going off to college soon should I make an itunes id for my self and how will I get all the music from the old id?
    If you have authorized a computer with the old apple ID, you can transfer old media purchased through the old to other devices via iTunes. This doesn't mean the media purchases through the old apple ID it transferred to the new account. If you plan to make future purchases and don't wish to share them with others, make your own apple ID.

  • How does the newest Iphone work with Ford Sync?

    How does the new Iphone work with Ford Sync? I was thinking of purchasing the 4s but may go elsewhere if there is a better phone for the equipment in my vehicle.

    That would be a NO.. I should have done my homework before I switched to IPhone because the Bluetooth just does not want to sync with my Ford Truck. Its such an inconvience. But I see from other posts that Ford isn't the only car experiencing problems. So Hopefully Apple fixes this problem QUICKLY!

  • How does the follwoing query work?

    Want to know how does the follwoign query work??
    For every row in flsp
    the subquery is going to get executed or is it just one time execution of the subquery??
    UPDATE flsp
    SET (DURATION, sdr, inr) =
    (SELECT SUM (tot_charges), SUM (tot_charges_sdr),
    SUM (tot_duration)
    FROM t
    WHERE t.sender_pmn = flsp.sender_pmn
    AND t.recipient_pmn = flsp.recipient_pmn
    AND t.imsi_min = flsp.imsi
    AND TRUNC (t.call_date) = TRUNC (flsp.call_date)
    AND t.call_type = flsp.call_type
    AND t.service_code = flsp.service_code
    GROUP BY sender_pmn,
    recipient_pmn,
    imsi_min,
    TRUNC (t.call_date),
    call_type);
    Edited by: user8731258 on Sep 27, 2010 2:54 AM

    user8731258 wrote:
    the global session table is going to hold data for one sessions where as the table flsp is going to hold data for the entire day.During a session there could be say 10 thousand records.Sounds like a bad idea.
    user8731258 wrote:
    ANd there are goign to aroung 100 such sessions.Continues to sound bad.
    user8731258 wrote:
    I have to update the flsp continually.Just got worse.
    user8731258 wrote:
    How do i make this fetch fast??This still makes no sense to me.
    Why are you moving all this data around and utilizing temporary tables instead of directly querying the underlying data on an 'as needed' basis?
    I think you have undertaken entirely the wrong technical approach to whatever business problem you are attempting to solve (though it's hard to say for sure as we still know little of what you've got going on).
    So back to step number one like i asked before.
    Can you explain (from the very beginning) WHY you are attempting this type of set up?

  • How does the sync functionality work with large libraries on small devices?

    How does the sync functionality work with large libraries?
    Say I sync 100gb of photos with the new Photos app and turn on sync on a 16gb iphone. Will it fill the device up to 16gb? Can I tell it to limit to xgb so I leave room for music and apps? How does this work? Will it slow down my phone if its trying to sync 100gb across smaller devices?

    "Will the Apple TV now read directly from the Time Capsule?" ATV does not 'read' from the TC. It connects to the Mac and itunes library associated with the Mac. Of course the itunes program can 'point' to a library on the TC. You'll still need to have itunes open and the Mac powered on and not sleeping with the TC mounted to the Desktop to use ATV properly. So bottom line the use of TC just adds one more step to view files on the ATV.

  • How does this IMPORT statement works

    can any one tell me how does this statement will work..
    I am wokring on Solution manager system , where in there is a function module SSF_FIELD_LIST
    to which system passes form name.
      import fields to fieldlist
             from database stxfcontr(sf) id l_fullname.
    stxfcontr is a table which contains value of in  a diff
    Regards,
    mayank

    It will import data object stored in memory under named fields to your custom data object fieldlist .
    The table which it is stored is name stxfcontr under RELID (memory area) SF .
    Cluster key (key of the entry) in that table is behind var l_fullname
    Anyhow I think [this link|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3bf8358411d1829f0000e829fbfe/frameset.htm] is more that any explanation. Once you study it, you will understand the above.
    Regards
    Marcin

  • How does premiere pro CC work with nvidia GT 630M (2GB) vega???!

    how does premiere pro CC work with nvidia GT 630M (2GB) vega????!

    That will work. I would just not expect major performance with a heavier load on playback.
    Eric
    ADK

  • How does operator 'less than' work with Rectangle objects?

    Just found in legacy code the following:
    private var firstRect:Rectangle;
    private var secondRect:Rectangle;
    if (firstRect < secondRect)
    // do something
    How does operator 'less than' work with Rectangle objects?
    Doc says that object is converted to number if it is not a String.
    Rectangle is not a String, though has conversion to String.
    Please help.

    IME the best way to know for sure is to experiment. The docs are only one person's best understanding of how things worked on the day, which is seldom 100% accurate. I find that even with code I wrote I can't accurately say 100% of what it does until I've worked with it for a while. Keep in mind that the docs are usually written when the code is written, so  never expect more than a rough idea from the docs.

  • How does a SQL query work

    Hi all...
    How does a SQL query basically work? Is there any pseudocode for it?
    How ro calculate the cost of query?
    Can we find out what would be the execution time for a query before it is executed?
    Thanks in advance.
    Ameya

    Hi Avinash,
    Look closely mate!!!
    You have done set autotrace on... meaning you are executing the statement while i am doing set autotrace traceonly explain meaning the statement would never get executed actually.. oracle optimizer will just select the desired plan and will show the output..
    You can even ESTIMATE how many rows the qeury will return before even executing the statement using the same above tech.. i will show you how:
    The explain plan gives this -- as long as you are using the CBO (cost based
    optimizer). Doesn't matter if you have 1 or 50 tables. The last part of the
    plan is the estimate output.
    consider:
    SQL> set autotrace traceonly explain
    SQL> select e1.*, e2.* from emp e1, emp e2;
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=15 Card=196 Bytes=12544)
    1 0 MERGE JOIN (CARTESIAN) (Cost=15 Card=196 Bytes=12544)
    2 1 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=14 Bytes=448)
    3 1 SORT (JOIN) (Cost=14 Card=14 Bytes=448)
    4 3 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=14 Bytes=448)
    196 = 14 * 14 -- thats right....
    SQL> select emp.ename, mgr.ename from
    2 emp, emp mgr
    3 where emp.mgr = mgr.empno;
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=5 Card=13 Bytes=208)
    1 0 MERGE JOIN (Cost=5 Card=13 Bytes=208)
    2 1 SORT (JOIN) (Cost=3 Card=14 Bytes=112)
    3 2 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=14 Bytes=112)
    4 1 SORT (JOIN) (Cost=3 Card=14 Bytes=112)
    5 4 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=14 Bytes=112)
    Here is estimated that about 13 rows would be returned...
    SQL> select count(*) from emp;
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1)
    1 0 SORT (AGGREGATE)
    2 1 INDEX (FULL SCAN) OF 'EMP_PK' (UNIQUE) (Cost=1 Card=14)
    one row...
    SQL> select ename, dname
    2 from emp, dept where emp.deptno = dept.deptno;
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=5 Card=14 Bytes=252)
    1 0 NESTED LOOPS (Cost=5 Card=14 Bytes=252)
    2 1 TABLE ACCESS (FULL) OF 'DEPT' (Cost=1 Card=4 Bytes=44)
    3 1 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=14 Bytes=98)
    14 rows...
    1 select ename, dname
    2* from emp, dept where emp.deptno = dept.deptno and emp.ename like '%A%'
    SQL> /
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=18)
    1 0 NESTED LOOPS (Cost=2 Card=1 Bytes=18)
    2 1 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=1 Bytes=7)
    3 1 TABLE ACCESS (BY INDEX ROWID) OF 'DEPT' (Cost=1 Card=4 Bytes=44)
    4 3 INDEX (RANGE SCAN) OF 'DEPT_IDX' (NON-UNIQUE)
    1 rows.....
    and this was all done without executing the query. See EXPLAIN plan and the
    PLAN_TABLE.

  • How does this radio button work?

    The attached code is from LabVIEW7.1 example. I just can't figure out how does the 'green' button connect with the 'case green'? Do I need to change the properties of the radio button?
    Attachments:
    Radio Buttons Control.vi ‏32 KB

    Just make the radio control a bit larger and drop in another boolean control (pick ANY!) from the palette. Repeat as needed.
    The radio button control automatically ensure that only the last clicked boolean is true. (see attached, LabVIEW 7.1)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    RadioButtonsControl2.vi ‏43 KB

  • How does this SAVE View works in WAD ?

    Experts,  Before putting this question, i did search for this isssue but couldnt find the correct answer.
    when i run the query in portal i get the correct report. but when i right click on any of the charastractis, i could see the drop down list with some options. in this list of options, there is one entry "Save View"
    I tried saving it, with technical name and desc. but i couldnt find it anywhere.
    does anyone has idea ? how this save view works in Portal ?
    thanx

    Hi, plz. find my answers inline.
    My question is how can we make use of this View. So, what is the importance of VIEW ? How users get benefited ?
    >> If you have scenarios wherein users would want to carry out their own analysis & save for future reference/records, then query views prove to be beneficial. Else creating individual queries to suit user preferences is cumbersome & time consuming.
    I was researching on SDN, and found that if i save it As a VIEW. then if we change the query. the saved view remains unchanged. is that right ? But, what if i remove some characteristics from the query ? Does it remove from the VIEW too ?? Or, Its just, if we make some changes to Key figure structure. It wont make any impact on view.
    >>  You execute a query with its initial view, change the initial view by navigating in the data, and save this new navigational state as a query view. If you later change the initial view of the query in the BEx Query Designer, this change has no effect on the query view previously saved. The query view already exists as an independent object.
    Please let me know. if you find some documentation please post a link, i am happy to read that.
    >> http://help.sap.com/saphelp_nw70/helpdata/en/46/0294bc82f37041e10000000a155369/content.htm
    That if you are using WAD and save as view, you can open using BEx analyzer or the other way around ?
    >> You can create and open a query view from BEx Analyzer or Web / WAD, as long as you have the option to.
    --Priya

  • How does this Oracle job works

    Hi everyone!
    One of my buddy has created t his job:
    sys.dbms_job.submit(jobno, 'SendEmail();', (sysdate + 2/86400), null);
    Its sending the emails very frequently.
    How should this job work? Please guide me.
    Thanks in advance.
    Nith

    Here's a demo of an application code / user submitting a job frequently. Each time the JOB_ID changes but the job "seems" to be present in USER_JOBS. It is a new job each time ! The DBMS_JOB.SUBMIT call does not specify an INTERVAL, so a submitted job is executed only once and exits from the queue. The next submission seems to be the same job, but is actually a new one --- which you can identify because JOB_ID changes.
    10:09:21 SQL> create or replace procedure send_email
    10:09:21   2  as
    10:09:21   3  begin
    10:09:21   4   -- do some processing, send an email
    10:09:21   5   null;
    10:09:21   6  end;
    10:09:21   7  /
    Procedure created.
    10:09:21 SQL>
    10:09:21 SQL> variable jno number;
    10:09:21 SQL>
    10:09:21 SQL> exec dbms_job.submit(:jno,'send_email();',(sysdate+5/86400));
    PL/SQL procedure successfully completed.
    10:09:21 SQL> commit;
    Commit complete.
    10:09:21 SQL>
    10:09:21 SQL> select job, what, next_date, next_sec from user_jobs;
           JOB WHAT                                          NEXT_DATE NEXT_SEC
           146 send_email();                                 25-MAY-11 10:09:26
    10:09:21 SQL>
    10:09:21 SQL> exec dbms_lock.sleep(10);
    PL/SQL procedure successfully completed.
    10:09:31 SQL>
    10:09:31 SQL> exec dbms_job.submit(:jno,'send_email();',(sysdate+5/86400));
    PL/SQL procedure successfully completed.
    10:09:31 SQL> commit;
    Commit complete.
    10:09:31 SQL>
    10:09:31 SQL> select job, what, next_date, next_sec from user_jobs;
           JOB WHAT                                          NEXT_DATE NEXT_SEC
           147 send_email();                                 25-MAY-11 10:09:36
    10:09:31 SQL>
    10:09:31 SQL> exec dbms_lock.sleep(10);
    PL/SQL procedure successfully completed.
    10:09:41 SQL>
    10:09:41 SQL> exec dbms_job.submit(:jno,'send_email();',(sysdate+5/86400));
    PL/SQL procedure successfully completed.
    10:09:41 SQL> commit;
    Commit complete.
    10:09:41 SQL>
    10:09:41 SQL> select job, what, next_date, next_sec from user_jobs;
           JOB WHAT                                          NEXT_DATE NEXT_SEC
           148 send_email();                                 25-MAY-11 10:09:46
    10:09:41 SQL>
    10:09:41 SQL> exec dbms_lock.sleep(10);
    PL/SQL procedure successfully completed.
    10:09:51 SQL>
    10:09:51 SQL> exec dbms_job.submit(:jno,'send_email();',(sysdate+5/86400));
    PL/SQL procedure successfully completed.
    10:09:51 SQL> commit;
    Commit complete.
    10:09:51 SQL>
    10:09:51 SQL> select job, what, next_date, next_sec from user_jobs;
           JOB WHAT                                          NEXT_DATE NEXT_SEC
           149 send_email();                                 25-MAY-11 10:09:56
    10:09:51 SQL>
    10:09:51 SQL> exec dbms_lock.sleep(10);
    PL/SQL procedure successfully completed.
    10:10:01 SQL>
    10:10:01 SQL> -- Now, since I have not resubmitted the job, it doesn't appear any more !
    10:10:01 SQL> select job, what, next_date, next_sec from user_jobs;
    no rows selected
    10:10:01 SQL>Notice how the job doesn't appear at the last query ? Because the application / user did not resubmit it after the previous submission and query. So it has "disappeared".
    Hemant K Chitale
    Edited by: Hemant K Chitale on May 25, 2011 2:23 PM
    Edited by: Hemant K Chitale on May 25, 2011 2:25 PM

  • Newbie: How does the security manager work with EJB?

    Hi,
    I am new to J2EE and do not seem to grasp how the security manager (or J2EESecurityManager) works with EJB.
    My bean does security-senisitive stuff (like getting the Policy object) and must not do so unless I give it permission in the policy file. So far so good. But the permission will only work if I grant it to ALL code, like:
    grant {
    permission java.security.SecurityPermission "getPolicy";
    Beans do not seem to have a protection domain or code source/certificates attached to it. so I cannot say
    grant "/file/sw/ejb/myejb.jar" {
    permission java.security.SecurityPermission "getPolicy";
    Why is that (probably because beans run remote)? But more importantly, how DO I set permissions based on which bean it is?

    If I add that directory as the codebase to
    a grant statement any class loaded from there will
    have the specified permission.I thought so, too, and that is why I went digging for the code source of my bean (i.e. where is it deployed, from where is it loaded) but that source is NULL:
    Some program output:
    ==Has security manager: com.sun.enterprise.J2EESecurityManager
    ==Code source is ProtectionDomain (null <no certificates>)
    The code seems to have no code source (null) and no signatures (in fact, I also signed my code with the keytool but that certificate did not show here either).
    I am running this against the j2ee server 1.3 -- just experimenting, but it does not go so well. :-)

  • How does this Linked List work?

    Hi.
    I wonder how this linked list work
    import java.util.Scanner;
    public class LinkedList {
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            Elem front = null;    // First element of list.
            Elem back  = null;    // Last element of list.
            while (in.hasNext()) {
                String word = in.next();
                Elem e = new Elem();     // Create a new list element.
                e.data = word;           // Set the data field.
                if (front == null) {
                    front = e;            // Back element will be set below.
                } else {
                    back.next = e;       // Link last elem to new element.
                back = e;           
            System.out.println("*** Print words in order of entry");
            Elem curr = front;
            while (curr != null) {
                System.out.println(curr.data);
                curr = curr.next;
    class Elem {
        public Elem next;    // Link to next element in the list.
        public String data;  // Reference to the data.
    }Does anyone know how this allocates memory?
    I feel strange because it's just front = e
    and back = e
    but it never says anything like front.next = back or something..
    Can anyone help me on this?

    Does anyone know how this allocates memory?Memory is allocated on this line:            Elem e = new Elem();     // Create a new list element.
    I feel strange because it's just front = e
    and back = e
    but it never says anything like front.next = back or something..Well, it doesn't need to. Setting .next is taken care of after the initial element is added. It never explicitly says front.next = back because front.next is set when the second element is added. It's set implicitly, on this line:                back.next = e;       // Link last elem to new element.It's implicit in that at that point front and back point to the same element.

  • How does this configurator module work?

    Hello,
    I'm a PHP programmer that has some work that I need to do for
    a client.
    He owns an online tshirt store and wants to develop a
    configurator similar to the own seen here:
    http://propercloth.com/custom-mens-shirts.php#
    You can see as you select fabrics & components the image
    of the shirt on the left updates with the texturised version. My
    client already has a database of his materials ready to plug into
    something like this. I'm quite unfamilar with flash as I mainly do
    backend PHP and I was wondering if someone here might know how this
    flash module works or has some experience coding one so I can get
    my head around how this thing works.
    What is required to create or how would I go about creating:
    1. The base model tshirt
    2. Individual components such as pockets that can be
    shown/hidden
    3. The texturisation engine
    4. Populating the base model with a selected material
    (colour)
    Any advice much appreciated!
    Marv.

    There is no flash on that page. All of that animation is done
    using Javascript. It looks like its using elements from the jquery
    library. You can find out more about it at
    http://www.jquery.com. There are
    other libraries with similar functionality. I prefer mootools:
    http://mootools.net/ .

Maybe you are looking for

  • Receiving text and email notifications while on call

    While I'm on a call, I receive text and email notifications (by a sound and a buzz). Is there a way to shut this off, as it's annoying when there are multiple messages coming through.

  • Can I filter which emails are received?

    I'm only interested in getting email from a small group of people on my iPhone. IS there a best way of doing that? When I'm at home I'm fine checking all the other email I get daily. But on the smaller screen a lot of email can be harder to navigate

  • CC Desktop App Download Error

    I cannot access any of my CC apps due to a download error with the Creative Cloud desktop app.  In the CC desktop app, under the 'Apps' tab, I should be seeing all my downloadable/updatable/etc CC apps, but I am instead presented with 'Download Error

  • Digital Signatures on Scanned forms

    Is it possible to apply Digital Signatures on Scanned form; i.e can we add a hidden signature field? Thanks, Nith

  • Transactions to Display Item-Condtions-Detail for Pricing?

    User sent me a screen shot where I can see at the top: Item, Condition Type, Application, and CondPricingDate. Below are details like Amount, Qty Conversion, Cond. base value, etc. Any idea what transaction they used and how they got to it (params)?