Below is the code:
PropertyInfo[] requestPropertyInfo;
requestPropertyInfo = typeof(CBNotesInqAndMaintRequest).GetProperties();
The CBNotesInqAndMaintRequest contains request data member noteline1—noteline18. once I read the name of one of the data member, I want to get its last index. For eg. If the name of the request object is "noteline8", I want to get the index as 8.
For this I have written the below code:
foreach (PropertyInfo reqPropertyInfo in requestPropertyInfo)
{
index = reqPropertyInfo.Name.LastIndexOf("noteline");
}
But the above code is returning the index as 0.
I created a RegEx solution that doesn’t matter what the property name is, but grabs the last digits and returns an integer
Usable in your example like so: