¡@

Home 

c# Programming Glossary: select

LINQ query on a DataTable

http://stackoverflow.com/questions/10855/linq-query-on-a-datatable

from myRow in myDataTable where results.Field RowNo 1 select results This is not allowed. Any ideas how to get something.. in myDataTable.AsEnumerable where myRow.Field int RowNo 1 select myRow And as Keith says you'll need to add a reference to System.Data.DataSetExtensions..

How to create and connect custom user buttons/controls with lines using windows forms

http://stackoverflow.com/questions/15819318/how-to-create-and-connect-custom-user-buttons-controls-with-lines-using-windows

enables clicking and dragging. The connectors can also be selected and show a nice animation when they are. The left panel allows.. they are. The left panel allows edition of the currently selected object's values. The functionality of the UI is completely.. a little red square shaped Thumb that will appear when you select click on a Connector visible in the screenshot that will allow..

Randomize a List<T> in C#

http://stackoverflow.com/questions/273313/randomize-a-listt-in-c-sharp

above uses the much criticised System.Random method to select swap candidates. It's fast but not as random as it should be...

How to force my .NET App to run as administrator on Windows 7?

http://stackoverflow.com/questions/2818179/how-to-force-my-net-app-to-run-as-administrator-on-windows-7

This works on VS2008 and higher Project Add New Item select Application Manifest File . Change the requestedExecutionLevel..

Returning IEnumerable<T> vs IQueryable<T>

http://stackoverflow.com/questions/2876616/returning-ienumerablet-vs-iqueryablet

Customer custs from c in db.Customers where c.City City select c IEnumerable Customer custs from c in db.Customers where c.City.. Customer custs from c in db.Customers where c.City City select c Will both be deferred execution When should one be preferred.. custs.Where c c.IsGold That code will execute SQL to only select gold customers. The following code on the other hand will execute..

Is there a string math evaluator in .NET?

http://stackoverflow.com/questions/355062/is-there-a-string-math-evaluator-in-net

a COM object. In the Add reference dialog of the project select the COM tab and scroll down to Microsoft Script Control 1.0..

Performance differences between debug and release builds

http://stackoverflow.com/questions/4043821/performance-differences-between-debug-and-release-builds

because it has so few registers to work with. Having it select the right ones is critical to perf. These are very important..

Best practice to save application settings in a Windows Forms Application

http://stackoverflow.com/questions/453161/best-practice-to-save-application-settings-in-a-windows-forms-application

need to set the scope property of your settings. If you select Application scope then Settings.Default. your property will..

The entity cannot be constructed in a LINQ to Entities query

http://stackoverflow.com/questions/5325797/the-entity-cannot-be-constructed-in-a-linq-to-entities-query

from p in db.Products where p.CategoryID categoryID select new Product Name p.Name The code below throws the following.. productRepository.GetProducts 1 .Tolist But when I use select p instead of select new Product Name p.Name it works correctly... 1 .Tolist But when I use select p instead of select new Product Name p.Name it works correctly. How can I preform..

Random row from Linq to Sql

http://stackoverflow.com/questions/648196/random-row-from-linq-to-sql

where row.IsActive your filter orderby ctx.Random select row .FirstOrDefault Note that this is only suitable for small.. var qry from row in ctx.Customers where row.IsActive select row int count qry.Count 1st round trip int index new Random..

LINQ to read XML

http://stackoverflow.com/questions/670563/linq-to-read-xml

data.xml var lv1s from lv1 in xdoc.Descendants level1 select lv1.Attribute name .Value foreach var lv1 in lv1s result.AppendLine.. Run query var lv1s from lv1 in xdoc.Descendants level1 select new Header lv1.Attribute name .Value Children lv1.Descendants..

Is it possible to dynamically compile and execute C# code fragments?

http://stackoverflow.com/questions/826398/is-it-possible-to-dynamically-compile-and-execute-c-sharp-code-fragments

args var q from i in Enumerable.Range 1 100 where i 2 0 select i results.Errors.Cast CompilerError .ToList .ForEach error..

LINQ to SQL - Left Outer Join with multiple join conditions

http://stackoverflow.com/questions/1122942/linq-to-sql-left-outer-join-with-multiple-join-conditions

the following SQL which I am trying to translate to LINQ SELECT f.value FROM period as p LEFT OUTER JOIN facts AS f ON p.id.. 17 select f.value seems to be equivalent to this SELECT f.value FROM period as p LEFT OUTER JOIN facts AS f ON p.id..

Excel “External table is not in the expected format.”

http://stackoverflow.com/questions/1139390/excel-external-table-is-not-in-the-expected-format

the file without having to open it first Thanks string sql SELECT FROM Sheet1 string excelConnection Provider Microsoft.Jet.OLEDB.4.0..

Detect Antivirus on Windows using C#

http://stackoverflow.com/questions/1331887/detect-antivirus-on-windows-using-c-sharp

