我正在使用fb远程事件来监听数据库,我在我的应用程序加载内部线程启动它.
当我在我的Windows 10(本地PC)上运行它时,它正常工作并完美但是当我在Windows Server 2003上运行它时,它开始填充RAM内存比它应该多得多,当它达到服务器限制时它就会关闭.
这是我的代码:
private void DataBaseEventListner()
{
FbRemoteEvent revent = new FbRemoteEvent(M.Baza.connectionString);
FbRemoteEvent revent1 = new FbRemoteEvent(M.Baza.connectionKomercijalno2018);
revent.RemoteEventCounts += (sender, e) =>
{
this.Invoke(new MethodInvoker(delegate
{
Poruka p = new Poruka(Magacin.Poruka.UcitajPoslednjuPorukuID(Korisnik.korisnikId));
p.Show();
}));
};
revent1.RemoteEventCounts += (sender, e) =>
{
switch (e.Name)
{
case "PP_NEW":
case "PP_UPD":
Thread thread1 = new Thread(UcitajPoslovnePartnere);
thread1.Start();
break;
}
};
revent.QueueEvents(String.Format("nova_poruka~" + Korisnik.korisnikId.ToString()));
revent1.QueueEvents(new string[] { "PP_NEW", "PP_UPD" });
}
private void UcitajPoslovnePartnere()
{
poslovniPartneri = Komercijalno.Partner.Lista();
}
public static List<Int_String> …Run Code Online (Sandbox Code Playgroud) 我有txt包含游戏中地图数据的文件.问题是文件存储在中,Application.persistentDataPath所以我甚至可以从我的Android设备(创建的地图创建者)更改它,那么如何在我的PC上创建包含基本地图的txt文件,并在persistentDataPath安装时将其显示在我的Android设备上应用?
我正在看这个代码,不知道这是什么magnitude,normalized做什么以及这个人如何使用它们.在文档中只有很少的东西,但它没有解释太多.
我正在看的代码是:
public float minDistance = 1.0f;
public float maxDistance = 4.0f;
public float smooth = 10.0f;
Vector3 dollyDir;
public Vector3 dollyDirAdjusted;
public float distance;
void Awake()
{
dollyDir = transform.localPosition.normalized;
//What has he got with this? Documentation says Returns this vector with
//a magnitude of 1 so if i get it it return's it's length as 1. So what is the point?
distance = transform.localPosition.magnitude;
//Have no idea what he got with this
}
void …Run Code Online (Sandbox Code Playgroud) 就像标题说我有这个错误 already defines a member called with the same parameter types c#
我已经查看了多个相同的问题,但它们都说明了它为什么会发生以及如何处理它(将方法的名称更改为其他方法)但是我不想将方法名称更改为其他方法,因为它是相同的方法但具有不同的参数所以我只是想绕过它.
这是我有两种方法:
public static List<int> Lista(int vrDok)
{
List<int> list = new List<int>();
using (FbConnection con = new FbConnection(M.Baza.connectionKomercijalno2018))
{
con.Open();
using (FbCommand cmd = new FbCommand("SELECT BRDOK FROM DOKUMENT WHERE VRDOK = @VrDok ORDER BY DATUM ASC", con))
{
cmd.Parameters.AddWithValue("@VrDok", vrDok);
FbDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
list.Add(Convert.ToInt32(dr[0]));
}
}
}
return list;
}
public static List<int> Lista(int magacinId)
{
List<int> list = new List<int>();
using …Run Code Online (Sandbox Code Playgroud) 所以我刚刚升级到 Visual Studio 2019 并创建了新的 ASP.NET Core 项目。在那里我添加了一些视图/css,然后我点击了Debug.
当我在 in.cshtml或.csswhiledebugging打开时更改一些代码时出现问题。我在浏览器中刷新我的页面,但它不会在该文件中加载新内容。这在2017年是完全正常的事情。
该怎么办?
正如标题所说,GetComponent()确实对性能产生了很大的影响.
我问这个是因为我不喜欢这样做:
public class Player : MonoBehaviour
{
PlayerStats playerStats = this.GetComponent<PlayerStats>();
void Update()
{
var something = playerStats.Asd;
}
}
Run Code Online (Sandbox Code Playgroud)
而不是我喜欢这样使用它:
public class Player : MonoBehaviour
{
void Update()
{
var something = this.GetComponent<PlayerStats>().Asd;
}
}
Run Code Online (Sandbox Code Playgroud)
原因是因为我喜欢在很多脚本断码(很容易对我来说,如果需要以后改变的东西,也对多个对象使用一个脚本),因此,如果我有很多的脚本我需要看到,如果我有已经定义PlayerStats playerStats....但不仅仅是这个,而是很多.
那么使用第二种方法会减慢我的游戏速度吗?
我有这个代码:
List<List<string>> strs = new List<List<string>>();
List<string> str = new List<string>();
foreach (DataGridViewRow sr in dataGridView1.SelectedRows)
{
if(i >= 10)
{
strs.Add(str); //Here strs have one str with 10 values
str.Clear();
i = 0;
var a = strs; //Here strs have one str with 0 values
}
str.Add(sr.Cells["MOBILNI"].Value.ToString().Trim());
i++;
}
strs.Add(str);
Run Code Online (Sandbox Code Playgroud)
我列出了strings我填充的列表,当它达到10个成员时,我将整个列表放入列表中List<string>,然后清除列表strings以填充下一个10项.问题是,当strings达到10个成员的列表时,我将其添加到列表中List<string>并在调试中我看到我strs有1个成员(List<string>)其中有10个元素(10个字符串)但是当我清除strings它的基本列表时它也清除了里面的列表List<List<string>>.
当我使用str = new List<string>()而不是str.Clear()它正常工作.
那为什么会发生这种情况以及如何克服它?