我有
public class Item
{
public string description { get; set; }
public string item_uri { get; set; }
public thumbnail thumbnail { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
和
public class thumbnail
{
private string url { get; set; }
private string width { get; set; }
private string height { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
如果我创建的对象Item是这样
Item item = new Item ();
Run Code Online (Sandbox Code Playgroud)
我如何可以访问的变量url,width和height?
谢谢!
我有两个列表如下
var query1 = from enrollments in db.Enrollments
where enrollments.studentID == studentID && enrollments.result >= 50 && enrollments.enrolled == false
select enrollments.subjectID;
var query2 = from prerequisites in db.Prerequisites
where prerequisites.subjectID == subjectID
select prerequisites.prerequisiteID;
Run Code Online (Sandbox Code Playgroud)
现在我想确保query2中的所有数字都存在于query1中.换句话说,我想确保query2是query1的一部分
有任何想法吗?
PS
-你可以肯定的是subjectID和prerequisiteID是一回事
- 我可以将query1和query2转换为这样的列表 query.ToList()
我需要获取目录中最大的10个文件.我想做的是以下几点:
const noFiles = 10;
biggestFilesArray [noFiles][noFiles]; // file path and file size
const minLength = 0;
string [] fileEntries = Directory.GetFiles(path);
foreach (string _file in fileEntries)
{
// fill in first 10 files in the array then check if file size bigger than smallest inserted file. If yes then insert it and take smallest out.
}
// Sort Array
Run Code Online (Sandbox Code Playgroud)
有没有内置的方法可以帮我吗?
由于某种原因,当将 PowerShell 中的某些值从十六进制转换为十进制时,我得到了不正确的值。
例如: - 输入0xC0000000然后按回车键,您会得到-1073741824不正确的值,正确的值为3221225472。给出的答案是我输入的负十六进制数的值FFFFFFFFC0000000
我认为这可能是一个解释问题,所以我明确要求将值从十六进制转换为 Base10(十进制),我仍然得到相同的错误答案-1073741824:
[Convert]::ToString(0xc0000000,10)
Run Code Online (Sandbox Code Playgroud)
为什么 PowerShell 将0xc0000000十六进制数解释为负数c0000000?我在这里错过了什么吗?
我在pictureBox中使用c#显示图像.然后我想改变图像的名称.我不能,因为我得到了另一个进程正在使用的图像.
我这样打开图像
Image image1 = Image.FromFile("IMAGE LOCATION"); ;
pictureBox1.Image = image1;
Run Code Online (Sandbox Code Playgroud)
然后尝试以这种方式更改它的名称,我得到一个IO异常,说"进程无法访问该文件,因为它正被另一个进程使用.
System.IO.File.Copy(@"OldName", @"NewName"); //copy changes name if paths are in the same folder
Run Code Online (Sandbox Code Playgroud)
对象image1不是持有图像吗?为什么文件仍然被前一个进程锁定?任何建议,将不胜感激.非常感谢!
我试图通过在每个页面的顶部显示10个数字来向网站添加分页.我编写了这段代码来生成与每个页面对应的10个数字
@for (int i = (Math.Ceiling( page / 10 - 1) * 10 ) + 1; i <= Math.Ceiling( page / 10 - 1) * 10 + 10 ; i++)
{
@Html.ActionLink(i.ToString(), "ShowItems", page = i.ToString() })
@Html.Raw(",");
}
Run Code Online (Sandbox Code Playgroud)
除了结束,这个工作正常.例如,如果我有12页,将显示分页
1 2 3 4 5 6 7 8 9 10
Run Code Online (Sandbox Code Playgroud)
对于1-10之间的所有页面然后将显示
11 12 13 14 15 16 17 18 19 20
Run Code Online (Sandbox Code Playgroud)
对于第11和12页.
我需要将循环更改为在最后一页停止计数器的操作.
有任何想法吗?
谢谢!
PS我不想使用,PagedList因为我正在处理大量数据,无法加载它.
我有以下字符串:"02-06-2018 16:25:28"。我需要将其转换为DateTime对象。我尝试这样做:
[DateTime]::ParseExact('02-06-2018 16:25:28', 'dd-MM-yyyy hh:mm:ss', $null)
Run Code Online (Sandbox Code Playgroud)
但这没有用:
无法将字符串识别为有效的DateTime。
除了[DateTime]::ParseExact支持在此fomat中解析字符串之外,还有其他功能dd-MM-yyyy hh:mm:ss吗?
我正在使用PowerShell v5.1。
我有一个名为Form1的表单.在其中,我有一个名为Encrypt的按钮.当我按下那个按钮时,我在另一个类中调用一个方法.我希望该方法更改textBox1.text的值,但是当我使用此代码时没有任何反应
public string txtbox1
{
get
{
return textBox1.Text;
}
set
{
textBox1.Text = value;
}
}
Run Code Online (Sandbox Code Playgroud)
Form1 textboxes = new Form1();//creating object of the Form1 class
textboxes.txtbox1= "whatever";
Run Code Online (Sandbox Code Playgroud)
第一个文本框中没有任何变化.这就像我根本不按任何东西!
任何帮助将非常感激
在以下volume词典列表中:
[
{'AvailabilityZone':'ap-southeast-2b'},
{'AvailabilityZone':'ap-southeast-2b', 'Tags':[{'Key': 'Name'},{'Key': 'Project1'}]},
{'AvailabilityZone':'ap-southeast-2b', 'Tags':[{'Key': 'Name'},{'Key': 'Project2'}]}
]
Run Code Online (Sandbox Code Playgroud)
我需要找到每个具有Project1密钥标签的卷.
我尝试过以下操作:
found_volumes = []
for one_volume in volumes:
if ('Tags' in one_volume) and ('Key' in one_volume['Tags'] == 'Project1'):
found_volumes.append(one_volume)
Run Code Online (Sandbox Code Playgroud)
但它不起作用,我最后得到0项found_volumes.
我究竟做错了什么?
我有以下内容:
string _file; //can have any file path on the file server
if (_file.EndsWith("xls") || _file.EndsWith("pdf") || _file.EndsWith("doc"))
return _file;
Run Code Online (Sandbox Code Playgroud)
该扩展是硬编码的,我需要把它们web.config并使其在某种程度上更可配置的,它可以有1允许扩展名(比方说.doc)或50个允许扩展(.doc,.xls,.xlsx,.ppt,...).
你有什么建议?
c# ×7
powershell ×2
asp.net ×1
asp.net-mvc ×1
comparison ×1
filelock ×1
filesystems ×1
hex ×1
linq ×1
list ×1
loops ×1
object ×1
python-3.x ×1
razor ×1
subset ×1