Questions tagged [func]

Func is a family of delegate types in the .Net framework.

Func is a family of types in the framework. They are in the System namespace and can be used to represent a function that returns a value and has zero or more parameters.

1154 questions
-1
votes
1 answer

Converting any delegate to delegate with object[] parameter

I want to convert any delegate returning, for example bool, where first parameter is MyClass type and other arguments are convertible to object, for example bool FirstMethod(MyClass foo, int integer, string text) bool SecondMethod(MyClass foo,…
TheChilliPL
  • 337
  • 1
  • 5
  • 14
-1
votes
2 answers

How optional arguments works in Python

I've been reading a book, and got stuck on the topic of optional arguments. • Can define defaults for arguments that need not be passed >>> def func(a, b, c=10, d=100): print a, b, c, d >>> func(1,2) 1 2 10 100 I don't get this…
BNS
  • 11
  • 1
-1
votes
1 answer

How can I convert cache-miss retrieval Func with no parameters so that it will accept an integer parameter?

public List GetDepartmentsByCompanyDB(int companyID){ //How will I pass the companyID value to the function? return GetObjectFromCache>(string.Format("Departments{0}", "ALL"), 60 *…
NBT
  • 35
  • 7
-1
votes
1 answer

Linq-Like extension for creating a new object and setting its properties? How to?

I am attempting to create an extension method for type object that will create a new way of initializing an object and setting its properties. I have however run into a few problems. The extension looks like so: public static class…
Chris
  • 826
  • 10
  • 26
-1
votes
1 answer

How to get div id and set it to anoher func

Have a func that get clicked div id need to give next func this id instead "#dropdown1" $(function() { $('.drop-down-input').click(function() { $elementid = this.id; $elementid= "#" + elementid; }); …
-1
votes
2 answers

Return a boolean value from a function in Swift 3.0

I cannot figure how the new first label proposal for Swift 3.0 applies to returnTypes with Bool: var firstString = "string" var secondString = "thing" func areTheStringsAnagrams(first: String, second: String) -> Bool { return…
Eric
  • 893
  • 10
  • 25
-1
votes
1 answer

Why won't figure.area = ... not work? Swift 3.0

struct Shape{ struct Rectangle { var length = 0 var width = 0 var area: Float = 0 } struct Square { var length = 0 var width = 0 var area: Float = 0 } func area(length: Float,…
-1
votes
1 answer

How to use UISwitch correctly?

My code is not working. I don't know why. The problem is the property of switchChanged function. If property is empty then code is working. override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view,…
user6927337
-1
votes
1 answer

Generic method to wrap function with different parameters number, int return and output parameter

I have a service (3-rd party) with a lot of methods with signatures like: int MethodA(int, string, out T result) int MethodB(int, string, string, out T[] result) int MethodC(DateTime, string, string, out T result) Where returning int is just a…
Kindzoku
  • 1,368
  • 1
  • 10
  • 29
-1
votes
1 answer

How to pass a struct's method as a parameter into another function using golang

Sorry, I post my question again. I have been read the solution before I ask my question. I think it can not help me because my question is how to pass a function as a parameter? I don't want to call it. I just want to pass it to another function…
herb
  • 45
  • 1
  • 5
-1
votes
1 answer

Linq Func argument

I am bit confused what is the meaning of below statements. List>() Groups.Instance.GetGroup(2, grp => TestPredicateGroup(whereCls, grp)); private static bool TestPredicateGroup(List> predicates,…
skiskd
  • 423
  • 2
  • 9
  • 20
-1
votes
1 answer

What is the difference between object().func and object.func in swift

I am new to swift and I want to know if there is a difference between geoCoder() : var geoCoder:CLGeocoder = CLGeocoder() geoCoder().reverseGeocodeLocation(newCoordinate, completionHandler: { (<#[CLPlacemark]?#>, <#NSError?#>) -> Void…
Swift Everyday
  • 271
  • 1
  • 5
  • 13
-1
votes
1 answer

How do I get the values of arguments passed inside a func() argument in GO?

I am trying to create middleware inside routes and wondering how one can get the values of arguments passed inside a func() argument. For example: func (c appContainer) Get(path string, fn func(rw http.ResponseWriter, req *http.Request)) { //…
Ricardo Rossi
  • 524
  • 5
  • 13
-1
votes
1 answer

Could Func and Func have 1 name in method signature?

I have 2 methods: private static async Task GetInfoAsync(MyClient service, Func> funcAsync, string resultText) { var result = default(T); if (service != null) { try { service.Open(); …
Galina Melnik
  • 1,947
  • 3
  • 14
  • 19
-1
votes
5 answers

does placing of script tag in html file alter the output?

I tried placing a javascript code in the head tag but the browser didn't give any output but when I placed the script tag under the div I targeted in the function it works perfectly. Why does that happen? below is the code i tried: