c# Programming Glossary: foos
C# Performance of nested yield in a tree http://stackoverflow.com/questions/1043050/c-sharp-performance-of-nested-yield-in-a-tree implementation I returned a List and added the child foos using List.AddRange . My question is if the version using yield..
Replace parameter in lambda expression http://stackoverflow.com/questions/11159697/replace-parameter-in-lambda-expression a get set public int b get set private void Test List Foo foos new List Foo foos.Add new Foo foos.Add new Foo Expression Func.. int b get set private void Test List Foo foos new List Foo foos.Add new Foo foos.Add new Foo Expression Func Foo int exp0 f.. void Test List Foo foos new List Foo foos.Add new Foo foos.Add new Foo Expression Func Foo int exp0 f f.a f.b Expression..
Remove element of a regular array http://stackoverflow.com/questions/457453/remove-element-of-a-regular-array improve this question If you don't want to use List var foos new List Foo array foos.RemoveAt index return foos.ToArray You.. If you don't want to use List var foos new List Foo array foos.RemoveAt index return foos.ToArray You could try this extension.. var foos new List Foo array foos.RemoveAt index return foos.ToArray You could try this extension method that I haven't actually..
ReadOnlyCollection or IEnumerable for exposing member collections? http://stackoverflow.com/questions/491375/readonlycollection-or-ienumerable-for-exposing-member-collections over the collection class Bar private ICollection Foo foos Which one is to be preferred public IEnumerable Foo Foos ..... simple call to Skip public IEnumerable Foo Foos get return foos.Skip 0 There are plenty of other options for wrapping trivially..
Convert generic List/Enumerable to DataTable? http://stackoverflow.com/questions/564366/convert-generic-list-enumerable-to-datatable t watch.ElapsedMilliseconds static void Main List MyData foos new List MyData for int i 0 i 5000 i foos.Add new MyData just.. List MyData foos new List MyData for int i 0 i 5000 i foos.Add new MyData just gibberish... A i B i.ToString C DateTime.Now.AddSeconds.. C DateTime.Now.AddSeconds i D i E hello F i 2 RunTest foos Vanilla Hyper.ComponentModel.HyperTypeDescriptionProvider.Add..
When are structs the answer? http://stackoverflow.com/questions/597259/when-are-structs-the-answer this in action modify the code above to use an array of foos and bars. You'll find that the performance is more or less equal...
MVC3 Razor recursive function http://stackoverflow.com/questions/6422895/mvc3-razor-recursive-function with the @helper keyword. @helper ShowTree IEnumerable Foo foos ul @foreach var foo in foos li @foo.Title @if foo.Children.Any.. ShowTree IEnumerable Foo foos ul @foreach var foo in foos li @foo.Title @if foo.Children.Any @ShowTree foo.Children..
Do asynchronous operations in ASP.NET MVC use a thread from ThreadPool on .NET 4 http://stackoverflow.com/questions/8743067/do-asynchronous-operations-in-asp-net-mvc-use-a-thread-from-threadpool-on-net-4 _context.Foos .ContinueWith t AsyncManager.Parameters foos t.Result AsyncManager.OutstandingOperations.Decrement Task.. public ViewResult IndexCompleted IEnumerable Foo foos IEnumerable Bar bars IEnumerable FooBar foobars Do the regular..
LINQ to XML Newbie: Moving Nodes From One Node To Another http://stackoverflow.com/questions/927350/linq-to-xml-newbie-moving-nodes-from-one-node-to-another You need to get Foo sections 2 and 3 with a query like var foos from xelem in root.Descendants Foo where xelem.Attribute id.. correct place on the tree. Here's a complete solution var foos from xElem in xDoc.Root.Descendants Foo where xElem.Attribute.. id .Value C select xElem .Single foreach var xElem in foos xElem.Remove newParentElem.Add xElem After that your xDoc..
EF 5 Conditional Mapping http://stackoverflow.com/questions/19246067/ef-5-conditional-mapping these with this.CreateDeleteProcedure dbo.Foo_Delete dbo . Foos which is a call to my own extension method public static class..
Is it better to return null or empty collection? http://stackoverflow.com/questions/1969993/is-it-better-to-return-null-or-empty-collection set your property once and forget it public List Foo Foos public get private set public Bar Foos new List Foo When talking.. it public List Foo Foos public get private set public Bar Foos new List Foo When talking about methods that return enumerables.. array instead of null ... public IEnumerable Foo GetMyFoos return InnerGetFoos new Foo 0 If you're concerned about efficiency.....
Why is it important to override GetHashCode when Equals method is overridden? http://stackoverflow.com/questions/371328/why-is-it-important-to-override-gethashcode-when-equals-method-is-overridden the Equals method because Foo represent a row for the Foos table. Which is the preferred method for overriding the GetHashCode..
ReadOnlyCollection or IEnumerable for exposing member collections? http://stackoverflow.com/questions/491375/readonlycollection-or-ienumerable-for-exposing-member-collections foos Which one is to be preferred public IEnumerable Foo Foos ... public ReadOnlyCollection Foo Foos ... Calling code foreach.. IEnumerable Foo Foos ... public ReadOnlyCollection Foo Foos ... Calling code foreach var f in bar.Foos DoSomething f As.. Foo Foos ... Calling code foreach var f in bar.Foos DoSomething f As I see it IEnumerable is a subset of the interface..
Dictionary<T> of List<T> and ListViews in ASP.NET http://stackoverflow.com/questions/583689/dictionaryt-of-listt-and-listviews-in-asp-net get set protected void DataBindFooList List int SelectedFoos System.Web.UI.WebControls.ListView lv lvFooList try Dictionary.. new Dictionary Foo List Bar foreach int Foo in SelectedFoos Build List of Foos to add as Dictionary.Keys fooDictionary.Add.. List Bar foreach int Foo in SelectedFoos Build List of Foos to add as Dictionary.Keys fooDictionary.Add fooScalar Bar ..
Are delegates not just shorthand interfaces? http://stackoverflow.com/questions/95954/are-delegates-not-just-shorthand-interfaces int x return x 0 Now we can toss around Bar and Baz as a Foos and call their Func methods. Delegates simplify this a little..
Can You Loop Through All Enum Values? [duplicate] http://stackoverflow.com/questions/972307/can-you-loop-through-all-enum-values here How to enumerate an enum 14 answers public enum Foos A B C Is there a way to loop through the possible values of.. the possible values of Foo Basically foreach Foo in Foos c# .net enums language features share improve this question.. use the GetValues method var values Enum.GetValues typeof Foos Or the typed version var values Enum.GetValues typeof Foos .Cast..
|