小编Fli*_*per的帖子

共享合同目标中的共享电话联系终止应用程序

每当我尝试使用WP 8.1中的共享合同与目标应用程序共享电话簿联系时,目标应用程序始终在ReportCompleted()调用方法之前终止.

使用GetStorageItemsAsync()它实际上是一个.VCF文件提取联系人,但在我可以引导用户完成目标应用程序的流程之前,应用程序终止!如果共享任何其他存储项(例如图像),则功能很好.

Whatsapp(WP 8.1上的2.12.60)也显示了在共享联系人时终止abrupty的相同行为.

这是操作系统中的错误吗?如果没有,我该怎么做才能做到这一点?

c# windows-phone-8.1

7
推荐指数
0
解决办法
98
查看次数

Calling await operation after acquiring mutex

How can I write to a file using await FileIO.WriteTextAsync() (in Windows Phone 8.1) after acquiring mutex so that no two threads access the same file and mutual exclusion is ensured. I'm doing the following:

mutex.WaitOne()

try
{
    await FileIO.WriteTextAsync(filename, text);
    Debug.WriteLine("written");
}
finally
{
    mutex.ReleaseMutex();
}
Run Code Online (Sandbox Code Playgroud)

But the method works for one or two iterations only, after which it throws a System.Exception. Also, if I remove the await keyword or remove the file writing method entirely, the code …

c# mutex windows-phone-8.1

5
推荐指数
1
解决办法
523
查看次数

Java虚方法调用

说我有以下代码:

public class Employee
{
    public int salary = 2000;
    public void getDetails() {...}
}

public class Manager extends Employee
{
    public int salary = 5000;
    public int allowance = 8000;
    public void getDetails() {...}
}
Run Code Online (Sandbox Code Playgroud)

main()执行以下操作:

Employee emp = new Employee();
Manager man = new Manager();
emp.getDetails(); // method of Employee called, output ok.
man.getDetails(); // method of Manager called, output ok.

Employee emp_new = new Manager();
emp_new.getDetails(); // method of Manager called, ok.
System.out.println(emp_new.allowance); // problem, …
Run Code Online (Sandbox Code Playgroud)

java polymorphism

4
推荐指数
1
解决办法
860
查看次数

c#前面的快速字符串插入

我需要在开头插入字符串.现在我StringBuilder.Insert(0, stringToInsert)用来插入前面,但它需要花费很多时间(大约2分钟,80,000个字符串).

append()方法运行速度更快(80,000个字符串为30秒),但这不是我需要的顺序.如何反转字符串的顺序(而不是字符串本身)并减少插入时间?

c# stringbuilder

4
推荐指数
1
解决办法
1697
查看次数

返回本地指针

我的问题是对此的扩展:返回指向本地结构的指针

我编写了以下代码来创建一个空列表:

struct node* create_empty_list(void)
{
    struct node *head = NULL;
    return head;
}
Run Code Online (Sandbox Code Playgroud)

我刚刚读到返回指向局部变量的指针是没用的,因为当函数退出时,变量将被销毁.我相信上面的代码返回一个NULL指针,所以我不认为它是一个指向局部变量的指针.
在这种情况下,分配给指针的内存在哪里.我没有在堆上分配任何内存,它应该在堆栈上,作为自动变量.但是当代码退出(指针)时会发生什么,如果我尝试在程序中使用它,通过为指针分配一些pointees/de-referencing等等?

c pointers

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

标签 统计

c# ×3

windows-phone-8.1 ×2

c ×1

java ×1

mutex ×1

pointers ×1

polymorphism ×1

stringbuilder ×1