小编Pen*_*uen的帖子

C#中的遗传算法?

如何在C#中编写遗传算法?有图书馆吗?像C ++:http//lancet.mit.edu/ga/

.net c# genetic-algorithm

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

使用C#以编程方式更新xml

我尝试更新没有linq的xml(我正在使用VC 2.0).我的xml文件格式:


<schedule>
<id>0</id>
<name>yusuf</name>
<status>0</status>
</schedule>

AFTER UPDATE:

<schedule>
<id>0</id>
<name>yusuf</name>
<status>1</status>
</schedule>

但我不知道更新状态= 0到状态= 1

.net c# xml .net-2.0

3
推荐指数
1
解决办法
3895
查看次数

如何删除数据集的列?

如何删除数据集的列?

有没有一种方法可以为我这样做:

rh.dsDetail = ds.Tables[0].Columns.Remove(
Run Code Online (Sandbox Code Playgroud)

或者像这样:

rh.dsDetail = ds.Tables[0].Columns.Remove( ds.Tables[0].Columns[1],ds.Tables[0].Columns[2])
Run Code Online (Sandbox Code Playgroud)

.net c# dataset

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

我如何使用Profilebase类?

我尝试使用asp.net配置文件,我尝试使用ProfileBase继承


public class dort_islem : ProfileBase
{
    public int ilk_sayi { get; set; }
    public int ikinci_sayi { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
  <anonymousIdentification enabled="true"/>
  <profile enabled="true" inherits="dort_islem">
   <providers>
    <clear/>
    <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="profiller"/>
   </providers>
   <properties>
    <add name="ad" allowAnonymous="true" defaultValue="yusuf"/>
    <add name="soy_ad" allowAnonymous="true"/>
    <add name="sevdigi_renk" allowAnonymous="true" type="System.Drawing.Color" serializeAs="Binary" />
        <group name="detaylar">
          <add name="numara" type="Integer" allowAnonymous="true"/>
          <add name="giris_tarihi" type="Date" allowAnonymous="true"/>
          <add name="cinsiyet" allowAnonymous="true"/>
          <add name="adres" allowAnonymous="true"/>
        </group>
   </properties>
  </profile>
Run Code Online (Sandbox Code Playgroud)

但如果我尝试使用这些代码Default.aspx: alt text http://i47.tinypic.com/zn5v60.gif

我如何从dort_islem类中看到ilk_sayi?问候....

c# asp.net visual-studio-2010 .net-3.5

3
推荐指数
1
解决办法
7529
查看次数

为什么在我的类中实现接口时,我的类方法不可见?

我看不到MyLoad.TreeLoader(),但为什么?我已经实现iloaderTreeViewLoad.我应该能够看到TreeLoader().

namespace Rekursive
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //treeView1.Nodes.Add("Test");
            iloader MyLoad = new TreeViewLoad();
            MyLoad.loader("test", treeView1, 1);
        }
    }

    interface iloader
    {
        void loader(string nodeName, TreeView myTre, int id);
    }

    class TreeViewLoad : iloader
    {
       public void TreeLoader(TreeView tre)
        {
           // Here I want to call the loader
        }

        public void loader(string nodeName, TreeView myTre, int id) …
Run Code Online (Sandbox Code Playgroud)

.net c# oop visual-studio-2008 visual-studio

3
推荐指数
1
解决办法
5412
查看次数

字符串和字符串有什么区别?

可能重复:
C#中的字符串与字符串

String和string或Double和double有什么区别?

如果我使用:

双s1; 要么

如果我使用Double s1;

你能给出利弊吗?

.net c# oop visual-studio

3
推荐指数
1
解决办法
445
查看次数

如何使用RegularExpressionValidator上传仅Excel文件?

i need to control Only ExcelFile uploading with RegularExpressionValidator How can i do that? i need to write a regex pattern in ValidationExpression...

 <h3>FileUpload Test</h3>
    <div>
        <asp:FileUpload ID="FileUpload1" runat="server" />
        <asp:Button id="UploadBtn" Text="Upload File" OnClick="UploadBtn_Click" runat="server" Width="105px" />
        <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
        <asp:RegularExpressionValidator
id="FileUpLoadValidator" runat="server"
ErrorMessage="Upload Excel only."
ValidationExpression="([a-z]\w*)(.xlsx|.xlsm|.xls)$"
ControlToValidate="FileUpload1">
</asp:RegularExpressionValidator>
    </div>
Run Code Online (Sandbox Code Playgroud)

.net regex asp.net visual-studio-2008

3
推荐指数
1
解决办法
8132
查看次数

我如何比较两个通用集合?

我如何比较两个通用集合?这是我尝试使用两个字符串数组,但它不会返回true.

namespace genericCollections
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] xx = new string[] { "gfdg", "gfgfd", "fgfgfd" };
            string[] yy = new string[] { "gfdg", "gfgfd", "fgfgfd" };
            Console.WriteLine(ComparerCollection(xx, yy).ToString());
            Console.ReadKey();
        }

        static bool ComparerCollection<T>(ICollection<T> x, ICollection<T> y)
        {
            return x.Equals(y);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

.net c# visual-studio

3
推荐指数
1
解决办法
1641
查看次数

如何使复选框禁用angular.js

当我从组合框中选择一个项目时,如何禁用复选框.例如,如果我选择"ABONE",角度将使abone复选框禁用.

注意(示例):DefinitionType:ABONE

在此输入图像描述

                  <div class="row">
                <div class="form-group">
                    <label class="control-label col-md-2">Tan?m Tipi<sup>*</sup></label>
                    <div class="col-md-3">
                        <select class="form-control" placeholder="Tan?m Tipi" ng-options="field.value for field in DefinitionTypes" ng-model="DefinitionType"  required></select>
                    </div>
                </div>
            </div><br />  
Run Code Online (Sandbox Code Playgroud)

EkstraTanımTipi

                        <div class="checkboxinsameline" ng-repeat="item in DefinitionTypes">
                            <label>
                                <input type="checkbox" name="item.value" ng-click="DefinitionTypesChecked(item.id)" > {{item.value}}
                            </label>
                        </div>

                    </div>
                </div>
            </div><br />
Run Code Online (Sandbox Code Playgroud)

html javascript checkbox twitter-bootstrap angularjs

3
推荐指数
1
解决办法
112
查看次数

如何通过NewtonSoft反序列化对象json列表?

我通过Newtonsoft.Json在类下面进行序列化,但我无法通过Newtonsoft.Json反序列化相同的json.我怎样才能做到这一点?

JSON:

"{\"UserEvents\":[{\"id\":1214308,\"Date\":20150801000000,\"IsRead\":true}]}"
Run Code Online (Sandbox Code Playgroud)

我的实体:

   public class UserEventLog {
    [JsonProperty("UserEvents")]
    public List<UserEvent> UserEvents { get; set; }
    public UserEventLog() {
        UserEvents = new List<UserEvent>();
    }
}


public class UserEvent {
    [JsonProperty("id")]
    public long id{ get; set; }
      [JsonProperty("Date")]
    public long Date{ get; set; }
      [JsonProperty("IsRead")]
    public bool IsRead { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我的解串器是这样的:

  List<UserEventLog> convert = JsonConvert.DeserializeObject<List<UserEventLog>>(user.ToString()) as List<UserEventLog>;
Run Code Online (Sandbox Code Playgroud)

错误产生:

Newtonsoft.Json.dll中发生未处理的"Newtonsoft.Json.JsonSerializationException"类型异常

其他信息:将值转换"{"UserEvents":[{"id":1214308,"Date":20150801000000,"IsRead":true}]}"为类型'System.Collections.Generic.List`1时出错

我怎么解决呢?我怎样才能将我的对象列表反序列化为UserEvents列表?

c# serialization json json.net

3
推荐指数
1
解决办法
7455
查看次数