All c# extension methods - Extension Method. Orders a list based on a sortexpression. Useful in object databinding scenarios where the objectdatasource generates a dynamic sortexpression (example: "Name desc") that specifies the property of the object sort on. C#System. Collections. Generic. IEnumerable< T> C. F. Meijers. Converts an IEnumerable< IGrouping< TKey,TValue> > to a Dictionary< TKey,List< TValue> > so that you can easily convert the results of a Group. By clause to a Dictionary of Groupings. The out- of- the- box To. Dictionary() LINQ extension methods require a key and element extractor which are largely redundant when being applied to an enumeration of groupings, so this is a short- cut. If it's the first time for you to save your datatable. Do this (using bulk copy). Assure there are no PK/FK constraint. SqlBulkCopy bulkcopy = new SqlBulkCopy. 2 Features of OraOLEDB. This chapter describes components of Oracle Provider for OLE DB (OraOLEDB) and how to use the components to develop OLE DB consumer applications.
C#System. Collections. Generic. IGrouping. James Michael Hare (Black. Rabbit. Coder). Export Data. Reader to CSV (List< String> ). Basic example that to export data to csv from a datareader. Handle value if it contains the separator and/or double quotes but can be easily be expended to include culture (date, etc..) , max errors, and more. C#System. Collections. Generic. List< string> Thierry Fierens. When building a LINQ query, you may need to involve optional filtering criteria. Avoids if statements when building predicates & lambdas for a query. Useful when you don't know at compile time whether a filter should apply. Borrowed from Andrew Robinson. V3. 6G9. C#System. Collections. Generic. IEnumerable< T> Phil Campbell. Parses the specified string value into the Enum type passed. Also contains a bool to determine whether or not the case should be ignored. C#System. Enum. Dan Atkinson. The System. Windows. Forms. Binding. Source has a property to return the current row as Data. Row. View object. But most of the time we need this as Data. Row to manipulate the data. This extension method checks the Current property of Binding. Source for nullity, returns null if it is null and returns the current Row as Data. Row object if the Current property is not null. C#System. Windows. Forms. Binding. Source. V J Reddy. Order. By() is nice when you want a consistent & predictable ordering. This method is NOT THAT! Randomize() - Use this extension method when you want a different or random order every time! Useful when ordering a list of things for display to give each a fair chance of landing at the top or bottom on each hit. C#System. Collections. Generic. IEnumerable< T> Phil Campbell. Generic- Enum- to- List_3. C0. 0_T_3. E0. 0_- converter. C#System. Enum. Joe Niland. An extension method that produce a excel file of List< T>. This would be useful if you want to automatically generate a Excel out of any other primative data type collection I provided 1 overloads of this method, that accepts a Path as string to save excel file to location on disk. C#System. Collections. Generic. IList< T> Saurabh dubey. TResult). C#System. Objectdave thieben. Computes the hash of a string using one of the following algorithms: HMAC, HMACMD5, HMACSHA1, HMACSHA2. HMACSHA3. 84, HMACSHA5. MACTriple. DES, MD5, RIPEMD1. SHA1, SHA2. 56, SHA3. SHA5. 12. C#System. String. Cosmin Pirlitu. Provides a Distinct method that takes a key selector lambda as parameter. The . net framework only provides a Distinct method that takes an instance of an implementation of IEquality. Comparer< T> where the standard parameterless Distinct that uses the default equality comparer doesn't suffice. C#System. Collections. Generic. IEnumerable< T> Martin Rosén- Lidholm. Converts an array of any type to List< T> passing a mapping delegate Func< object, T> that returns type T. If T is null, it will not be added to the collection. If the array is null, then a new instance of List< T> () is returned. C#System. Array. James Levingston. An extension method that produce a comman separated values of string out of an IEnumerable< T>. This would be useful if you want to automatically generate a CSV out of integer, string, or any other primative data type collection or array. I provided 2 overloads of this method. One of them accepts a separator and the other uses comma "," as default separator. Also I am using another shortcut extension method for foreach loop. C#System. Collections. Generic. IEnumerable< T> Muhammad Mosa. Removes any HTML or XML tags from a string. Super simple, but I didn't see anything here like it. I've created similar methods in the past to take into account things like < script> blocks, but I'm not worrying about that here. C#System. String. Jason Norris. Wraps Date. Time. Try. Parse() and all the other kinds of code you need to determine if a given string holds a value that can be converted into a Date. Time object. C#System. String. Phil Campbell. Using IOControl code to configue socket Keep. Alive. Values for line disconnection detection(because default is toooo slow). C#System. Net[T] Nep. Tunic. Forces your browser to download any kind of file instead of trying to open it inside the browser (e. Works in Chrome, Opera, Firefox and IE 7 & 8! C#System. Response. Mikhail Tsennykh. Extension for simplify usage of Xml. Serializer class. Add extension to any object serialize it to xml. Add extension to string and stream to deserialize objects. All extensions with first check about default constructor. C#System. Object. Wa. Sa. Ma. Sa. Returns the first few characters of the string with a length specified by the given parameter. If the string's length is less than the given length the complete string is returned. If length is zero or less an empty string is returned. C#System. String. C. F. Meijers. Log Share. Point Exception via SPDiagnostics. Service for Debugging (result : 0. Unexpected My Method Name : Attempted to divide by zero. 2. C#voidhttp: //mb- seifollahi. Json Conversion, uses Data. Contract. Json. Serializer to deserialize item. C#TArek Bal. Two methods that extends Data. Grid. View control to save and load columns configuration to specified XML file. More informations (in Polish, example in English) at. C#System. Windows. Forms. Data. Grid. View. Marcin Kozub. Recursively create directory based on the given path. If the given path doesn't exist, it will create until all the folders in the path are satisfied. C#System. IOEarljon Hidalgo. Returns the range of elements between the specified start and end indexes. Negative numbers count from the end, rather than the start, of the sequence. Values of 'end' larger than the actual sequence are truncated and do not cause index- out- of- bounds exceptions. Functionally very similar to Python's list[x: y] slices. C#System. Collections. Generic. IEnumerable< T> Joe Smith. This is extension method for format the data time into the string with pattern specific and current culture. For more information please read at my blog http: //weblogs. C#System. Date. Timethangchung. Checks to see if a string represents a valid GUID. Source of the function. Original code at https: //connect. Visual. Studio/feedback/View. Feedback. aspx? Feedback. ID=9. 40. 72& wa=wsignin. C#System. String. Gaston Verelst. Since System. Linq. Enumerable. Aggregate throws a System. Invalid. Operation. Exception in case the given list is empty you can't use this function in a complex linq expression. This aggregate version simply returns a defaultvalue if the list is empty. C#System. Collections. Generic. IEnumerable< T> RW. Determines if a string is a valid ISIN (International Securities Identification Number) code. C#System. String. JP Negri. A modification to the Add. Day function that adds an integer number of weekdays to a date, starting the count at the first weekday after the current day. This is a typical method for calculating B2. B service delivery and billing due dates. C#System. Date. Time. Lee Harding. Is essentially a modified version of Type. Is. Sub. Class. Of that supports checking whether a class derives from a generic base- class without specifying the type parameters. For instance, it supports typeof(List< > ) to see if a class derives from the List< T> class. The actual code was borrowed from http: //stackoverflow. C#System. Type. Dennis Doomen. Serializes objects to an xml string. Does not provide error handling if the object is not serializable.). C#System. Objectasawyer. Provides an overload to String. Contains to specify a String. Comparison (i. e. C#System. String. Brian Dukes. Date. Diff in SQL style. The following Date. Parts are implemented. C#System. Date. Time. Jonnidip. Converts an Array of arbitrary type to an array of type T. How to insert a data table into SQL Server database table? If it's the first time for you to save your datatable. Do this (using bulk copy). Assure there are no PK/FK constraint. Sql. Bulk. Copy bulkcopy = new Sql. Bulk. Copy(my. Connection). I assume you have created the table previously. Someone else here already showed how. Destination. Table. Name = table. Table. Name. try. {. bulkcopy. Write. To. Server(table). Exception e). messagebox. Now since you already have a basic record. And you just want to check new record with the existing one. You can simply do this. This will basically take existing table from database. Data. Table Table = new Data. Table(). Sql. Connection Connection = new Sql. Connection("Connection. String"). //I assume you know better what is your connection string. Sql. Data. Adapter adapter = new Sql. Data. Adapter("Select * from " + Table. Name, Connection). Fill(Table). Then pass this table to this functionpublic Data. Table Compare. Data. Tables(Data. Table first, Data. Table second). first. Table. Name = "First. Table". second. Table. Name = "Second. Table". Data. Table table = new Data. Table("Difference"). Data. Set ds = new Data. Set()). ds. Tables. Add. Range(new Data. Table[] { first. Copy(), second. Copy() }). Data. Column[] firstcolumns = new Data. Column[ds. Tables[0]. Columns. Count]. for (int i = 0; i < firstcolumns. Length; i++). firstcolumns[i] = ds. Tables[0]. Columns[i]. Data. Column[] secondcolumns = new Data. Column[ds. Table[1]. Columns. Count]. for (int i = 0; i < secondcolumns. Length; i++). secondcolumns[i] = ds. Tables[1]. Columns[i]. Data. Relation r = new Data. Relation(string. Empty, firstcolumns, secondcolumns, false). Relations. Add(r). Columns. Count; i++). Columns. Add(first. Columns[i]. Column. Name, first. Columns[i]. Data. Type). table. Begin. Load. Data(). Data. Row parentrow in ds. Tables[0]. Rows). Data. Row[] childrows = parentrow. Get. Child. Rows(r). Length == 0). table. Load. Data. Row(parentrow. Item. Array, true). End. Load. Data(). Exception ex). throw ex. This will return a new Data. Table with the changed rows updated. Please ensure you call the function correctly. The Data. Table first is supposed to be the latest. Then repeat the bulkcopy function all over again with this fresh datatable.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
September 2018
Categories |