title: Overloading Generates Error Even Though Signatures Are Different
body: <p>Using vb.net I have this function:</p>
  
  <pre><code> Public Overloads Function GetCountValues(ByVal CampaignIDValue As String,
                                               ByVal AgentValue As String,
                                               ByVal SearchTerm As String) As Integer
  </code></pre>
  
  <p>I overload because we are doing the same thing with this function just without the AgentValue.</p>
  
  <pre><code>Public Overloads Function GetCountValues(ByVal CampaignIDValue As String, ByVal SearchTerm As String) As Integer
  </code></pre>
  
  <p>But the compiler insists the signature is the same even though they are not. If I change the second CampaignIDValue to "As Object" it is fine until you try to actually use it. There has got to be something I am missing to make this work. If you can help I would appreciate it.</p>
  
  <p>The others with no problem:(thanks for your patience HardCode). </p>
  
  <pre><code>Public Overloads Function GetCountValues(ByVal AgentValue As String,
                                               ByVal SearchTerm As String) As Integer
  </code></pre>
  
  <pre><code>Public Overloads Function GetCountValues(ByVal CampaignIDValue As String,
                                               ByVal AgentValue As String,
                                               ByVal LCDATEValue As Date,
                                               ByVal SearchTerm As String) As Integer
  </code></pre>
  
  <p>this one also generates an error if change object back to string</p>
  
  <pre><code>Public Overloads Function GetCountValues(ByVal CampaignIDValue As Object,
                                               ByVal LCDATEValue As Date,
                                               ByVal SearchTerm As String) As Integer
  </code></pre>
  
  <p>The whole class. Copy and paste into a vb.net class and I THINk it will give you the same error:</p>
  
  <pre><code>Public Class clsExample
  
      ''' &lt;summary&gt;
      ''' CampaignID and Agent Driven Count Values
      ''' &lt;/summary&gt;
      Public Overloads Function GetCountValues(ByVal CampaignIDValue As String,
                                               ByVal AgentValue As String,
                                               ByVal SearchTerm As String) As Integer
          Dim x = From p In myTable.AsEnumerable
                  Where LTrim(RTrim(p.CAMPAIGNID)).ToLower =
                      LTrim(RTrim(CampaignIDValue)).ToLower _
                      And LTrim(RTrim(p.AGENT)).ToLower = LTrim(RTrim(AgentValue)).ToLower _
                      And p.TERMCD.Contains(SearchTerm) 'Order By p.AGENT
                  Group p By p.CAMPAIGNID, p.AGENT Into Group
                  Select New With {.CAMPAIGNID = CAMPAIGNID, .Agent = AGENT, .FunctionValue = Group.Count()}
          If x.Any = True Then
              Return x.ElementAt(0).FunctionValue
          Else
              Return 0
              ' Dim NewEntry = New With {.CAMPAIGNID = CampaignIDValue, .Agent = AgentValue, .FunctionValue = 0}
              'x = NewEntry
              ' Dim Copy = x.Append(NewEntry)
              'Return Copy
  
          End If
      End Function
  
      ''' &lt;summary&gt;
      ''' CampaignID Driven Count Values
      ''' &lt;/summary&gt;
      Public Overloads Function GetCountValues(ByVal CampaignIDValue As String, ByVal SearchTerm As String) As Integer
          Dim x = From p In myTable.AsEnumerable
                  Where LTrim(RTrim(p.CAMPAIGNID)).ToLower =
                      LTrim(RTrim(CampaignIDValue)).ToLower _
                      And p.TERMCD.Contains(SearchTerm) 'Order By p.AGENT
                  Group p By p.CAMPAIGNID Into Group
                  Select New With {.CAMPAIGNID = CAMPAIGNID, .FunctionValue = Group.Count()}
          If x.Any = True Then
              Return x.ElementAt(0).FunctionValue
          Else
              Return 0
              ' Dim NewEntry = New With {.CAMPAIGNID = CampaignIDValue, .Agent = AgentValue, .FunctionValue = 0}
              'x = NewEntry
              ' Dim Copy = x.Append(NewEntry)
              'Return Copy
  
          End If
      End Function
  
  
      'Public Overloads Function GetCountValues(ByVal CampaignIDValue As String,
      '                                         ByVal SearchTerm As String) As Integer
      '    Dim x = From p In myTable.AsEnumerable
      '            Where LTrim(RTrim(p.CAMPAIGNID)).ToLower =
      '                LTrim(RTrim(CampaignIDValue)).ToLower _
      '                And p.TERMCD.Contains(SearchTerm)
      '            Group p By p.CAMPAIGNID Into Group
      '            Select New With {.CAMPAIGNID = CAMPAIGNID, .FunctionValue = Group.Count()}
      '    If x.Any = True Then
      '        Return x.ElementAt(0).FunctionValue
      '    Else
      '        Return 0
      '        ' Dim NewEntry = New With {.CAMPAIGNID = CampaignIDValue, .Agent = AgentValue, .FunctionValue = 0}
      '        'x = NewEntry
      '        ' Dim Copy = x.Append(NewEntry)
      '        'Return Copy
  
      '    End If
      'End Function
  
      ''' &lt;summary&gt;
      ''' Agent Driven Count Values
      ''' &lt;/summary&gt;
      Public Overloads Function GetCountValues(ByVal AgentValue As String,
                                               ByVal SearchTerm As String) As Integer
          Dim x = From p In myTable.AsEnumerable
                  Where LTrim(RTrim(p.AGENT)).ToLower =
                      LTrim(RTrim(AgentValue)).ToLower _
                      And p.TERMCD.Contains(SearchTerm)
                  Group p By p.AGENT Into Group
                  Select New With {.Agent = AgentValue, .FunctionValue = Group.Count()}
          If x.Any = True Then
              Return x.ElementAt(0).FunctionValue
          Else
              Return 0
              ' Dim NewEntry = New With {.CAMPAIGNID = CampaignIDValue, .Agent = AgentValue, .FunctionValue = 0}
              'x = NewEntry
              ' Dim Copy = x.Append(NewEntry)
              'Return Copy
  
          End If
      End Function
  
      ''' &lt;summary&gt;
      ''' LCDate, CampaignID and Agent Driven Count Values
      ''' &lt;/summary&gt;
      Public Overloads Function GetCountValues(ByVal CampaignIDValue As String,
                                               ByVal AgentValue As String,
                                               ByVal LCDATEValue As Date,
                                               ByVal SearchTerm As String) As Integer
          Dim x = From p In myTable.AsEnumerable
                  Where LTrim(RTrim(p.CAMPAIGNID)).ToLower =
                      LTrim(RTrim(CampaignIDValue)).ToLower _
                      And LTrim(RTrim(p.AGENT)).ToLower = LTrim(RTrim(AgentValue)).ToLower _
                      And p.TERMCD.Contains(SearchTerm) 'Order By p.AGENT
                  Group p By p.LCDATE, p.CAMPAIGNID, p.AGENT Into Group
                  Select New With {.LCDATE = LCDATEValue, .CAMPAIGNID = CAMPAIGNID, .Agent = AGENT, .FunctionValue = Group.Count()}
          If x.Any = True Then
              Return x.ElementAt(0).FunctionValue
          Else
              Return 0
              ' Dim NewEntry = New With {.CAMPAIGNID = CampaignIDValue, .Agent = AgentValue, .FunctionValue = 0}
              'x = NewEntry
              ' Dim Copy = x.Append(NewEntry)
              'Return Copy
  
          End If
      End Function
  
      ''' &lt;summary&gt;
      ''' LCDate and CampaignID Driven Count Values
      ''' &lt;/summary&gt;
      Public Overloads Function GetCountValues(ByVal CampaignIDValue As Object,
                                               ByVal LCDATEValue As Date,
                                               ByVal SearchTerm As String) As Integer
          Dim x = From p In myTable.AsEnumerable
                  Where LTrim(RTrim(p.CAMPAIGNID)).ToLower =
                      LTrim(RTrim(CampaignIDValue)).ToLower _
                      And p.TERMCD.Contains(SearchTerm) 'Order By p.AGENT
                  Group p By p.LCDATE, p.CAMPAIGNID Into Group
                  Select New With {.LCDATE = LCDATEValue, .CAMPAIGNID = CAMPAIGNID, .FunctionValue = Group.Count()}
          If x.Any = True Then
              Return x.ElementAt(0).FunctionValue
          Else
              Return 0
              ' Dim NewEntry = New With {.CAMPAIGNID = CampaignIDValue, .Agent = AgentValue, .FunctionValue = 0}
              'x = NewEntry
              ' Dim Copy = x.Append(NewEntry)
              'Return Copy
  
          End If
      End Function
  
      ''' &lt;summary&gt;
      ''' LCDate and Agent Driven Count Values
      ''' &lt;/summary&gt;
      Public Overloads Function GetCountValues(ByVal AgentValue As String,
                                               ByVal LCDATEValue As Date,
                                               ByVal SearchTerm As String) As Integer
          Dim x = From p In myTable.AsEnumerable
                  Where LTrim(RTrim(p.AGENT)).ToLower =
                      LTrim(RTrim(AgentValue)).ToLower _
                      And p.TERMCD.Contains(SearchTerm) 'Order By p.AGENT
                  Group p By p.LCDATE, p.AGENT Into Group
                  Select New With {.LCDATE = LCDATEValue, .Agent = AgentValue, .FunctionValue = Group.Count()}
          If x.Any = True Then
              Return x.ElementAt(0).FunctionValue
          Else
              Return 0
              ' Dim NewEntry = New With {.CAMPAIGNID = CampaignIDValue, .Agent = AgentValue, .FunctionValue = 0}
              'x = NewEntry
              ' Dim Copy = x.Append(NewEntry)
              'Return Copy
  
          End If
      End Function
  
      ''' &lt;summary&gt;
      ''' LCDate Driven Count Values
      ''' &lt;/summary&gt;
      Public Overloads Function GetCountValues(ByVal LCDATEValue As Date,
                                               ByVal SearchTerm As String) As Integer
          Dim x = From p In myTable.AsEnumerable
                  Where p.LCDATE =
                      LCDATEValue _
                      And p.TERMCD.Contains(SearchTerm) 'Order By p.AGENT
                  Group p By p.LCDATE Into Group
                  Select New With {.LCDATE = LCDATEValue, .FunctionValue = Group.Count()}
          If x.Any = True Then
              Return x.ElementAt(0).FunctionValue
          Else
              Return 0
              ' Dim NewEntry = New With {.CAMPAIGNID = CampaignIDValue, .Agent = AgentValue, .FunctionValue = 0}
              'x = NewEntry
              ' Dim Copy = x.Append(NewEntry)
              'Return Copy
  
          End If
      End Function
  End Class
  </code></pre>