Skip to main content
Advice
0 votes
2 replies
85 views

Following is a part of the execution sequence when a middleware gets configured in ASP.NET Core - // my code app.Use(some middleware); // class UseExtensions / namespace Microsoft.AspNetCore.Builder ...
atiyar's user avatar
  • 8,405
2 votes
1 answer
121 views

I'd like to have a class with a bunch of optional methods derived from some type, then implement some of those in some subclasses: type OptionalPrototypeMethods = { f(): number, } interface Cls ...
Blue Nebula's user avatar
  • 1,246
5 votes
1 answer
82 views

While methods are usually defined inside the class block with def func(self, ...):, this is not required: def method(self): return self.x class Foo: def __init__(self, x): self.x = x ...
Daniel Walker's user avatar
Advice
0 votes
4 replies
113 views

I have a question about how try/finally behaves when using return statements in C#. Consider the following methods: public int Test() { return 12; } public int Test2() { try { ...
Colin's user avatar
  • 41
-8 votes
1 answer
151 views

I have this method in my program, it is meant to register the gender of the user for later on in the program (with Male and Female as the only valid options): public static void Main(string[] args) { ...
Matto's user avatar
  • 1
-7 votes
1 answer
105 views

In a class that has a bunch of functions, should I be making a separate private method specifically for formatting or should I just be formatting in every function that requires a string to be ...
Fatko's user avatar
  • 1
3 votes
1 answer
66 views

I'm using typescript in a project which uses BackboneJS and in a certain case, a method overload gets lost. I narrowed it down to this case: class Model { set<A extends string>(key: A, value: ...
Sjaak Voz's user avatar
0 votes
1 answer
64 views

I would like that method redefenition would result in failure and script execution stop. Like any other common error. In the following example I want to see that method print cannot be redefined. oo::...
Sterling7135's user avatar
3 votes
1 answer
204 views

In Java we have toArray() method which will return Object[]. If I want to return another data type I need to pass it to parameters like this SomeClass.SomeList.toArray(new AnotherClass[0]); What does ...
JustDreaming's user avatar
0 votes
0 answers
157 views

Suppose I am working on a library with a decent number of classes, most of them having a bunch of methods, in addition to the basic ctors and dtor. For reasons, the method implementations are spread ...
einpoklum's user avatar
  • 138k
1 vote
1 answer
77 views

I have class example: export class Test{ private func: (...args: any[]) => void; constructor(func: (...args: any[]) => void) { this.func = func; } method(...args: any[]) {...
Алексей Смирнов's user avatar
0 votes
1 answer
102 views

I come from PHP where I usually never have global constants. For instance, if I have the class Users and the method add(int $status, string $username) then the status of the user is a constant only ...
Tintenfisch's user avatar
0 votes
3 answers
127 views

I am working on an ASP.NET project that uses Vue.js and jQuery. I have a JavaScript file (fields.js) that defines several classes (e.g., Users, Fields) and initializes a Vue instance. When I use the ...
kev's user avatar
  • 139
-1 votes
0 answers
43 views

I'm trying to understand how the reduce() function works in this example: const fruits = ['apple', 'banana', 'apple', 'orange', 'banana', 'apple']; const count = fruits.reduce((tally, fruit) => { ...
heizzz's user avatar
  • 1
-9 votes
1 answer
151 views

I was trying to get the last word of the sentence using the .find() method in a loop. My code: sentence = "please write a program which keeps asking the user for words" index = 0 substring = ...
krish mundra's user avatar

15 30 50 per page
1
2 3 4 5
2031