File tree Expand file tree Collapse file tree 3 files changed +12
-12
lines changed
cpp/VS_Snippets_CLR/conceptual.interop.marshaling/cpp
csharp/VS_Snippets_CLR/conceptual.interop.marshaling/cs
visualbasic/VS_Snippets_CLR/conceptual.interop.marshaling/vb Expand file tree Collapse file tree 3 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,12 @@ public ref class SystemTime
1616 unsigned short millisecond;
1717};
1818
19- public class LibWrap
19+ public class NativeMethods
2020{
2121public:
2222 // Declares a managed prototype for the unmanaged function using Platform Invoke.
2323 [DllImport(" Kernel32.dll" )]
24- static void GetSystemTime ([In,Out] SystemTime^ st);
24+ static void GetSystemTime ([In, Out] SystemTime^ st);
2525};
2626
2727public class App
@@ -31,9 +31,9 @@ public class App
3131 {
3232 Console::WriteLine (" C++/CLI SysTime Sample using Platform Invoke" );
3333 SystemTime^ st = gcnew SystemTime ();
34- LibWrap ::GetSystemTime (st);
34+ NativeMethods ::GetSystemTime (st);
3535 Console::Write (" The Date is: " );
36- Console::Write (" {0} {1} {2}" , st->month , st->day , st->year );
36+ Console::Write (" {0} {1} {2}" , st->month , st->day , st->year );
3737 }
3838};
3939
Original file line number Diff line number Diff line change @@ -15,11 +15,11 @@ public class SystemTime
1515 public ushort millisecond ;
1616}
1717
18- public class LibWrap
18+ internal static class NativeMethods
1919{
2020 // Declares a managed prototype for the unmanaged function using Platform Invoke.
2121 [ DllImport ( "Kernel32.dll" ) ]
22- public static extern void GetSystemTime ( [ In , Out ] SystemTime st ) ;
22+ internal static extern void GetSystemTime ( [ In , Out ] SystemTime st ) ;
2323}
2424
2525public class App
@@ -28,9 +28,9 @@ public static void Main()
2828 {
2929 Console . WriteLine ( "C# SysTime Sample using Platform Invoke" ) ;
3030 SystemTime st = new SystemTime ( ) ;
31- LibWrap . GetSystemTime ( st ) ;
31+ NativeMethods . GetSystemTime ( st ) ;
3232 Console . Write ( "The Date is: " ) ;
33- Console . Write ( "{0} {1} {2}" , st . month , st . day , st . year ) ;
33+ Console . Write ( $ " { st . month } { st . day } { st . year } " ) ;
3434 }
3535}
3636
Original file line number Diff line number Diff line change @@ -14,18 +14,18 @@ Public Class SystemTime
1414 Public millisecond As Short
1515End Class 'SystemTime
1616
17- Public Class LibWrap
17+ Friend Class NativeMethods
1818 ' Declares a managed prototype for the unmanaged function.
19- Declare Sub GetSystemTime Lib "Kernel32.dll" (
19+ Friend Declare Sub GetSystemTime Lib "Kernel32.dll" (
2020 <[In](), Out ()> ByVal st As SystemTime)
2121End Class 'LibWrap
2222
2323Public Class App
2424 Public Shared Sub Main()
2525 Console.WriteLine( "VB .NET SysTime Sample using Platform Invoke" )
2626 Dim st As New SystemTime()
27- LibWrap .GetSystemTime(st)
28- Console.Write( "The Date is: {0} {1} {2}" , st.month, st.day, st.year)
27+ NativeMethods .GetSystemTime(st)
28+ Console.Write( $ "The Date is: {st.month} { st.day} { st.year}" )
2929 End Sub 'Main
3030End Class 'App
3131
You can’t perform that action at this time.
0 commit comments