Question: I have a precompiled struct as follow and unfortunately can not make changes in its definition

```
public struct SYSINFO          // Can not change/update this
    {
        public int ver;

        public struct printer
        {
            public string ver;
            public string serial;
            public string hserial;            
        }
        public struct laminator
        {
            public bool installed;
            public string ver;            
        }
    }

```

I am using this struct as out parameter in below code

```
uint test = smart.GetSystemInfo(out SYSINFO sinew); 
string number=sinew.printer.serial;   //<----Not working sinew doesn't have printer option

```

I need to get value of printer.serial property. I am using C# with .Net Framework 4.6.1. i can not change the struct definition.

Answer: 
For a more general solution, with my function you can easily find the first, second, third, forth or fifth sunday, monday, tuesday, wednesday or whatever you want:

```
Public Function GetXDayOfWeek(Day As DateTime,
                              DayOfWeek As DayOfWeek, 
                              Optional Index As Integer = 1) As DateTime
    Dim First As New Date(Day.Year, Day.Month, 1)
    Dim Diff As Integer = (DayOfWeek - First.DayOfWeek + 7) Mod 7

    Return First.AddDays(Diff + (Index - 1) * 7)
End Function

```

So if you want to find the forth wednesday of the current month, use it like:

```
Dim DateToFind As DateTime = GetXDayOfWeek(Today, DayOfWeek.Wednesday, 4)

```
I'd find the fourth Wednesday of the current month this way:

```
Private Sub FourthWednesdayOfCurrentMonth()
    Dim firstOfMonth As DateTime = DateTime.Today.AddDays(-1 * (DateTime.Today.Day - 1))
    Dim firstWednesday As DateTime = firstOfMonth.AddDays((7 + (DayOfWeek.Wednesday - firstOfMonth.DayOfWeek)) Mod 7)
    Dim fourthWednesday As DateTime = firstWednesday.AddDays(21)

    tbYear.Text = fourthWednesday.Year
    tbMonth.Text = fourthWednesday.Month
    tbFour.Text = fourthWednesday.Day
End Sub

```

Written generically for any day of the week, that would change to:

```
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Dim fourthWednesday As DateTime = FourthWeekDayOfCurrentMonth(DayOfWeek.Wednesday)
    tbYear.Text = fourthWednesday.Year
    tbMonth.Text = fourthWednesday.Month
    tbFour.Text = fourthWednesday.Day
End Sub

Private Function FourthWeekDayOfCurrentMonth(ByVal WeekDay As DayOfWeek) As DateTime
    Dim firstOfMonth As DateTime = DateTime.Today.AddDays(-1 * (DateTime.Today.Day - 1))
    Dim firstWeekday As DateTime = firstOfMonth.AddDays((7 + (WeekDay - firstOfMonth.DayOfWeek)) Mod 7)
    Return firstWeekday.AddDays(21)
End Function

```