c# Programming Glossary: retval
How do you find out when you've been loaded via XML Serialization? http://stackoverflow.com/questions/1266547/how-do-you-find-out-when-youve-been-loaded-via-xml-serialization public static OfficeCollection Search OfficeCollection retval new OfficeCollection string xmlString @ Office IsHq 'True'.. State Town Office XmlSerializer xs new XmlSerializer retval.GetType XmlReader xr new XmlTextReader xmlString retval OfficeCollection.. retval.GetType XmlReader xr new XmlTextReader xmlString retval OfficeCollection xs.Deserialize xr foreach Office thisOffice..
Convert DataTable to List<T> http://stackoverflow.com/questions/1427484/convert-datatable-to-listt T DataTable input Convert DataRow T conversion List T retval new List T foreach DataRow dr in input.Rows retval.Add conversion.. List T retval new List T foreach DataRow dr in input.Rows retval.Add conversion dr return retval share improve this answer..
How to read the Color of a Screen Pixel http://stackoverflow.com/questions/1483928/how-to-read-the-color-of-a-screen-pixel IntPtr hSrcDC gsrc.GetHdc IntPtr hDC gdest.GetHdc int retval BitBlt hDC 0 0 1 1 hSrcDC location.X location.Y int CopyPixelOperation.SourceCopy..
A C# equivalent of C's fread file i/o http://stackoverflow.com/questions/1935851/a-c-sharp-equivalent-of-cs-fread-file-i-o throw new ArgumentException File contains bad data T retval GCHandle hdl GCHandle.Alloc mBuffer GCHandleType.Pinned try.. hdl GCHandle.Alloc mBuffer GCHandleType.Pinned try retval T Marshal.PtrToStructure hdl.AddrOfPinnedObject typeof T finally.. hdl.AddrOfPinnedObject typeof T finally hdl.Free return retval A sample declaration for the structure of the data in the file..
Howto implement callback interface from unmanaged DLL to .net app? http://stackoverflow.com/questions/2167895/howto-implement-callback-interface-from-unmanaged-dll-to-net-app C __declspec dllexport void __stdcall TestCallback int retval Handler hello world That's enough to get you started with it...
Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic http://stackoverflow.com/questions/3965767/function-or-interface-marked-as-restricted-or-the-function-uses-an-automation-t in BSTR bstrTypeURI in unsigned long dwFlags out retval IUPnPDevices pDevices Note the 2nd argument unsigned long. VB6..
ASCIIEncoding In Windows Phone 7 http://stackoverflow.com/questions/4022281/asciiencoding-in-windows-phone-7 ASCII codes public static byte StringToAscii string s byte retval new byte s.Length for int ix 0 ix s.Length ix char ch s ix.. for int ix 0 ix s.Length ix char ch s ix if ch 0x7f retval ix byte ch else retval ix byte ' ' return retval share improve..
Logoff interactive users in Windows from a service http://stackoverflow.com/questions/5207506/logoff-interactive-users-in-windows-from-a-service new List int IntPtr buffer IntPtr.Zero int count 0 int retval WTSEnumerateSessions server 0 1 ref buffer ref count int dataSize.. typeof WTS_SESSION_INFO Int64 current int buffer if retval 0 for int i 0 i count i WTS_SESSION_INFO si WTS_SESSION_INFO..
Getting return value from stored procedure in C# http://stackoverflow.com/questions/706361/getting-return-value-from-stored-procedure-in-c-sharp Username sqlcomm.Parameters.Add param SqlParameter retval sqlcomm.Parameters.Add @b SqlDbType.VarChar retval.Direction.. retval sqlcomm.Parameters.Add @b SqlDbType.VarChar retval.Direction ParameterDirection.ReturnValue string retunvalue string.. I noticed is that you never run the query ... SqlParameter retval sqlcomm.Parameters.Add @b SqlDbType.VarChar retval.Direction..
How do you retrieve a list of logged-in/connected users in .NET? http://stackoverflow.com/questions/132620/how-do-you-retrieve-a-list-of-logged-in-connected-users-in-net IntPtr domainPtr IntPtr.Zero Int32 sessionCount 0 Int32 retVal WTSEnumerateSessions serverHandle 0 1 ref SessionInfoPtr ref.. Int32 currentSession int SessionInfoPtr uint bytes 0 if retVal 0 for int i 0 i sessionCount i WTS_SESSION_INFO si WTS_SESSION_INFO..
How to know a process is 32-bit or 64-bit programmatically http://stackoverflow.com/questions/1953377/how-to-know-a-process-is-32-bit-or-64-bit-programmatically 1 IntPtr processHandle bool retVal try processHandle Process.GetProcessById process.Id .Handle.. return NativeMethods.IsWow64Process processHandle out retVal retVal return false not on 64 bit Windows internal static.. NativeMethods.IsWow64Process processHandle out retVal retVal return false not on 64 bit Windows internal static class NativeMethods..
How can you get the names of method parameters? http://stackoverflow.com/questions/214086/how-can-you-get-the-names-of-method-parameters System.Reflection.MethodInfo method int index string retVal string.Empty if method null method.GetParameters .Length index.. if method null method.GetParameters .Length index retVal method.GetParameters index .Name return retVal The above sample.. index retVal method.GetParameters index .Name return retVal The above sample should do what you need. share improve this..
How to get the logon SID in c# http://stackoverflow.com/questions/2146153/how-to-get-the-logon-sid-in-c-sharp TokenInformation return string.Empty string retVal string.Empty TOKEN_GROUPS groups TOKEN_GROUPS Marshal.PtrToStructure.. ConvertSidToStringSid sidAndAttributes.Sid out pstr retVal Marshal.PtrToStringAuto pstr LocalFree pstr break Marshal.FreeHGlobal.. pstr break Marshal.FreeHGlobal TokenInformation return retVal N.B. I tested it on my x64 machine so please pay close attention..
How to get index using LINQ? http://stackoverflow.com/questions/2471588/how-to-get-index-using-linq null throw new ArgumentNullException predicate int retVal 0 foreach var item in items if predicate item return retVal.. 0 foreach var item in items if predicate item return retVal retVal return 1 summary Finds the index of the first occurence.. foreach var item in items if predicate item return retVal retVal return 1 summary Finds the index of the first occurence of an..
How to detect Windows 64-bit platform with .NET? http://stackoverflow.com/questions/336633/how-to-detect-windows-64-bit-platform-with-net 6 using Process p Process.GetCurrentProcess bool retVal if IsWow64Process p.Handle out retVal return false return.. bool retVal if IsWow64Process p.Handle out retVal return false return retVal else return false share improve..
Fastest function to generate Excel column letters in C# http://stackoverflow.com/questions/837155/fastest-function-to-generate-excel-column-letters-in-c-sharp public static int NumberFromExcelColumn string column int retVal 0 string col column.ToUpper for int iChar col.Length 1 iChar.. 0 iChar char colPiece col iChar int colNum colPiece 64 retVal retVal colNum int Math.Pow 26 col.Length iChar 1 return retVal.. char colPiece col iChar int colNum colPiece 64 retVal retVal colNum int Math.Pow 26 col.Length iChar 1 return retVal As..
|