I have some old J# code that I am moving to C#
XmlNodeList itemTransferOutNodes =
strXML.GetElementsByTagName("ItemTransferOut");
XmlElement itemInfo =
itemTransferOutNodes.Item(itemTrOutNodesCnt)
.ChildNodes.Item(0)
.get_Item("itemInfo");
I dont see in C#
API of XmlNodeList
method called get_Item
.
To what I should change get_Item
in c#
.
Thanks .
J# does not have support for properties like C# does, so they are "faked" by using methods instead. You can find more information on that matter on MSDN. If a C# object has a property named SomeProperty:
public class Dummy {
public string SomeProperty { get; set; }
}
in J#, you'll have to call get_SomeProperty() and set_SomeProperty(string value):
public class Dummy
{
private String someProperty;
/** @property */
public void set_SomeProperty(String val) {
someProperty = val;
}
/** @property */
public String get_SomeProperty() {
return someProperty;
}
}
And the other way around is true.
If you find in J# a class method called get_xxx or set_xxx, it's most likely that in C#, the object has a property named xxx.
So basically, as others mentionned, you have to use the Item property in your code :
XmlNodeList itemTransferOutNodes =
strXML.GetElementsByTagName("ItemTransferOut");
XmlElement itemInfo =
itemTransferOutNodes.Item(itemTrOutNodesCnt)
.ChildNodes.Item(0).Item["itemInfo"];
Hope that helps :)