alternate

Selecting alternate items of an array C#

六月ゝ 毕业季﹏ 提交于 2019-11-28 11:11:23
问题 I have an array statsname as apple X banana Y Kiwi z I need to put apple,banana and Kiwi in an array Fruits and X,Y and Z in an array called alphabets. Any simple C# mechanism for it please ? 回答1: Use the IEnumerable<T>.Where overload which supplies the index. var fruits = statsname.Where((s, i) => i % 2 == 0).ToArray(); var alphabets = statsname.Where((s, i) => i % 2 != 0).ToArray(); 回答2: Stolen from How to get Alternate elements using Enumerable in C# var fruits = myArray.Where((t, i) => i

How to setup alternate entry point in Blackberry application?

我的梦境 提交于 2019-11-27 09:51:31
How to setup alternate entrypoint in Blackberry Application.There will be 2 application UI Application Background Application: will run on autostart. There is a blackberry knowledge center article about this, which I tried, and coded as follows. But on clicking the application icon, there is no response. class EntryPointForApplication extends UiApplication { public EntryPointForApplication() { GUIApplication scr = new GUIApplication(); pushScreen(scr); } public static void main(String[] args) { if ( args != null && args.length > 0 && args[0].equals("background1") ){ // Keep this instance