tagged [methods]

Array containing Methods

Array containing Methods I was wondering if you can create an Array or a List that contains methods. I don't want to use a switch or lots of if statements. Thanks

10 Oct at 11:41

C#: Function in Function possible?

C#: Function in Function possible? Is it possible to declare a method within another method in C#? For example like that:

16 Apr at 18:8

Static methods in Python?

Static methods in Python? Can I define a [static method](https://en.wikipedia.org/wiki/Method_(computer_programming)#Static_methods) which I can call directly on the class instance? e.g.,

29 Nov at 00:11

Method access in Ruby

Method access in Ruby How is it that Ruby allows a class access methods outside of the class implicitly? Example:

1 Oct at 05:59

Are Method Attributes Inherited in C#?

Are Method Attributes Inherited in C#? Are attributes applied to an abstract method in a base class applied to the overridden versions in the child classes? I hope the question is clear enough without...

14 Jul at 05:24

Calculating Count for IEnumerable (Non Generic)

Calculating Count for IEnumerable (Non Generic) Can anyone help me with a `Count` extension method for `IEnumerable` (non generic interface). I know it is not supported in LINQ but how to write it man...

Is it possible to implement mixins in C#?

Is it possible to implement mixins in C#? I've heard that it's possible with extension methods, but I can't quite figure it out myself. I'd like to see a specific example if possible. Thanks!

1 Nov at 05:14

FindAll vs Where extension-method

FindAll vs Where extension-method I just want know if a "FindAll" will be faster than a "Where" extentionMethod and why? Example : or Which is better ?

7 Oct at 14:17

Why is Main method private?

Why is Main method private? New console project template creates a Main method like this: Why is it that neither the `Main` method nor the `Program` class need to be public?

24 Jun at 14:52

Set and Get Methods in java?

Set and Get Methods in java? How can I use the set and get methods, and why should I use them? Are they really helpful? And also can you give me examples of set and get methods?

C++/CLI : How do I declare abstract (in C#) class and method in C++/CLI?

C++/CLI : How do I declare abstract (in C#) class and method in C++/CLI? What is the equivalent of the following C# code in C++/CLI?

What's a "static method" in C#?

What's a "static method" in C#? What does it mean when you add the static keyword to a method? Can you add the `static` keyword to class? What would it mean then?

2 Apr at 00:7

How to check whether an object has certain method/property?

How to check whether an object has certain method/property? Using dynamic pattern perhaps? You can call any method/property using the dynamic keyword, right? How to check whether the method exist befo...

13 Aug at 14:7

How do I Unregister 'anonymous' event handler

How do I Unregister 'anonymous' event handler Say if I listen for an event: Now how do I un-register this event? Or just allow the memory to leak?

Static Method of a Static Class vs. Static Method of a Non-Static Class ( C# )

Static Method of a Static Class vs. Static Method of a Non-Static Class ( C# ) I was asked the above question in an interview. Could you please explain the differences? ( performance - memory - usage ...

15 Feb at 16:33

Why use TagBuilder instead of StringBuilder?

Why use TagBuilder instead of StringBuilder? what's the difference in using tag builder and string builder to create a table in a htmlhelper class, or using the HtmlTable? aren't they generating the s...

Can two Java methods have same name with different return types?

Can two Java methods have same name with different return types? Can two Java methods have the with different ? The return type of the methods are different and they are declared with the same method'...

8 Feb at 18:48

why allow extension methods on null objects?

why allow extension methods on null objects? what is the point of allowing invocation of extension methods on null objects? this is making me unnecessarily check for a null object in the extension met...

28 Mar at 13:9

Passing a function as parameter

Passing a function as parameter I need a way to define a method in c# like this: Let f1 is: is there any way to do this?

11 Aug at 22:20

Disadvantages of extension methods?

Disadvantages of extension methods? Extension method is a really helpful feature that you can add a lot of functions you want in any class. But I am wondering if there is any disadvantage that might b...

21 Mar at 10:45

F# extension methods in C#

F# extension methods in C# If you were to define some extension methods, properties in an assembly written in F#, and then use that assembly in C#, would you see the defined extensions in C#? If so, t...

12 Mar at 05:28

Extension Method in C# 2.0

Extension Method in C# 2.0 What namespace do I need to get my extension to work Here is my Extension Method When I try to use it in like this it doesn't work. This is .net 2.0

1 Apr at 20:9

Safe method to get value of nested dictionary

Safe method to get value of nested dictionary I have a nested dictionary. Is there only one way to get values out safely? Or maybe python has a method like `get()` for nested dictionary ?

4 Mar at 09:41

Extension methods conflict

Extension methods conflict Lets say I have 2 extension methods to string, in 2 different namespaces: ``` namespace test1 { public static class MyExtensions { public static int TestMethod(this...

ReSharper complains when method can be static, but isn't

ReSharper complains when method can be static, but isn't Why does ReSharper complain when a method can become static, but is not? Is it because only one instance of a static method is created (on the ...

28 Aug at 10:56