小编Son*_*Ali的帖子

十进制vs双! - 我应该使用哪一个?何时使用?

我一直看到人们在C#中使用双打.我知道我读到某个地方,双打有时会失去精确度.我的问题是什么时候应该使用双倍,何时应该使用小数类型?哪种类型适合货币计算?(即超过1亿美元)

c# precision double currency decimal

851
推荐指数
7
解决办法
42万
查看次数

Android Spinner:获取所选的项目更改事件

如何在所选项目更改时为Spinner设置事件侦听器?

基本上我想要做的是类似于这样的事情:

spinner1.onSelectionChange = handleSelectionChange;

void handleSelectionChange(Object sender){
    //handle event
}
Run Code Online (Sandbox Code Playgroud)

events android spinner android-spinner

385
推荐指数
9
解决办法
46万
查看次数

C#类命名约定:是BaseClass还是ClassBase或AbstractClass

命名基类的推荐方法是什么?它是否在类型名称前加上" Base "或" Abstract ",或者我们只是用"Base"作为后缀?

考虑以下:

type:ViewModel例如MainViewModel,ReportViewModel

基类:BaseViewModelViewModelBaseAbstractViewModel

还要考虑:

type:Product例如VirtualProduct,ExpiringProduct

基类:BaseProductProductBaseAbstractProduct

您认为哪个更标准?

class Entity : EntityBase
{
}
Run Code Online (Sandbox Code Playgroud)

要么

class Entity : BaseEntity
{
}
Run Code Online (Sandbox Code Playgroud)

c# naming-conventions base-class

107
推荐指数
3
解决办法
4万
查看次数

Android - iphone风格tabhost

是否可以将Android Tabhost设置为类似iPhone的样式?如果没有,是否有任何开源代码可以显示如何为Android创建底部选项卡?

alt text http://images.appshopper.com/screenshots/305/690205_2.jpg 替代文字

tabs android android-style-tabhost android-tabhost

29
推荐指数
3
解决办法
4万
查看次数

这是C#中将分隔字符串转换为int数组的最佳方法吗?

给出以下字符串:

string str = "1,2,3";
Run Code Online (Sandbox Code Playgroud)

这是将它转换为int数组的最佳扩展吗?

static class StringExtensions
{
    public static int[] ToIntArray(this string s)
    {
        return ToIntArray(s, ',');
    }
    public static int[] ToIntArray(this string s, char separator)
    {
        string[] ar = s.Split(separator);
        List<int> ints = new List<int>();
        foreach (var item in ar)
        {
            int v;
            if (int.TryParse(item, out v))
                ints.Add(v);
        }
        return ints.ToArray();
    }
}
Run Code Online (Sandbox Code Playgroud)

c# string

18
推荐指数
3
解决办法
2万
查看次数

哪个更快/更有效:Dictionary <string,object>或Dictionary <enum,object>?

枚举类型更快/更效率比字符串作为字典键使用时的类型?

IDictionary<string,object> or IDictionary<enum,object>
Run Code Online (Sandbox Code Playgroud)

事实上,哪种数据类型最适合作为字典键,为什么?

请考虑以下事项:注意:为简单起见,只有5个属性

struct MyKeys
{
   public string Incomplete = "IN"; 
   public string Submitted = "SU"; 
   public string Processing="PR"; 
   public string Completed = "CO"; 
   public string Closed = "CL";   
}
Run Code Online (Sandbox Code Playgroud)

enum MyKeys
{
   Incomplete, 
   Submitted, 
   Processing, 
   Completed, 
   Closed
}
Run Code Online (Sandbox Code Playgroud)

如果在字典中用作键,上面哪个会更好!

c# string enums dictionary

13
推荐指数
2
解决办法
8377
查看次数

Eclipse:改进调试并在mouseOver上显示变量值

调试时是否可以在Eclipse中查看变量值?现在,当我"鼠标悬停"变量时,我得到的只是定义.例如,对于[int mLastView],我得到[com.company.samples.MyClass.mLastView]而不是1.分配给它的值.

另外,有没有改进Eclipse中的调试?

对于启动器:使断点在VS中可见(见下文)?

Eclipse断点

Eclipse Break Point http://i28.tinypic.com/hwmtcx.png

Visual Studio断点

Visual Studio Break Point http://i32.tinypic.com/359egbp.png

eclipse visual-studio

9
推荐指数
2
解决办法
2万
查看次数

如何在AngularJS服务Jasmine测试中模拟$ http?

我正在尝试测试AngularJS服务carService,但$httpBackend似乎不起作用.

//carService
angular.module('services').factory('carService',
    function($http) {
        return {
            getTypes: function() {
                return $http.get('/api/cars/types');
            }
        };
    });
Run Code Online (Sandbox Code Playgroud)

任何人都可以解释为什么响应为空?

describe("Services", function () {

    beforeEach(module("app.services"));

    describe("Car services", function () {

        var service, $httpBackend;

        beforeEach(inject(function($injector) {
            service = $injector.get('carService');
            $httpBackend = $injector.get('$httpBackend');

            $httpBackend.when('GET', "/api/cars/types").respond(["Toyota", "Honda", "Tesla"]);
        }));

        afterEach(function() {
            $httpBackend.verifyNoOutstandingExpectation();
            $httpBackend.verifyNoOutstandingRequest();
        });

        it('getTypes - should return 3 car manufacturers', function () {
            service.getTypes().then(function(response) {
                expect(response.length).toEqual(3); //the response is null
            });
            $httpBackend.flush();
        });


    });
});
Run Code Online (Sandbox Code Playgroud)

unit-testing jasmine angularjs httpbackend

9
推荐指数
1
解决办法
9414
查看次数

Android - 如何将我的免费应用程序链接到专业版

如何将我的免费Android应用程序链接到"付费"版本,以便免费的用户可以立即点击该链接并被带到完整版的Android市场页面.

android google-play

7
推荐指数
1
解决办法
2031
查看次数

C#压力测试 - 模拟对给定共享资源的多次访问

如何在ac#单元测试中模拟/压力测试约100个用户访问给定的共享资源(例如数据库)?

c# unit-testing stress-testing simulate

6
推荐指数
2
解决办法
8896
查看次数