AdamSpeight2008's Profile User Rating: ****-

Reputation: 2270 Grandmaster
Group:
Mentors
Active Posts:
9,640 (4.06 per day)
Joined:
29-May 08
Profile Views:
129,152
Last Active:
User is offline Today, 09:41 AM
Currently:
Offline

Previous Fields

Country:
GB
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
Playstation
Your Car:
Ford
Dream Kudos:
6575
Expert In:
vb.net, LINQ

Latest Visitors

Icon   AdamSpeight2008 is not fully here at the moment, please leave a message after the voices haves stopped.

Posts I've Made

  1. In Topic: Calculate average of array with a function

    Posted 13 Nov 2014

    You're passing an element of the array, not the array itself the function.
  2. In Topic: Template Functions & Template Masks

    Posted 13 Nov 2014

    The example in the blog one works for the VS2014cpt4 release. They change the API use for diagnostics.
    Template Function and Template Mask are a feature request I would like to see implement to help with writing code-fixes and diagnostics.

    The examples are written in VB.net yes but one does the analyse for C# and another does the VB.net
  3. In Topic: Binary Addition - odd result

    Posted 10 Nov 2014

    That guys an idiot, they think that 1 + 0 = 10 (2) .
    Unsure then write out the truth table of all inputs A B Carry In and the two results Result and Carry Out
    Spoiler
  4. In Topic: Template Functions & Template Masks

    Posted 10 Nov 2014

    Another example that replaces the following construct
    int x = 0;
    if( cond )
    {
      x = 5;
    }
    else
    {
      x = 10;
    }
    
    

    it with an in-line if expression
    int x = 0;
    x = ( cond ) ? ( 5 ) : ( 10 ) ;
    
    


    Let's see how do that via templates and template masks.
    template mask simple_assignment() : template_mask
    {
      |{ /{ target }/ = /{ source }/ ; |}
    }
    
    template assignment_viaCondition_ <T>( target : __      , cond   : Expr<Bool> ,
                                           valueA : Expr<T> , valueB : Expr<T> ) : CS.Expr
    {
      |{ var /{ target }/ = (/{ cond }/ ) ? ( /{ valueA }/ ) : ( /{ valueB }/ ) ; |} 
    }
    
    template mask _IfElse_() : template_mask  
    {
      |{ if( /{ cond }/ 
         {
           /{ on_true }/
         }
         else
         {
           /{ on_false }/
         }
       }|
    }
    
    AnalyseNode ( node : SyntaxNode )
    {
      var mn = template.Match( node , _IfElse_ )
      if( !mn.Valid ) return
      var part_0 = template.Match( mn["on_true"], simple_assignment )
      var part_1 = template.Match( mn["on_false"], simple_assignment )
      if( part_0.Valid && part_1.Valid )
      {
        if( part_0["target"] == part_1["target"] ) 
        { 
          node.ReplaceWith( assignment_viaCondition_( part_0["target"] , mn["cond"] , part_0["source"],  part_1["source"] );
        }
      }
    }
    
    
  5. In Topic: Simple Question

    Posted 10 Nov 2014

    You need to examine what is actually happening, not what you think is happening.
    Select Case intExamMark
      Case (Is < 40)          :   Console.WriteLine("Grade U")
      Case ((Is >= 40) < 50)  : Console.WriteLine("Grade E")
      Case ((Is >= 50) < 60)  : Console.WriteLine("Grade D")
      Case ((Is >= 60) < 70)  : Console.WriteLine("Grade C")
      Case ((Is >= 70) < 80)  : Console.WriteLine("Grade B")
      Case ((Is >= 80) < 100) : Console.WriteLine("Grade A")
      Case (Is >= 100) :   Console.WriteLine("Out of a 100!")
    End Select
    
    


    Let's examine the types being use in expression
    ((Is >= 40) < 50) which if were replace with the types being use ((Int >= Int ) < Int)

    Operators can be thought as function calls, so lets expanded the types.
    (Int , Int) ==> Boolean
    Next part of the expression
    (Boolean , Int) ==> Boolean

    The Boolean is the result of the first operator method ( >= )

    Hence an error as there is now operator that accepts and integer and a boolean.

    VB.net doesn't interpret code like a human, you need to be explicit in your meaning.

      Case  ( Is >= 40) AndAlso ( Is < 50)
    
    


    Don't be scare or afraid of consulting and research the MSDN Documentation. (Link)

My Information

Member Title:
MrCupOfT
Age:
34 years old
Birthday:
December 20, 1979
Gender:
Location:
Behind You
Forum Leader:
VB.NET
Years Programming:
16

Contact Information

E-mail:
Private
Website URL:
Website URL  http://

Comments

  • (2 Pages)
  • +
  • 1
  • 2
  1. Photo

    lovee12 Icon

    02 Sep 2014 - 14:40
    hi baby
  2. Photo

    modi123_1 Icon

    30 May 2014 - 09:49
    You are on your roslyn kick.. this may interest you. http://msmvps.com/blogs/matthieu/archive/2014/05/24/roslyn-basis.aspx
  3. Photo

    estherNamogo Icon

    03 Nov 2013 - 06:30
    Hello
    Nice to meet you write
    me at (esther2namogo@hotmail.com) i will send you my picture OK.
  4. Photo

    bryanjay Icon

    12 Jul 2013 - 20:27
    can i ask a question??
  5. Photo

    lucky3 Icon

    31 Dec 2012 - 02:19
    Congratulations for the "DIC Blog of the Year" award 1st place!
  6. Photo

    raghav.naganathan Icon

    15 Nov 2012 - 21:29
    Hey...just to tell you this before your rep(1729) changes...:)
    1729 is called Hardy-Ramanujan number :)
  7. Photo

    trevster344 Icon

    17 Sep 2012 - 13:04
    Excellent job with everything man, every tutorial, and over all everything you do here at D.I.C.
  8. Photo

    torind_2000 Icon

    09 Aug 2012 - 08:58
    Wanted to say thanks for all the info and resources you have gathered for us, it's been very useful.
  9. Photo

    modi123_1 Icon

    30 Jul 2012 - 09:12
    Quite the list of awards there..
  10. Photo

    Thailand Icon

    28 May 2012 - 07:30
    Hi Adam, can you make a tutorial with how to make a multiplayer Texas H'oldem game please?
  11. Photo

    chyldlyk Icon

    08 Feb 2012 - 13:41
    sir im a fan of yout post..very good tutorials..i really learned a lot..Sir i have a question where can i find your Walkthrough about update and delete using table adapter configuration wizard just like your username and password database..thank you for reading this..:D
  12. Photo

    DimitriV Icon

    05 Jan 2012 - 19:41
    16 years programming? Nice effort!
  13. Photo

    awal Icon

    25 Mar 2011 - 04:32
    nice
  14. Photo

    BenignDesign Icon

    11 Apr 2010 - 10:05
    Is that you? Looks like a young Bono. Weird.
  15. Photo

    Salmancom Icon

    28 Mar 2010 - 03:26
    hi..
  • (2 Pages)
  • +
  • 1
  • 2