严格的选项不允许后期绑定 [英] Option strict disallows late binding
本文介绍了严格的选项不允许后期绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个我要引用的对象,但出现错误:
Option Strict不允许后期绑定
在下面的代码中,带下划线的对象是导致错误的原因
I have an object that I''m trying to reference but I get the error:
Option Strict disallows late binding
In the code below, the underlined object is what causes the error
Public Sub Sort(contacts As Object, comparer As Object, fieldName As String, direction As String)
Dim itemIndex As Integer = 0
Select Case fieldName
Case "FirstName"
If direction = "decend" Then
comparer = serializeInfo.OrderByDescending(Function(x) x.FirstName).ToList()
For itemIndex = 0 To serializeInfo.Count - 1
Console.WriteLine(comparer(itemIndex).FirstName)
Next
Else
comparer = serializeInfo.OrderBy(Function(x) x.FirstName).ToList()
End If
我无法预览正常工作,所以我将代码保持原样.
感谢您的帮助.
我尝试过的事情:
一些铸造
创建对象
I can''t get preview to work so I''m leaving the code as is.
thanks for any help.
What I have tried:
Some casting
Create object
推荐答案
尝试一下
try this
Public Sub Sort(contacts As Object, comparer As List(Of Contact), fieldName As String, direction As String)
这篇关于严格的选项不允许后期绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文