Questions tagged [global-methods]

9 questions
47
votes
6 answers

ReactJs Global Helper Functions

Issue: I have a lot of small helper functions that don't necessarily need to live in a component(or maybe they can but they will make that component bloated with a lot of code).My lazy side just wants to just let those all just be some sort of…
Nick Pineda
  • 6,354
  • 11
  • 46
  • 66
4
votes
2 answers

Global methods?

This MSDN page mentions global methods in a module. Module.GetMethods "returns the global methods defined on the module." I wasn't aware there were global methods. The only thing I can think of is that this only applies to languages that allow…
richard
  • 12,263
  • 23
  • 95
  • 151
1
vote
3 answers

Fluent Interface, Need something like global methods in C#

Im currently trying to build a Fluent Interface for a ServiceLocator. To ensure that each the developer can easily setup 1-to-n mappings I'd like something like this ServiceLocator.Instance.For(Use(), Use()); Singleton is workin…
Thorsten Hans
  • 2,675
  • 19
  • 21
1
vote
3 answers

Global methods in C# ASP.Net

I´m using C# and ASP.NET for developing in Windows Azure. I want to do a global Method to validate fields, my idea is to do a global Method like (for example in Site.Master) static Regex dateRegex = new Regex("^\\d{2}/\\d{2}/\\d{4}$"); public…
vlopezla
  • 95
  • 1
  • 15
0
votes
1 answer

Laravel global access with polymorphic relations

In my application I have two columns employable_id && employable_type in almost every table, which are used for storing the information about the user who has created the record. Something like this: subscribers: …
Mr.Singh
  • 1,421
  • 6
  • 21
  • 46
0
votes
3 answers

A global method that finds the average, and the highest speed of cars

I created the Car class with attributes and properties. In the main part of the program, I created a series of cars and initialized the values. My program should use the global method to find the fastest car and average speed of all cars, the…
Jakobson
  • 101
  • 1
  • 2
  • 10
0
votes
1 answer

Why is a private method always called when a global method with same name exists in JavaScript?

I have some sample code in JavaScript as below. When the button is clicked then the private method by the name of doSomething of object xyz is always called, even though a method of same name exists at the global level. I am trying to understand…
Sunil
  • 20,653
  • 28
  • 112
  • 197
0
votes
4 answers

Python: Calling Methods from a Method

I've been trying to make a soccer game using Python. Most of the problems I've run into I've been able to find a way around. However, I'm getting stuck on the error "global name '---' not defined", referring to a method name. From what I've seen,…
user2869231
  • 1,431
  • 5
  • 24
  • 53
-2
votes
3 answers

Java - Global variables vs Global methods

I was looking into a project whit 5000+ classes, then I see this in each class: private static int foo = 1; private static void setfoo(int value) { foo = value; } private static int getfoo() { return foo; } so, I think why dont use a…
Marcos Eusebi
  • 617
  • 7
  • 17