我不明白 get_Offset 和 Offset 之间的区别:
MSDN on NamedRange.get_Offset州
This API supports the Visual Studio infrastructure and is not intended to be used directly from your code. Use the Offset property instead of this method.
这到底是什么意思? get_Value 也有类似说法直接在代码中广泛使用的方法。
下面的例子对我来说也是一样的。
myRange.get_Offset(1,0).Value = "Foo";
myRange.Offset[1,0].Value = "Foo";
它们有什么区别?
请您参考如下方法:
get_Something
是由 CLR 为属性 get 访问器生成的内部函数。
例如,如果您有属性(property)
public string Name {get;set;}
编译后你会发现一个
get_Name 和 set_Name 方法,因为属性不是简单的包装 set-variable/单个类域中的 get-variable 概念。
作为一个内部方法,使用它不是一个好习惯,最好使用用户定义的、明确的property访问权限。
