我需要使用Web服务.他们给我发了WSDL文件.我应该怎么做才能将它添加到我的网站并开始使用它作为代理.(如果我将它放在虚拟目录上就可以发现它,但是它是否授予我与真实Web服务的连接?)
我可以以简单的方式打开/关闭resharper.
问题是有时我处理大文件并使我的VS变慢,有时会弹出一条消息告诉我resharper内存不足.我可以在不重新加载解决方案的情况下激活/停用它吗?
使用System.Drawings System.Drawing.FontFamily.Families给我带来的系列比支持WPF的系列要多,或者至少有些东西对于某些不能渲染的字体很奇怪.有没有其他方法可以获得当前可用的所有字体集合?
为什么Visual Studio将此代码添加到Class.Designer.cs分部类中.任何人都能告诉我这个组件变量什么时候会得到一些价值?这里的模式是什么?
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if(disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试从Windows PC在Visual Studio中编译Xamarin IOS解决方案,但是我收到以下错误2> C:\ Program Files(x86)\ Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS .Common.targets(624,3):错误:找不到SDK bin目录
我已经在线查看了xCode的默认路径,一切正常.我将mac上的xCode更新为10.0版
这是失败的IOS.Common.targets上的行
<DetectSdkLocations
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'"
SdkVersion="$(MtouchSdkVersion)"
TargetFrameworkIdentifier="$(TargetFrameworkIdentifier)"
TargetArchitectures="$(TargetArchitectures)"
>
<Output TaskParameter="SdkVersion" PropertyName="MtouchSdkVersion" />
<Output TaskParameter="SdkRoot" PropertyName="_SdkRoot" />
<Output TaskParameter="SdkBinPath" PropertyName="_SdkBinPath" />
<Output TaskParameter="SdkDevPath" PropertyName="_SdkDevPath" />
<Output TaskParameter="SdkUsrPath" PropertyName="_SdkUsrPath" />
<Output TaskParameter="SdkPlatform" PropertyName="_SdkPlatform" />
<Output TaskParameter="SdkIsSimulator" PropertyName="_SdkIsSimulator" />
<Output TaskParameter="IsXcode8" PropertyName="_IsXcode8" />
</DetectSdkLocations>
Run Code Online (Sandbox Code Playgroud) 这是我正在思考的事情,因为我正在学习属性,而我正在使用INotifyPropertyChanged太多,只是和想法,我想听听它的一些意见.(我知道这需要在编译器上做一些工作而不是在cosumer方面)
由于INotifyPropertyChanged大部分时间都使用相同的模式.就像调用使用属性名称激活事件的方法一样,它可以设计为和属性并使用自动属性吗?这样编译器知道它需要添加对PropertyChanged事件的调用吗?所以,如果我们有班级....
public class DemoCustomer : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(String info)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
}
private string companyNameValue = String.Empty;
...
}
Run Code Online (Sandbox Code Playgroud)
而不是宣布财产
public string CompanyName
{
get
{
return this.companyNameValue;
}
set
{
if (value != this.companyNameValue)
{
this.companyNameValue = value;
NotifyPropertyChanged("CompanyName");
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果我们可以通过此属性向编译器指示如果新值与前一个值不同,则需要使用属性的名称生成对PropertyChanged的调用,我们可以执行类似这样的操作
[NotifyPropertyChanged]
public string CompanyName
{
get;set;
}
Run Code Online (Sandbox Code Playgroud)
当没有使用属性时,我们仍然可以使用旧方式对某些自定义行为进行编码.
需要制作新的WPF控件并将Caret赋予它.在WINFORMS或previos Windows UI中,使用WIN API Caret函数很容易,但现在在WPF中我们没有每个控件的hwnd所以......有没有办法做到这一点?
我看到lambda表达式已经成为语言中某些点的非常有用的工具.我一直在使用它们,大部分时间它们非常适合,使代码更短,也许更清晰.
现在..我见过一些,我会说过度使用它们.有些人非常喜欢它们,试图在任何地方使用它们.有时候C#代码看起来像一种函数式语言.
其他因素是使用lambda反射的成本以及对调试不友好的成本.
我想听听有关使用或多或少的lambda表达式有多好以及如何清除代码的意见.
(这不是更好的例子,但让我们说它是触发器)
我正在编写以下代码.使用它delegate { return null; }可以帮助我避免在每次必须使用它时询问事件是否为空.
public delegate ContactCellInfo.Guest AddGuest();
public event AddGuest GuestRequest = delegate { return null;}
Run Code Online (Sandbox Code Playgroud)
我使用resharper和明智的resharper(甚至有时候文字吃掉记忆)让我提出以下建议
public delegate ContactCellInfo.Guest AddGuest();
public event AddGuest GuestRequest = () => null;
Run Code Online (Sandbox Code Playgroud)
在我看来,使用委托的代码看起来更清晰.我并不反对Lamdba的表达,只是想听听关于如何以及何时使用它们的一些建议.
使用之间有什么区别
catch(Exception ex)
{
...
throw ex;
}
Run Code Online (Sandbox Code Playgroud)
和使用
catch // might include (Exception)
{
...
throw;
}
Run Code Online (Sandbox Code Playgroud) 在层次结构中是否可以在某个时候使用new关键字来覆盖方法中的返回类型?
我可以使用virtual new或者new virtual我可以覆盖返回类型吗?
我还需要考虑从那一点继承的类.他们可以覆盖创建基础的方法new吗?
我有一个WinForm应用程序,其网格包含每行的ComboBox.所有都绑定到同一个集合(该集合可能会改变,这就是为什么我不希望每个Combo都有不同的集合,也是内存成本).问题是,当我在一个组合中选择一个对象时,它会在每个组合中更改所选对象.这是一个可以运行并轻松复制的代码.
public Form1()
{
InitializeComponent();
this.comboBox1 = new System.Windows.Forms.ComboBox();
List<int> numList = new List<int>(){1,2,3,4};
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(33, 169);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(126, 21);
this.comboBox1.TabIndex = 3;
this.comboBox1.DataSource = numList; // BINDING TO NUMLIST
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Location = new System.Drawing.Point(243, 367);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(126, 21);
this.comboBox2.TabIndex = 4;
this.comboBox2.DataSource = numList; // BINDING TO NUMLIST ( THE SAME LIST
this.Controls.Add(this.comboBox2);
this.Controls.Add(this.comboBox1);
}
Run Code Online (Sandbox Code Playgroud)
只需创建一个表单并粘贴ComboBox 1和2的声明.任何想法如何发生这种情况.我的意思是如果它是一个简单的列表,它不会跟踪所选对象.DataSource背后发生了什么?
我有一个radioButton组,每个Button绑定到一个Enum属性
<RadioButton Name="rbFixedDiscount" IsChecked="{Binding Path=DiscountType, Mode=TwoWay, Converter={StaticResource EnumConverter},ConverterParameter=Fixed, UpdateSourceTrigger=PropertyChanged}" >Fixed:</RadioButton>
<RadioButton Name="rbPercentDiscount" Grid.Row="1" IsChecked="{Binding Path=DiscountType, Mode=TwoWay, Converter={StaticResource EnumConverter},ConverterParameter=Percent, UpdateSourceTrigger=PropertyChanged}">Percent:</RadioButton>
<RadioButton Name="rbFreeNightsDiscount" Grid.Row="2" IsChecked="{Binding Path=DiscountType, Mode=TwoWay, Converter={StaticResource EnumConverter},ConverterParameter=FreeNights, UpdateSourceTrigger=PropertyChanged}">Free Nights:</RadioButton>
Run Code Online (Sandbox Code Playgroud)
每当我在UI中来回点击时,后面的属性只有在我点击一个新的RB时才会更新,如果我单击其中一个按钮(所以我将其设为Checked - > Unchecked - > Checked),绑定后面的属性不会刷新,它的绑定已被清除我认为这是因为取消选中和Item时调用ClearValue().无论如何,我可以在来回点击时保持绑定活着.
c# ×7
wpf ×4
.net ×3
winforms ×2
wpf-controls ×2
caret ×1
data-binding ×1
delegates ×1
fonts ×1
lambda ×1
resharper ×1
vb.net ×1
wcf ×1
web-services ×1
wsdl ×1
xamarin ×1
xamarin.ios ×1
xaml ×1
xcode ×1