Tag: c

66 votes
30 answers
521 views
Difference in months between two dates

How to calculate the difference in months between two dates in C#? Is there is equivalent of VB's DateDi

avatar
Dorinda
0 1 0 9
asked 07 September, 2021
49 votes
26 answers
1.4K views
What is the best workaround for the WCF client `using` block issue?

I like instantiating my WCF service clients within a using block as it's pretty much the standard way to

avatar
Bryan
0 1 0 9
asked 07 September, 2021
62 votes
21 answers
2.6K views
Why is there no ForEach extension method on IEnumerable?

Inspired by another question asking about the missing Zip function: Why is there no ForEach extension method o

avatar
Ali
0 1 0 9
asked 07 September, 2021
58 votes
4 answers
1.5K views
Is there a conditional ternary operator in VB.NET?

In Perl (and other languages) a conditional ternary operator can be expressed like this: my $foo = $bar == $b

avatar
Lynette
0 1 0 9
asked 07 September, 2021
62 votes
17 answers
2.7K views
Converting string to byte array in C#

I'm converting something from VB into C#. Having a problem with the syntax of this statement: if ((searc

avatar
Freida
0 1 0 9
asked 07 September, 2021
56 votes
13 answers
639 views
How to enable assembly bind failure logging (Fusion) in .NET

How do I enable assembly bind failure logging (Fusion) in .NET?

avatar
Nidia
0 1 0 9
asked 07 September, 2021
57 votes
18 answers
347 views
Updating to latest version of CocoaPods?

I'm having some issues installing Alamofire 4.0 into my project. I've got the latest version of Xcod

avatar
Jeff
0 1 0 9
asked 07 September, 2021
53 votes
25 answers
1.1K views
How can I change image tintColor in iOS and WatchKit

I have an UIImageView called "theImageView", with UIImage in a single color (transparent background) just like

avatar
Don
0 1 0 9
asked 07 September, 2021
64 votes
12 answers
1.8K views
What does "Fatal error: Unexpectedly found nil while unwrapping an Optional value" mean?

My Swift program is crashing with EXC_BAD_INSTRUCTION and one of the following similar errors. What does this

avatar
Alba
0 1 0 9
asked 07 September, 2021
71 votes
9 answers
2K views
Static vs class functions/variables in Swift classes?

The following code compiles in Swift 1.2: class myClass { static func myMethod1() { } class func

avatar
Stacia
0 1 0 9
asked 07 September, 2021
58 votes
30 answers
1.6K views
Get nth character of a string in Swift programming language

How can I get the nth character of a string? I tried bracket([]) accessor with no luck. var string = "Hello,

avatar
Corrin
0 1 0 9
asked 07 September, 2021
55 votes
29 answers
806 views
How to determine the current iPhone/device model?

Is there a way to get the device model name (iPhone 4S, iPhone 5, iPhone 5S, etc) in Swift? I know there is a

avatar
Basil
0 1 0 9
asked 07 September, 2021
54 votes
12 answers
1.2K views
How do I write dispatch_after GCD in Swift 3, 4, and 5?

In Swift 2, I was able to use dispatch_after to delay an action using grand central dispatch: var dispatchTim

avatar
Benton
0 1 0 9
asked 07 September, 2021
58 votes
30 answers
1.6K views
How to hide UINavigationBar 1px bottom line

I have an app that sometimes needs its navigation bar to blend in with the content. Does anyone know how to

avatar
Corey
0 1 0 9
asked 07 September, 2021
53 votes
9 answers
2.2K views
Shall we always use [unowned self] inside closure in Swift

In WWDC 2014 session 403 Intermediate Swift and transcript, there was the following slide The speaker said

avatar
Serina
0 1 0 9
asked 07 September, 2021
58 votes
12 answers
2K views
The use of Swift 3 @objc inference in Swift 4 mode is deprecated?

Briefly, while using Xcode 9 Beta, I have run into the following warning: The use of Swift 3 @objc inferen

avatar
Scot
0 1 0 9
asked 07 September, 2021
64 votes
6 answers
3K views
Swift: print() vs println() vs NSLog()

What's the difference between print, NSLog and println and when should I use each? For example, in Pytho

avatar
Stacia
0 1 0 9
asked 07 September, 2021
49 votes
19 answers
1K views
How to add constraints programmatically using Swift

I'm trying to figure this out since last week without going any step further. Ok, so I need to apply some

avatar
Corrin
0 1 0 9
asked 07 September, 2021
52 votes
17 answers
3K views
Why Choose Struct Over Class?

Playing around with Swift, coming from a Java background, why would you want to choose a Struct instead of a C

avatar
Juliane
0 1 0 9
asked 07 September, 2021