searcher new ManagementObjectSearcher wmipathstr SELECT FROM AntivirusProduct ManagementObjectCollection instances searcher.Get..

Create Excel (.XLS and .XLSX) file from C# [closed]

http://stackoverflow.com/questions/151005/create-excel-xls-and-xlsx-file-from-c-sharp

fill the data table with the data from the DB string sql SELECT Whatever FROM MyDBTable OleDbCommand cmd new OleDbCommand sql..

Are there good reasons not to use an ORM? [closed]

http://stackoverflow.com/questions/194147/are-there-good-reasons-not-to-use-an-orm

I could just build my data access layer with a lot of SELECT s etc but here I miss the advantage of automatic joins lazy.. a new column or a column gets renamed. Updating numerous SELECT INSERT and UPDATE queries vs. updating the mapping config and..

.NET Process Monitor

http://stackoverflow.com/questions/1986249/net-process-monitor

startWatch new ManagementEventWatcher new WqlEventQuery SELECT FROM Win32_ProcessStartTrace startWatch.EventArrived new EventArrivedEventHandler.. stopWatch new ManagementEventWatcher new WqlEventQuery SELECT FROM Win32_ProcessStopTrace stopWatch.EventArrived new EventArrivedEventHandler..

How to get Printer Info in .NET?

http://stackoverflow.com/questions/296182/how-to-get-printer-info-in-net

printerName YourPrinterName string query string.Format SELECT from Win32_Printer WHERE Name LIKE ' 0 ' printerName ManagementObjectSearcher..

Can't get sql server compact 3.5 / 4 to work with ASP .NET MVC 2

http://stackoverflow.com/questions/3223359/cant-get-sql-server-compact-3-5-4-to-work-with-asp-net-mvc-2

conn.Open using SqlCeCommand cmd new SqlCeCommand SELECT TOP 1 Category Name FROM Categories conn string valueFromDb..

How to get last inserted id?

http://stackoverflow.com/questions/5228780/how-to-get-last-inserted-id

aspnet_GameProfiles UserId GameId VALUES @UserId @GameId SELECT SCOPE_IDENTITY And then Int32 newId Int32 myCommand.ExecuteScalar..

Parameterized Query for MySQL with C#

http://stackoverflow.com/questions/652978/parameterized-query-for-mysql-with-c-sharp

are all relevant sections private String readCommand SELECT LEVEL FROM USERS WHERE VAL_1 AND VAL_@ public bool read string.. question Try this instead private String readCommand SELECT LEVEL FROM USERS WHERE VAL_1 @param_val_1 AND VAL_2 @param_val_2..

LINQ - Left Join, Group By, and Count

http://stackoverflow.com/questions/695506/linq-left-join-group-by-and-count

Left Join Group By and Count Let's say I have this SQL SELECT p.ParentId COUNT c.ChildId FROM ParentTable p LEFT OUTER JOIN..

C# AutoComplete

http://stackoverflow.com/questions/796195/c-sharp-autocomplete

Any advice EDIT Here is the query that returns the results SELECT Name from view_customers where Details LIKE ' 0 ' With 0 being..

.NET Events for Process executable start

http://stackoverflow.com/questions/848618/net-events-for-process-executable-start

string processName string queryString SELECT TargetInstance FROM __InstanceCreationEvent WITHIN 10 WHERE.. WatchForProcessEnd string processName string queryString SELECT TargetInstance FROM __InstanceDeletionEvent WITHIN 10 WHERE..

Get installed applications in a system

http://stackoverflow.com/questions/908850/get-installed-applications-in-a-system

ManagementObjectSearcher mos new ManagementObjectSearcher SELECT FROM Win32_Product foreach ManagementObject mo in mos.Get Console.WriteLine..

ExecuteReader requires an open and available Connection. The connection's current state is Connecting

http://stackoverflow.com/questions/9705637/executereader-requires-an-open-and-available-connection-the-connections-curren

SqlCommand sql SqlCommandConnection sql.CommandText SELECT TOP 1 PromotionID PromotionTitle PromotionURL FROM Promotion.. new SqlConnection connectionString var queryString SELECT PromotionID PromotionTitle PromotionURL FROM Promotion WHERE..

WIN32_Processor::Is ProcessorId Unique for all computers

http://stackoverflow.com/questions/1101772/win32-processoris-processorid-unique-for-all-computers

searcher new ManagementObjectSearcher Select FROM WIN32_Processor ManagementObjectCollection mObject searcher.Get..

Preserving order with LINQ

http://stackoverflow.com/questions/204505/preserving-order-with-linq

by index to a result element AsEnumerable Cast Concat Select ToArray ToList Preserves Order. Elements are filtered but not.. elements the order of the matching elements of inner. SelectMany for each element of source selector is invoked and a sequence..

How to deal with XML in C#

