This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // récupération de la liste de tous les fonds à partir du web service | |
| AlterCodificationClient client = new AlterCodificationClient(); | |
| List<AcfundsDTO> funds = client.AllFunds().ToList<AcfundsDTO>(); | |
| // tri alphabétique croissant | |
| funds.Sort((Comparison<AcfundsDTO>)delegate(AcfundsDTO a, AcfundsDTO b) | |
| { return a.aftrkname.CompareTo(b.aftrkname); }); | |
| // afficher le contenu de la liste triée | |
| foreach (AcfundsDTO item in funds) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if(obj == null){ | |
| obj = new Obj(); | |
| } | |
| return obj; | |
| // peut être remplacé par | |
| return obj = obj ?? new Obj(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Permet de savoir si une valeur de type int contient 0, MinValue ou MaxVaue | |
| public static bool IsZeroOrEmpty(this int value) | |
| { | |
| return ((value == 0) || (value == int.MinValue) || (value == int.MaxValue)); | |
| } | |
| // Activer le double buffering d'un DatagridView | |
| public static void DoubleBuffered(this DataGridView dgv, bool setting) | |
| { | |
| Type type = dgv.GetType(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The LasyList<T> only works with an IQueryable<T> source. It is an implementation of IList<T> and works by populating a private List with all results from the specified IQueryable<T>. The initialization occurs the first time you access any of the IList<T> members. | |
| Example usage would be | |
| var myList = new LazyList(products.Where(p => p.Name.StartsWith("T")); | |
| //initialization occurs here | |
| Console.Write(myList.Count); | |
| The System.Lazy<T> class works with any type and is not limited to IQueryable<T>. Lazy initialization occurs the first time the Lazy<T>.Value property is accessed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for /R %%i in (.svn) do rd /S /Q "%%i" | |
| pause |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Threading; | |
| /// <summary> | |
| /// A class demonstrating how to use timed locks. | |
| /// </summary> | |
| class TimedLockDemo | |
| { | |
| /// <summary> | |
| /// Private resource, used to demonstrate the timed lock. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static object[,] ConvertToMultiDimArray<T>(T[] datasource) | |
| { | |
| if (datasource != null) | |
| { | |
| Type t = typeof(T); | |
| PropertyInfo[] pi = t.GetProperties(); | |
| object[,] r = new object[datasource.Length, pi.Length]; | |
| for (int row = 0; row < datasource.Length; row++) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); | |
| string resourceName = @"<<namespace + full path>>.mail.html"; | |
| string mailbody = string.Empty; | |
| using (Stream stream = assembly.GetManifestResourceStream(resourceName)) | |
| { | |
| using (StreamReader sr = new StreamReader(stream)) | |
| { | |
| mailbody = sr.ReadToEnd(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static void Main(string[] args) | |
| { | |
| Stopwatch sw = new Stopwatch(); | |
| sw.Start(); | |
| bulkCopy("dbo.table1", "dbo.table2"); | |
| sw.Stop(); | |
| Console.WriteLine("Elapsed={0}", sw.Elapsed); | |
| Console.Read(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- conversion RAW DATE en DATE | |
| DECLARE dt DATE := NULL; | |
| BEGIN | |
| DBMS_STATS.CONVERT_RAW_VALUE('7871081A010101', dt); | |
| DBMS_OUTPUT.put_line(to_char(dt,'DD-MON-YYYY')); | |
| END; | |
| / |
OlderNewer