c# Programming Glossary: return
Encrypt/Decrypt string in .NET http://stackoverflow.com/questions/202011/encrypt-decrypt-string-in-net sharedSecret string outStr null Encrypted string to return RijndaelManaged aesAlg null RijndaelManaged object used to.. Return the encrypted bytes from the memory stream. return outStr summary Decrypt the given string. Assumes the string.. the RijndaelManaged object. if aesAlg null aesAlg.Clear return plaintext private static byte ReadByteArray Stream s byte rawLength..
Dynamic LINQ OrderBy on IEnumerable<T> http://stackoverflow.com/questions/41244/dynamic-linq-orderby-on-ienumerablet T OrderBy T this IQueryable T source string property return ApplyOrder T source property OrderBy public static IOrderedQueryable.. T this IQueryable T source string property return ApplyOrder T source property OrderByDescending public static.. ThenBy T this IOrderedQueryable T source string property return ApplyOrder T source property ThenBy public static IOrderedQueryable..
Random number generator only generating one random number http://stackoverflow.com/questions/767999/random-number-generator-only-generating-one-random-number int RandomNumber int min int max Random random new Random return random.Next min max How I call it byte mac new byte 6 for int.. int RandomNumber int min int max lock syncLock synchronize return random.Next min max Edit see comments why do we need a lock..
Deep cloning objects in C# http://stackoverflow.com/questions/78536/deep-cloning-objects-in-c-sharp param name source The object instance to copy. param returns The copied object. returns public static T Clone T T source.. object instance to copy. param returns The copied object. returns public static T Clone T T source if typeof T .IsSerializable.. serializable. source Don't serialize a null object simply return the default for that object if Object.ReferenceEquals source..
What is “Best Practice” For Comparing Two Instances of a Reference Type? http://stackoverflow.com/questions/104158/what-is-best-practice-for-comparing-two-instances-of-a-reference-type p obj as TwoDPoint if System.Object p null return false Return true if the fields match return x p.x y p.y public bool Equals.. is null return false if object p null return false Return true if the fields match return x p.x y p.y public override..
How to return anonymous type from c# method that uses LINQ to SQL [duplicate] http://stackoverflow.com/questions/1070526/how-to-return-anonymous-type-from-c-sharp-method-that-uses-linq-to-sql uses LINQ to SQL duplicate Possible Duplicate LINQ to SQL Return anonymous type I have a standard LINQ to SQL query which returns..
Encrypt/Decrypt string in .NET http://stackoverflow.com/questions/202011/encrypt-decrypt-string-in-net the RijndaelManaged object. if aesAlg null aesAlg.Clear Return the encrypted bytes from the memory stream. return outStr summary..
Hash and salt passwords in C# http://stackoverflow.com/questions/2138429/hash-and-salt-passwords-in-c-sharp byte buff new byte size rng.GetBytes buff Return a Base64 string representation of the random number. return..
Convert webpage to image from ASP.NET http://stackoverflow.com/questions/2715385/convert-webpage-to-image-from-asp-net in codecs if codec.FormatID format.Guid return codec Return return null And can call it as follows WebsiteToImage websiteToImage..
Using AES encryption in C# http://stackoverflow.com/questions/273452/using-aes-encryption-in-c-sharp plainText encrypted msEncrypt.ToArray Return the encrypted bytes from the memory stream. return encrypted..
How do I use IValidatableObject? http://stackoverflow.com/questions/3400542/how-do-i-use-ivalidatableobject ValidationContext validationContext if this.Enable Return valid result here. I don't care if Prop1 and Prop2 are out of..
Is it possible to programmatically generate an X509 certificate using only C#? http://stackoverflow.com/questions/3770233/is-it-possible-to-programmatically-generate-an-x509-certificate-using-only-c both the certificate and the private key you could either Return an X509Certificate2 object in which you've initialized the PrivateKey.. you've sent mirror explains how to build a PKCS#12 store. Returning the byte DER structure for the X.509 certificate itself will..
Proper Use of yield return http://stackoverflow.com/questions/410026/proper-use-of-yield-return product in products yield return product Version 2 Return the list public static IEnumerable Product GetAllProducts using..
Get File Icon used by Shell http://stackoverflow.com/questions/462270/get-file-icon-used-by-shell
How would I run an async Task<T> method synchronously? http://stackoverflow.com/questions/5095183/how-would-i-run-an-async-taskt-method-synchronously has a T return type synchronously summary typeparam name T Return Type typeparam param name task Task T method to execute param..
LINQ to SQL: Return anonymous type? http://stackoverflow.com/questions/534690/linq-to-sql-return-anonymous-type to SQL Return anonymous type Using the simple example below what is the best..
Does C# support return type covariance? http://stackoverflow.com/questions/5709034/does-c-sharp-support-return-type-covariance covariance. C# does not support return type covariance. Return type covariance is where you override a base class method that..
ObservableCollection Doesn't support AddRange method, so I get notified for each item added, besides what about INotifyCollectionChanging? http://stackoverflow.com/questions/670577/observablecollection-doesnt-support-addrange-method-so-i-get-notified-for-each Property Action As NotifyCollectionChangedAction Get Return m_Action End Get End Property Private m_Items As IList Public.. Public ReadOnly Property Items As IEnumerable Of T Get Return m_Items End Get End Property End Class share improve this..
Merge two object lists with linq http://stackoverflow.com/questions/720609/merge-two-object-lists-with-linq var person obj as Person return Equals person summary Returns an identifier for this instance summary public override int.. have a Name assigned yet we can't define if it's the same. Return false. if string.IsNullOrEmpty personToCompareTo.Name return..
Using C#, how does one figure out what process locked a file? http://stackoverflow.com/questions/860656/using-c-how-does-one-figure-out-what-process-locked-a-file FileLockInfo public class Win32Processes summary Return a list of processes that hold on the given file. summary public.. filePath procs.Add process return procs summary Return a list of file locks held by the process. summary public static..
Return value from SQL Server Insert command using c# http://stackoverflow.com/questions/9319532/return-value-from-sql-server-insert-command-using-c-sharp value from SQL Server Insert command using c# Using C# in Visual..
How to pass an array into a SQL Server stored procedure http://stackoverflow.com/questions/11102358/how-to-pass-an-array-into-a-sql-server-stored-procedure dbo.SplitInts @List VARCHAR MAX @Delimiter VARCHAR 255 RETURNS TABLE AS RETURN SELECT Item CONVERT INT Item FROM SELECT Item.. @List VARCHAR MAX @Delimiter VARCHAR 255 RETURNS TABLE AS RETURN SELECT Item CONVERT INT Item FROM SELECT Item x.i.value ' ...
How to show a error message if the data is already inserted in the database in c# http://stackoverflow.com/questions/3170785/how-to-show-a-error-message-if-the-data-is-already-inserted-in-the-database-in-c 0 BEGIN SELECT @Message 'Same Employee Name Exists ' RETURN END SELECT FROM Employee WHERE empCode @empCode AND empId NOT.. 0 BEGIN SELECT @Message 'Same Employee Code Exists ' RETURN END RETURN END this checks duplication and sends back a message... SELECT @Message 'Same Employee Code Exists ' RETURN END RETURN END this checks duplication and sends back a message. Now give..
SQL Server (2008) Pass ArrayList or String to SP for IN() http://stackoverflow.com/questions/519769/sql-server-2008-pass-arraylist-or-string-to-sp-for-in as CREATE function dbo . csl_to_table @list nvarchar MAX RETURNS @list_table TABLE id INT AS BEGIN DECLARE @index INT @start_index.. @start_index AS INT INSERT @list_table id VALUES @id RETURN END Which accepts an nvarchar comma separated list of ids and..
Smoothing a hand-drawn curve http://stackoverflow.com/questions/5525665/smoothing-a-hand-drawn-curve Vector tmp Utility variable Point bezCurve new Point 4 RETURN bezier curve ctl pts nPts last first 1 Compute the A's for..
Reading a barcode using a USB barcode scanner along with ignoring keyboard data input while scanner product id and vendor id are not known http://stackoverflow.com/questions/615036/reading-a-barcode-using-a-usb-barcode-scanner-along-with-ignoring-keyboard-data 4 characters the code scanned by barcode reader ends with RETURN ENTER it take less than 50 mseconds to scan the hole barcode..
Getting return value from stored procedure in C# http://stackoverflow.com/questions/706361/getting-return-value-from-stored-procedure-in-c-sharp @Password SELECT Password FROM dbo.tblUser WHERE Login @a RETURN @b GO This compiles perfectly fine. In C# I want to execute..
|