http://stackoverflow.com/questions/220867/how-to-deal-with-xml-in-c-sharp

People Person Name 'Nick' Person Name 'Joe' People Select a single node XmlNode node document.SelectSingleNode People.. 'Joe' People Select a single node XmlNode node document.SelectSingleNode People Person @Name 'Nick' Select a list of nodes.. node document.SelectSingleNode People Person @Name 'Nick' Select a list of nodes XmlNodeList nodes document.SelectNodes People..

Get List of connected USB Devices

http://stackoverflow.com/questions/3331043/get-list-of-connected-usb-devices

using var searcher new ManagementObjectSearcher @ Select From Win32_USBHub collection searcher.Get foreach var device..

Open Folder and Select the file

http://stackoverflow.com/questions/334630/open-folder-and-select-the-file

Folder and Select the file the following code produces a file not found exception... explorer.exe select listView1.SelectedItems 0 .SubItems 1 .Text listView1.SelectedItems 0 .Text how.. listView1.SelectedItems 0 .SubItems 1 .Text listView1.SelectedItems 0 .Text how can I get this command to execute in c# ..

Where can I find a Java to C# converter?

http://stackoverflow.com/questions/443010/where-can-i-find-a-java-to-c-sharp-converter

with at least Visual Studio 2005 Standard Edition. Select File Open Convert Java Language Conversion Assistant. Remember..

Best practice to save application settings in a Windows Forms Application

http://stackoverflow.com/questions/453161/best-practice-to-save-application-settings-in-a-windows-forms-application

on the project in Solution Explorer choose Properties. Select the Settings tab click on the hyperlink if settings doesn't..

ReadOnlyCollection or IEnumerable for exposing member collections?

http://stackoverflow.com/questions/491375/readonlycollection-or-ienumerable-for-exposing-member-collections

for wrapping trivially the nice thing about Skip over Select Where is that there's no delegate to execute pointlessly for..

LINQ Select Distinct with Anonymous Types

http://stackoverflow.com/questions/543482/linq-select-distinct-with-anonymous-types

Select Distinct with Anonymous Types So I have a collection of objects... a pair of particular properties thusly myObjectCollection.Select item new Alpha item.propOne Bravo item.propTwo .Distinct..

Parsing SQL code in C# [duplicate]

http://stackoverflow.com/questions/589096/parsing-sql-code-in-c-sharp

EntityCommand cmd conn.CreateCommand cmd.CommandText @ Select t.MyValue From MyEntities.MyTable As t var queryExpression cmd.Expression..

How to create LINQ Expression Tree with anonymous type in it

http://stackoverflow.com/questions/606104/how-to-create-linq-expression-tree-with-anonymous-type-in-it

so take it for what it's worth 'it works on my box' 0. The SelectdDynamic method class should be tossed in a static extension.. good on late bound data controls. public static IQueryable SelectDynamic this IQueryable source IEnumerable string fieldNames.. IEnumerable MemberBinding bindings dynamicType.GetFields .Select p Expression.Bind p Expression.Property sourceItem sourceProperties..

Make an Installation program for C# applications and include .NET Framework installer into the setup

http://stackoverflow.com/questions/6090913/make-an-installation-program-for-c-sharp-applications-and-include-net-framework

Create setup project. You can use Setup Wizard. Select project type. Select output. Hit Finish. Open setup project.. project. You can use Setup Wizard. Select project type. Select output. Hit Finish. Open setup project properties. Chose to..

Display lines number in Stack Trace for .NET assembly in Release mode

http://stackoverflow.com/questions/628565/display-lines-number-in-stack-trace-for-net-assembly-in-release-mode

trace line numbers. Click on the Build vertical tab . Select Release configuration. Check the DEBUG constant parameter. Uncheck..

How do I determine the owner of a process in C#?

http://stackoverflow.com/questions/777548/how-do-i-determine-the-owner-of-a-process-in-c

public string GetProcessOwner int processId string query Select From Win32_Process Where ProcessID processId ManagementObjectSearcher.. string GetProcessOwner string processName string query Select from Win32_Process Where Name processName ManagementObjectSearcher..

Efficient DataTable Group By

http://stackoverflow.com/questions/8472005/efficient-datatable-group-by

MemberIDCount 1 3 2 2 If it were SQL I could just do Select TeamID Count From Table Group By TeamID but in my application..

How to create and use resources in .NET

http://stackoverflow.com/questions/90697/how-to-create-and-use-resources-in-net

to add a resource to. Do this in the Solution Explorer. Select the Properties option from the list. Click the Resources tab...

Difference Between Select and SelectMany

http://stackoverflow.com/questions/958949/difference-between-select-and-selectmany

Between Select and SelectMany I've been searching the difference between those.. Between Select and SelectMany I've been searching the difference between those two but.. give a LINQ TO SQL Example to show the difference between Select and Select Many. c# linq to sql linq share improve this question..